Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ 5badc2fd

Historique | Voir | Annoter | Télécharger (28,69 ko)

1
Arabic to Roman pair list.
2
--------------------------
3

    
4
Description
5
~~~~~~~~~~~
6

    
7
Utility to convert Arabic numbers to Roman numbers
8

    
9
Usage
10
~~~~~
11

    
12
::
13

    
14
    ARAB2ROM()
15

    
16
Author(s)
17
~~~~~~~~~
18

    
19
Florent Chuffart
20

    
21
R: False Discovery Rate
22

    
23
False Discovery Rate
24
--------------------
25

    
26
Description
27
~~~~~~~~~~~
28

    
29
From a vector x of independent p-values, extract the cutoff
30
corresponding to the specified FDR. See Benjamini & Hochberg 1995 paper
31

    
32
Usage
33
~~~~~
34

    
35
::
36

    
37
    FDR(x, FDR)
38

    
39
Arguments
40
~~~~~~~~~
41

    
42
``x``
43

    
44
A vector x of independent p-values.
45

    
46
``FDR``
47

    
48
The specified FDR.
49

    
50
Value
51
~~~~~
52

    
53
Return the the corresponding cutoff.
54

    
55
Author(s)
56
~~~~~~~~~
57

    
58
Gael Yvert, Florent Chuffart
59

    
60
Examples
61
~~~~~~~~
62

    
63
::
64

    
65
    print("example")
66

    
67
R: Roman to Arabic pair list.
68

    
69
Roman to Arabic pair list.
70
--------------------------
71

    
72
Description
73
~~~~~~~~~~~
74

    
75
Utility to convert Roman numbers into Arabic numbers
76

    
77
Usage
78
~~~~~
79

    
80
::
81

    
82
    ROM2ARAB()
83

    
84
Author(s)
85
~~~~~~~~~
86

    
87
Florent Chuffart
88

    
89
R: Aggregate replicated sample's nucleosomes.
90

    
91
Aggregate replicated sample's nucleosomes.
92
------------------------------------------
93

    
94
Description
95
~~~~~~~~~~~
96

    
97
This function aggregates nucleosomes from replicated samples. It uses
98
TemplateFilter ouput of each sample as replicate. Each sample owns a set
99
of nucleosomes computed using TemplateFilter and ordered by the position
100
of their center (dyad). A chain of nucleosomes is builts across all
101
replicates. Adjacent nucleosomes of the chain are compared two by two.
102
Comparison is based on a log likelihood ratio (LLR1). depending on the
103
LLR1 value nucleosomes are merged (low LLR) or separated (high LLR).
104
Finally the function returns a list of clusters and all computed
105
llr\_scores. Each cluster ows an attribute wp for "well positioned".
106
This attribute is set to TRUE if the cluster is composed of exactly one
107
nucleosome of each sample.
108

    
109
Usage
110
~~~~~
111

    
112
::
113

    
114
    aggregate_intra_strain_nucs(samples, llr_thres = 20, coord_max = 2e+07)
115

    
116
Arguments
117
~~~~~~~~~
118

    
119
``samples``
120

    
121
A list of samples. Each sample is a list like *sample = list(id=...,
122
marker=..., strain=..., roi=..., inputs=..., outputs=...)* with *roi =
123
list(name=..., begin=..., end=..., chr=..., genome=...)*.
124

    
125
``llr_thres``
126

    
127
Log likelihood ratio threshold to decide between merging and separating
128

    
129
``coord_max``
130

    
131
A too big value to be a coord for a nucleosome lower bound.
132

    
133
Value
134
~~~~~
135

    
136
Returns a list of clusterized nucleosomes, and all computed llr scores.
137

    
138
Author(s)
139
~~~~~~~~~
140

    
141
Florent Chuffart
142

    
143
Examples
144
~~~~~~~~
145

    
146
::
147

    
148
    # Dealing with a region of interest
149
    roi =list(name="example", begin=1000,  end=1300, chr="1", genome=rep("A",301))
150
    samples = list()
151
    for (i in 1:3) {
152
        # Create TF output
153
        tf_nuc = list("chr"=paste("chr", roi$chr, sep=""), "center"=(roi$end + roi$begin)/2, "width"= 150, "correlation.score"= 0.9)
154
        outputs = dfadd(NULL,tf_nuc)
155
        outputs = filter_tf_outputs(outputs, roi$chr, roi$begin, roi$end)
156
        # Generate corresponding reads
157
        nb_reads = round(runif(1,170,230))
158
        reads = round(rnorm(nb_reads, tf_nuc$center,20))
159
        u_reads = sort(unique(reads))
160
        strands = sample(c(rep("R",ceiling(length(u_reads)/2)),rep("F",floor(length(u_reads)/2))))
161
        counts = apply(t(u_reads), 2, function(r) { sum(reads == r)})
162
        shifts = apply(t(strands), 2, function(s) { if (s == "F") return(-tf_nuc$width/2) else return(tf_nuc$width/2)})
163
        u_reads = u_reads + shifts
164
        inputs = data.frame(list("V1" = rep(roi$chr, length(u_reads)),
165
                                 "V2" = u_reads,
166
                                                         "V3" = strands,
167
                                                         "V4" = counts), stringsAsFactors=FALSE)
168
        samples[[length(samples) + 1]] = list(id=1, marker="Mnase_Seq", strain="strain_ex", total_reads = 10000000, roi=roi, inputs=inputs, outputs=outputs)
169
    }
170
    print(aggregate_intra_strain_nucs(samples))
171

    
172
R: Aligns nucleosomes between 2 strains.
173

    
174
Aligns nucleosomes between 2 strains.
175
-------------------------------------
176

    
177
Description
178
~~~~~~~~~~~
179

    
180
This function aligns nucleosomes between two strains for a given genome
181
region.
182

    
183
Usage
184
~~~~~
185

    
186
::
187

    
188
    align_inter_strain_nucs(replicates, wp_nucs_strain_ref1 = NULL, 
189
        wp_nucs_strain_ref2 = NULL, corr_thres = 0.5, llr_thres = 100, 
190
        config = NULL, ...)
191

    
192
Arguments
193
~~~~~~~~~
194

    
195
``replicates``
196

    
197
Set of replicates, ideally 3 per strain.
198

    
199
``wp_nucs_strain_ref1``
200

    
201
List of aggregates nucleosome for strain 1. If it's NULL this list will
202
be computed.
203

    
204
``wp_nucs_strain_ref2``
205

    
206
List of aggregates nucleosome for strain 2. If it's NULL this list will
207
be computed.
208

    
209
``corr_thres``
210

    
211
Correlation threshold.
212

    
213
``llr_thres``
214

    
215
Log likelihood ratio threshold to decide between merging and separating
216

    
217
``config``
218

    
219
GLOBAL config variable
220

    
221
``...``
222

    
223
A list of parameters that will be passed to
224
*aggregate\_intra\_strain\_nucs* if needed.
225

    
226
Value
227
~~~~~
228

    
229
Returns a list of clusterized nucleosomes, and all computed llr scores.
230

    
231
Author(s)
232
~~~~~~~~~
233

    
234
Florent Chuffart
235

    
236
Examples
237
~~~~~~~~
238

    
239
::
240

    
241

    
242
        # Define new translate_cur function...
243
        translate_cur = function(roi, strain2, big_cur=NULL, config=NULL) {
244
          return(roi)
245
        }
246
        # Binding it by uncomment follwing lines.
247
        unlockBinding("translate_cur", as.environment("package:nucleominer"))
248
        unlockBinding("translate_cur", getNamespace("nucleominer"))
249
        assign("translate_cur", translate_cur, "package:nucleominer")
250
        assign("translate_cur", translate_cur, getNamespace("nucleominer"))
251
        lockBinding("translate_cur", getNamespace("nucleominer"))
252
        lockBinding("translate_cur", as.environment("package:nucleominer"))
253

    
254
    # Dealing with a region of interest
255
    roi =list(name="example", begin=1000,  end=1300, chr="1", genome=rep("A",301), strain_ref1 = "STRAINREF1")
256
    roi2 = translate_cur(roi, roi$strain_ref1)
257
    replicates = list()
258
    for (j in 1:2) {
259
        samples = list()
260
        for (i in 1:3) {
261
            # Create TF output
262
            tf_nuc = list("chr"=paste("chr", roi$chr, sep=""), "center"=(roi$end + roi$begin)/2, "width"= 150, "correlation.score"= 0.9)
263
            outputs = dfadd(NULL,tf_nuc)
264
            outputs = filter_tf_outputs(outputs, roi$chr, roi$begin, roi$end)
265
            # Generate corresponding reads
266
            nb_reads = round(runif(1,170,230))
267
            reads = round(rnorm(nb_reads, tf_nuc$center,20))
268
            u_reads = sort(unique(reads))
269
            strands = sample(c(rep("R",ceiling(length(u_reads)/2)),rep("F",floor(length(u_reads)/2))))
270
            counts = apply(t(u_reads), 2, function(r) { sum(reads == r)})
271
            shifts = apply(t(strands), 2, function(s) { if (s == "F") return(-tf_nuc$width/2) else return(tf_nuc$width/2)})
272
            u_reads = u_reads + shifts
273
            inputs = data.frame(list("V1" = rep(roi$chr, length(u_reads)),
274
                                     "V2" = u_reads,
275
                                                             "V3" = strands,
276
                                                             "V4" = counts), stringsAsFactors=FALSE)
277
            samples[[length(samples) + 1]] = list(id=1, marker="Mnase_Seq", strain=paste("strain_ex",j,sep=""), total_reads = 10000000, roi=roi, inputs=inputs, outputs=outputs)
278
        }
279
        replicates[[length(replicates) + 1]] = samples
280
    }
281
    print(align_inter_strain_nucs(replicates))
282

    
283
R: Launch DESeq methods.
284

    
285
Launch DESeq methods.
286
---------------------
287

    
288
Description
289
~~~~~~~~~~~
290

    
291
This function is based on DESeq example. It normalizes data, fit data to
292
GLM model with and without interaction term and compares the two models.
293

    
294
Usage
295
~~~~~
296

    
297
::
298

    
299
    analyse_design(snep_design, reads)
300

    
301
Arguments
302
~~~~~~~~~
303

    
304
``snep_design``
305

    
306
The design to consider.
307

    
308
``reads``
309

    
310
The data to consider.
311

    
312
Author(s)
313
~~~~~~~~~
314

    
315
Florent Chuffart
316

    
317
R: Stage replicates data
318

    
319
Stage replicates data
320
---------------------
321

    
322
Description
323
~~~~~~~~~~~
324

    
325
This function loads in memory the data corresponding to the given
326
experiments.
327

    
328
Usage
329
~~~~~
330

    
331
::
332

    
333
    build_replicates(expe, roi, only_fetch = FALSE, get_genome = FALSE, 
334
        all_samples, config = NULL)
335

    
336
Arguments
337
~~~~~~~~~
338

    
339
``expe``
340

    
341
a list of vectors corresponding to replicates.
342

    
343
``roi``
344

    
345
the region that we are interested in.
346

    
347
``only_fetch``
348

    
349
filter or not inputs.
350

    
351
``get_genome``
352

    
353
Load or not corresponding genome.
354

    
355
``all_samples``
356

    
357
Global list of samples.
358

    
359
``config``
360

    
361
GLOBAL config variable.
362

    
363
Author(s)
364
~~~~~~~~~
365

    
366
Florent Chuffart
367

    
368
Examples
369
~~~~~~~~
370

    
371
::
372

    
373
    # library(rjson)
374
    # library(nucleominer)
375
    #
376
    # # Read config file
377
    # json_conf_file = "nucleominer_config.json"
378
    # config = fromJSON(paste(readLines(json_conf_file), collapse=""))
379
    # # Read sample file
380
    # all_samples = get_content(config$CSV_SAMPLE_FILE, "cvs", sep=";", head=TRUE, stringsAsFactors=FALSE)
381
    # # here are the sample ids in a list
382
    # expes = list(c(1))
383
    # # here is the region that we wnt to see the coverage
384
    # cur = list(chr="8", begin=472000, end=474000, strain_ref="BY")
385
    # # it displays the corverage
386
    # replicates = build_replicates(expes, cur, all_samples=all_samples, config=config)
387
    # out = watch_samples(replicates, config$READ_LENGTH,
388
    #       plot_coverage = TRUE,
389
    #       plot_squared_reads = FALSE,
390
    #       plot_ref_genome = FALSE,
391
    #       plot_arrow_raw_reads = FALSE,
392
    #       plot_arrow_nuc_reads = FALSE,
393
    #       plot_gaussian_reads = FALSE,
394
    #       plot_gaussian_unified_reads = FALSE,
395
    #       plot_ellipse_nucs = FALSE,
396
    #       plot_wp_nucs = FALSE,
397
    #       plot_wp_nuc_model = FALSE,
398
    #       plot_common_nucs = FALSE,
399
    #       height = 50)
400

    
401
R: Extract a sub part of the corresponding c2c file
402

    
403
Extract a sub part of the corresponding c2c file
404
------------------------------------------------
405

    
406
Description
407
~~~~~~~~~~~
408

    
409
This fonction allows to access to a specific part of the c2c file.
410

    
411
Usage
412
~~~~~
413

    
414
::
415

    
416
    c2c_extraction(strain1, strain2, chr = NULL, lower_bound = NULL, 
417
        upper_bound = NULL, config = NULL)
418

    
419
Arguments
420
~~~~~~~~~
421

    
422
``strain1``
423

    
424
the key strain
425

    
426
``strain2``
427

    
428
the target strain
429

    
430
``chr``
431

    
432
if defined, the c2c will be filtered according to the chromosome value
433

    
434
``lower_bound``
435

    
436
if defined, the c2c will be filtered for part of the genome upper than
437
lower\_bound
438

    
439
``upper_bound``
440

    
441
if defined, the c2c will be filtered for part of the genome lower than
442
upper\_bound
443

    
444
``config``
445

    
446
GLOBAL config variable
447

    
448
Author(s)
449
~~~~~~~~~
450

    
451
Florent Chuffart
452

    
453
R: reformat an "apply manipulated" list of regions
454

    
455
reformat an "apply manipulated" list of regions
456
-----------------------------------------------
457

    
458
Description
459
~~~~~~~~~~~
460

    
461
Utils to reformat an "apply manipulated" list of regions
462

    
463
Usage
464
~~~~~
465

    
466
::
467

    
468
    collapse_regions(regions)
469

    
470
Arguments
471
~~~~~~~~~
472

    
473
+---------------+----+
474
| ``regions``   |    |
475
+---------------+----+
476

    
477
Author(s)
478
~~~~~~~~~
479

    
480
Florent Chuffart
481

    
482
R: Compute Common Uninterrupted Regions (CUR)
483

    
484
Compute Common Uninterrupted Regions (CUR)
485
------------------------------------------
486

    
487
Description
488
~~~~~~~~~~~
489

    
490
CURs are regions that can be aligned between the genomes
491

    
492
Usage
493
~~~~~
494

    
495
::
496

    
497
    compute_inter_all_strain_curs(diff_allowed = 30, min_cur_width = 4000, 
498
        config = NULL)
499

    
500
Arguments
501
~~~~~~~~~
502

    
503
``diff_allowed``
504

    
505
the maximum indel width allowe din a CUR
506

    
507
``min_cur_width``
508

    
509
The minimum width of a CUR
510

    
511
``config``
512

    
513
GLOBAL config variable
514

    
515
Author(s)
516
~~~~~~~~~
517

    
518
Florent Chuffart
519

    
520
R: Crop bound of regions according to region of interest bound
521

    
522
Crop bound of regions according to region of interest bound
523
-----------------------------------------------------------
524

    
525
Description
526
~~~~~~~~~~~
527

    
528
The fucntion is no more necessary since we remove "big\_cur" bug in
529
translate\_cur function.
530

    
531
Usage
532
~~~~~
533

    
534
::
535

    
536
    crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL)
537

    
538
Arguments
539
~~~~~~~~~
540

    
541
``tmp_fuzzy_nucs``
542

    
543
the regiuons to be croped.
544

    
545
``roi``
546

    
547
The region of interest.
548

    
549
``strain``
550

    
551
The strain to consider.
552

    
553
``config``
554

    
555
GLOBAL config variable
556

    
557
Author(s)
558
~~~~~~~~~
559

    
560
Florent Chuffart
561

    
562
R: Adding list to a dataframe.
563

    
564
Adding list to a dataframe.
565
---------------------------
566

    
567
Description
568
~~~~~~~~~~~
569

    
570
Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*. Return
571
the dataframe *df*.
572

    
573
Usage
574
~~~~~
575

    
576
::
577

    
578
    dfadd(df, l)
579

    
580
Arguments
581
~~~~~~~~~
582

    
583
``df``
584

    
585
A dataframe
586

    
587
``l``
588

    
589
A list
590

    
591
Value
592
~~~~~
593

    
594
Return the dataframe *df*.
595

    
596
Author(s)
597
~~~~~~~~~
598

    
599
Florent Chuffart
600

    
601
Examples
602
~~~~~~~~
603

    
604
::
605

    
606
    ## Here dataframe is NULL
607
    print(df)
608
    df = NULL
609

    
610
    # Initialize df
611
    df = dfadd(df, list(key1 = "value1", key2 = "value2"))
612
    print(df)
613

    
614
    # Adding elements to df
615
    df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
616
    print(df)
617

    
618
R: Prefetch data
619

    
620
Prefetch data
621
-------------
622

    
623
Description
624
~~~~~~~~~~~
625

    
626
Fetch and filter inputs and outpouts per region of interest. Organize it
627
per replicates.
628

    
629
Usage
630
~~~~~
631

    
632
::
633

    
634
    fetch_mnase_replicates(strain, roi, all_samples, config = NULL, 
635
        only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE)
636

    
637
Arguments
638
~~~~~~~~~
639

    
640
``strain``
641

    
642
The strain we want mnase replicatesList of replicates. Each replicates
643
is a vector of sample ids.
644

    
645
``roi``
646

    
647
Region of interest.
648

    
649
``all_samples``
650

    
651
Global list of samples.
652

    
653
``config``
654

    
655
GLOBAL config variable
656

    
657
``only_fetch``
658

    
659
If TRUE, only fetch and not filtering. It is used tio load sample files
660
into memory before forking.
661

    
662
``get_genome``
663

    
664
If TRUE, load corresponding genome sequence.
665

    
666
``get_ouputs``
667

    
668
If TRUE, get also ouput corresponding TF output files.
669

    
670
Author(s)
671
~~~~~~~~~
672

    
673
Florent Chuffart
674

    
675
R: Filter TemplateFilter inputs
676

    
677
Filter TemplateFilter inputs
678
----------------------------
679

    
680
Description
681
~~~~~~~~~~~
682

    
683
This function filters TemplateFilter inputs according genome area
684
observed properties. It takes into account reads that are at the
685
frontier of this area and the strand of these reads.
686

    
687
Usage
688
~~~~~
689

    
690
::
691

    
692
    filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160, 
693
        only_f = FALSE, only_r = FALSE, filter_for_coverage = FALSE)
694

    
695
Arguments
696
~~~~~~~~~
697

    
698
``inputs``
699

    
700
TF inputs to be filtered.
701

    
702
``chr``
703

    
704
Chromosome observed, here chr is an integer.
705

    
706
``x_min``
707

    
708
Coordinate of the first bp observed.
709

    
710
``x_max``
711

    
712
Coordinate of the last bp observed.
713

    
714
``nuc_width``
715

    
716
Nucleosome width.
717

    
718
``only_f``
719

    
720
Filter only F reads.
721

    
722
``only_r``
723

    
724
Filter only R reads.
725

    
726
``filter_for_coverage``
727

    
728
Does it filter for plot coverage?
729

    
730
Value
731
~~~~~
732

    
733
Returns filtred inputs.
734

    
735
Author(s)
736
~~~~~~~~~
737

    
738
Florent Chuffart
739

    
740
R: Filter TemplateFilter outputs
741

    
742
Filter TemplateFilter outputs
743
-----------------------------
744

    
745
Description
746
~~~~~~~~~~~
747

    
748
This function filters TemplateFilter outputs according, not only genome
749
area observerved properties, but also correlation and overlapping
750
threshold.
751

    
752
Usage
753
~~~~~
754

    
755
::
756

    
757
    filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160, 
758
        ol_bp = 59, corr_thres = 0.5)
759

    
760
Arguments
761
~~~~~~~~~
762

    
763
``tf_outputs``
764

    
765
TemplateFilter outputs.
766

    
767
``chr``
768

    
769
Chromosome observed, here chr is an integer.
770

    
771
``x_min``
772

    
773
Coordinate of the first bp observed.
774

    
775
``x_max``
776

    
777
Coordinate of the last bp observed.
778

    
779
``nuc_width``
780

    
781
Nucleosome width.
782

    
783
``ol_bp``
784

    
785
Overlap Threshold.
786

    
787
``corr_thres``
788

    
789
Correlation threshold.
790

    
791
Value
792
~~~~~
793

    
794
Returns filtered TemplateFilter Outputs
795

    
796
Author(s)
797
~~~~~~~~~
798

    
799
Florent Chuffart
800

    
801
R: to flat aggregate\_intra\_strain\_nucs function output
802

    
803
to flat aggregate\_intra\_strain\_nucs function output
804
------------------------------------------------------
805

    
806
Description
807
~~~~~~~~~~~
808

    
809
This function builds a dataframe of all clusters obtain from
810
aggregate\_intra\_strain\_nucs function.
811

    
812
Usage
813
~~~~~
814

    
815
::
816

    
817
    flat_aggregated_intra_strain_nucs(partial_strain_maps, cur_index)
818

    
819
Arguments
820
~~~~~~~~~
821

    
822
``partial_strain_maps``
823

    
824
the output of aggregate\_intra\_strain\_nucs function
825

    
826
``cur_index``
827

    
828
the index of the roi involved
829

    
830
Value
831
~~~~~
832

    
833
Returns a dataframe of all clusters obtain from
834
aggregate\_intra\_strain\_nucs function.
835

    
836
Author(s)
837
~~~~~~~~~
838

    
839
Florent Chuffart
840

    
841
R: flat reads
842

    
843
flat reads
844
----------
845

    
846
Description
847
~~~~~~~~~~~
848

    
849
Extract reads coordinates from TempleteFilter input sequence
850

    
851
Usage
852
~~~~~
853

    
854
::
855

    
856
    flat_reads(reads, nuc_width)
857

    
858
Arguments
859
~~~~~~~~~
860

    
861
``reads``
862

    
863
TemplateFilter input reads
864

    
865
``nuc_width``
866

    
867
Width used to shift F and R reads.
868

    
869
Value
870
~~~~~
871

    
872
Returns a list of F reads, R reads and joint/shifted F and R reads.
873

    
874
Author(s)
875
~~~~~~~~~
876

    
877
Florent Chuffart
878

    
879
R: Retrieve Reads
880

    
881
Retrieve Reads
882
--------------
883

    
884
Description
885
~~~~~~~~~~~
886

    
887
Retrieve reads for a given marker, combi, form.
888

    
889
Usage
890
~~~~~
891

    
892
::
893

    
894
    get_all_reads(marker, combi, form = "wp", config = NULL)
895

    
896
Arguments
897
~~~~~~~~~
898

    
899
``marker``
900

    
901
The marker to considere.
902

    
903
``combi``
904

    
905
The starin combination to considere.
906

    
907
``form``
908

    
909
The nuc form to considere.
910

    
911
``config``
912

    
913
GLOBAL config variable
914

    
915
Author(s)
916
~~~~~~~~~
917

    
918
Florent Chuffart
919

    
920
R: get comp strand
921

    
922
get comp strand
923
---------------
924

    
925
Description
926
~~~~~~~~~~~
927

    
928
Compute the complementatry strand.
929

    
930
Usage
931
~~~~~
932

    
933
::
934

    
935
    get_comp_strand(strand)
936

    
937
Arguments
938
~~~~~~~~~
939

    
940
``strand``
941

    
942
The original strand.
943

    
944
Value
945
~~~~~
946

    
947
Returns the complementatry strand.
948

    
949
Author(s)
950
~~~~~~~~~
951

    
952
Florent Chuffart
953

    
954
R: Build the design for DESeq
955

    
956
Build the design for DESeq
957
--------------------------
958

    
959
Description
960
~~~~~~~~~~~
961

    
962
This function build the design according sample properties.
963

    
964
Usage
965
~~~~~
966

    
967
::
968

    
969
    get_design(marker, combi, all_samples)
970

    
971
Arguments
972
~~~~~~~~~
973

    
974
``marker``
975

    
976
The marker to considere.
977

    
978
``combi``
979

    
980
The starin combination to considere.
981

    
982
``all_samples``
983

    
984
Global list of samples.
985

    
986
Author(s)
987
~~~~~~~~~
988

    
989
Florent Chuffart
990

    
991
R: Compute the fuzzy list for a given strain.
992

    
993
Compute the fuzzy list for a given strain.
994
------------------------------------------
995

    
996
Description
997
~~~~~~~~~~~
998

    
999
This function grabs the nucleosomes detxted by template\_filter that
1000
have been rejected bt aggregate\_intra\_strain\_nucs as well positions.
1001

    
1002
Usage
1003
~~~~~
1004

    
1005
::
1006

    
1007
    get_intra_strain_fuzzy(wp_map, roi, strain, config = NULL)
1008

    
1009
Arguments
1010
~~~~~~~~~
1011

    
1012
``wp_map``
1013

    
1014
Well positionned nucleosomes map.
1015

    
1016
``roi``
1017

    
1018
The region of interest.
1019

    
1020
``strain``
1021

    
1022
The strain we want to extracvt the fuzzy map.
1023

    
1024
``config``
1025

    
1026
GLOBAL config variable.
1027

    
1028
Author(s)
1029
~~~~~~~~~
1030

    
1031
Florent Chuffart
1032

    
1033
R: Compute the list of SNEPs for a given set of marker, strain...
1034

    
1035
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
1036
-------------------------------------------------------------------------------------
1037

    
1038
Description
1039
~~~~~~~~~~~
1040

    
1041
This function uses
1042

    
1043
Usage
1044
~~~~~
1045

    
1046
::
1047

    
1048
    get_sneps(marker, combi, form, all_samples, FDR = 1e-04, config = NULL)
1049

    
1050
Arguments
1051
~~~~~~~~~
1052

    
1053
``marker``
1054

    
1055
The marker involved.
1056

    
1057
``combi``
1058

    
1059
The strain combination involved.
1060

    
1061
``form``
1062

    
1063
the nuc form involved.
1064

    
1065
``all_samples``
1066

    
1067
Global list of samples.
1068

    
1069
``FDR``
1070

    
1071
``config``
1072

    
1073
GLOBAL config variable
1074

    
1075
Author(s)
1076
~~~~~~~~~
1077

    
1078
Florent Chuffart
1079

    
1080
Examples
1081
~~~~~~~~
1082

    
1083
::
1084

    
1085
    marker = "H3K4me1"
1086
    combi = c("BY", "YJM")
1087
    form = "wpunr" # "wp" | "unr" | "wpunr"
1088
    # foo = get_sneps(marker, combi, form)
1089
    # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
1090

    
1091
R: Compute the unaligned nucleosomal regions (UNRs).
1092

    
1093
Compute the unaligned nucleosomal regions (UNRs).
1094
-------------------------------------------------
1095

    
1096
Description
1097
~~~~~~~~~~~
1098

    
1099
This function aggregate non common wp nucs for each strain and substract
1100
common wp nucs. It does not take care about the size of the resulting
1101
UNR. It will be take into account in the count read part og the
1102
pipeline.
1103

    
1104
Usage
1105
~~~~~
1106

    
1107
::
1108

    
1109
    get_unrs(combi, roi, cur_index, wp_maps, fuzzy_maps, common_nuc_results, 
1110
        config = NULL)
1111

    
1112
Arguments
1113
~~~~~~~~~
1114

    
1115
``combi``
1116

    
1117
The strain combination to consider.
1118

    
1119
``roi``
1120

    
1121
The region of interest.
1122

    
1123
``cur_index``
1124

    
1125
The region of interest index.
1126

    
1127
``wp_maps``
1128

    
1129
Well positionned nucleosomes maps.
1130

    
1131
``fuzzy_maps``
1132

    
1133
Fuzzy nucleosomes maps.
1134

    
1135
``common_nuc_results``
1136

    
1137
Common wp nuc maps
1138

    
1139
``config``
1140

    
1141
GLOBAL config variable
1142

    
1143
Author(s)
1144
~~~~~~~~~
1145

    
1146
Florent Chuffart
1147

    
1148
R: Returns the intersection of 2 list on regions.
1149

    
1150
Returns the intersection of 2 list on regions.
1151
----------------------------------------------
1152

    
1153
Description
1154
~~~~~~~~~~~
1155

    
1156
This function...
1157

    
1158
Usage
1159
~~~~~
1160

    
1161
::
1162

    
1163
    intersect_region(region1, region2)
1164

    
1165
Arguments
1166
~~~~~~~~~
1167

    
1168
``region1``
1169

    
1170
Original regions.
1171

    
1172
``region2``
1173

    
1174
Regions to intersect.
1175

    
1176
Author(s)
1177
~~~~~~~~~
1178

    
1179
Florent Chuffart
1180

    
1181
R: Likelihood ratio
1182

    
1183
Likelihood ratio
1184
----------------
1185

    
1186
Description
1187
~~~~~~~~~~~
1188

    
1189
Compute the log likelihood ratio of two or more set of value.
1190

    
1191
Usage
1192
~~~~~
1193

    
1194
::
1195

    
1196
    llr_score_nvecs(xs)
1197

    
1198
Arguments
1199
~~~~~~~~~
1200

    
1201
``xs``
1202

    
1203
list of vectors.
1204

    
1205
Value
1206
~~~~~
1207

    
1208
Returns the log likelihood ratio.
1209

    
1210
Author(s)
1211
~~~~~~~~~
1212

    
1213
Florent Chuffart
1214

    
1215
Examples
1216
~~~~~~~~
1217

    
1218
::
1219

    
1220
    # LLR score for 2 set of values
1221
    mean1=5; sd1=2; card2 = 250
1222
    mean2=6; sd2=3; card1 = 200
1223
    x1 = rnorm(card1, mean1, sd1)
1224
    x2 = rnorm(card2, mean2, sd2)
1225
    min = floor(min(c(x1,x2)))
1226
    max = ceiling(max(c(x1,x2)))
1227
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1228
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1229
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1230
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1231
    llr_score_nvecs(list(x1,x2))
1232

    
1233
R: nm
1234

    
1235
nm
1236
--
1237

    
1238
Description
1239
~~~~~~~~~~~
1240

    
1241
It provides a set of useful functions allowing to perform quantitative
1242
analysis of nucleosomal epigenome.
1243

    
1244
Details
1245
~~~~~~~
1246

    
1247
+---------------+---------------------------------------------------+
1248
| Package:      | nucleominer                                       |
1249
+---------------+---------------------------------------------------+
1250
| Maintainer:   | Florent Chuffart <florent.chuffart@ens-lyon.fr>   |
1251
+---------------+---------------------------------------------------+
1252
| Author:       | Florent Chuffart                                  |
1253
+---------------+---------------------------------------------------+
1254
| Version:      | 2.3.46                                            |
1255
+---------------+---------------------------------------------------+
1256
| License:      | CeCILL                                            |
1257
+---------------+---------------------------------------------------+
1258
| Title:        | nm                                                |
1259
+---------------+---------------------------------------------------+
1260
| Depends:      | seqinr, plotrix, DESeq, cachecache                |
1261
+---------------+---------------------------------------------------+
1262

    
1263
Author(s)
1264
~~~~~~~~~
1265

    
1266
Florent Chuffart
1267

    
1268
R: Plot the distribution of reads.
1269

    
1270
Plot the distribution of reads.
1271
-------------------------------
1272

    
1273
Description
1274
~~~~~~~~~~~
1275

    
1276
This fuxntion use the DESeq nomalization feature to compare
1277
qualitatively the distribution.
1278

    
1279
Usage
1280
~~~~~
1281

    
1282
::
1283

    
1284
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1285

    
1286
Arguments
1287
~~~~~~~~~
1288

    
1289
``strain``
1290

    
1291
The strain to considere.
1292

    
1293
``marker``
1294

    
1295
The marker to considere.
1296

    
1297
``res``
1298

    
1299
Data
1300

    
1301
``all_samples``
1302

    
1303
Global list of samples.
1304

    
1305
``NEWPLOT``
1306

    
1307
If FALSE the curve will be add to the current plot.
1308

    
1309
Author(s)
1310
~~~~~~~~~
1311

    
1312
Florent Chuffart
1313

    
1314
R: sign from strand
1315

    
1316
sign from strand
1317
----------------
1318

    
1319
Description
1320
~~~~~~~~~~~
1321

    
1322
Get the sign of strand
1323

    
1324
Usage
1325
~~~~~
1326

    
1327
::
1328

    
1329
    sign_from_strand(strands)
1330

    
1331
Arguments
1332
~~~~~~~~~
1333

    
1334
+---------------+----+
1335
| ``strands``   |    |
1336
+---------------+----+
1337

    
1338
Value
1339
~~~~~
1340

    
1341
If strand in forward then returns 1 else returns -1
1342

    
1343
Author(s)
1344
~~~~~~~~~
1345

    
1346
Florent Chuffart
1347

    
1348
R: Substract to a list of regions an other list of regions that...
1349

    
1350
Substract to a list of regions an other list of regions that intersect it.
1351
--------------------------------------------------------------------------
1352

    
1353
Description
1354
~~~~~~~~~~~
1355

    
1356
This fucntion embed a recursive part. It occurs when a substracted
1357
region split an original region on two.
1358

    
1359
Usage
1360
~~~~~
1361

    
1362
::
1363

    
1364
    substract_region(region1, region2)
1365

    
1366
Arguments
1367
~~~~~~~~~
1368

    
1369
``region1``
1370

    
1371
Original regions.
1372

    
1373
``region2``
1374

    
1375
Regions to substract.
1376

    
1377
Author(s)
1378
~~~~~~~~~
1379

    
1380
Florent Chuffart
1381

    
1382
R: Switch a pairlist
1383

    
1384
Switch a pairlist
1385
-----------------
1386

    
1387
Description
1388
~~~~~~~~~~~
1389

    
1390
Take a pairlist key:value and return the switched pairlist value:key.
1391

    
1392
Usage
1393
~~~~~
1394

    
1395
::
1396

    
1397
    switch_pairlist(l)
1398

    
1399
Arguments
1400
~~~~~~~~~
1401

    
1402
``l``
1403

    
1404
The pairlist to switch.
1405

    
1406
Value
1407
~~~~~
1408

    
1409
The switched pairlist.
1410

    
1411
Author(s)
1412
~~~~~~~~~
1413

    
1414
Florent Chuffart
1415

    
1416
Examples
1417
~~~~~~~~
1418

    
1419
::
1420

    
1421
    l = list(key1 = "value1", key2 = "value2")
1422
    print(switch_pairlist(l))
1423

    
1424
R: Translate coords of a genome region.
1425

    
1426
Translate coords of a genome region.
1427
------------------------------------
1428

    
1429
Description
1430
~~~~~~~~~~~
1431

    
1432
This function is used in the examples, usualy you have to define your
1433
own translation function and overwrite this one using *unlockBinding*
1434
features. Please, refer to the example.
1435

    
1436
Usage
1437
~~~~~
1438

    
1439
::
1440

    
1441
    translate_cur(roi, strain2, config = NULL, big_cur = NULL)
1442

    
1443
Arguments
1444
~~~~~~~~~
1445

    
1446
``roi``
1447

    
1448
Original genome region of interest.
1449

    
1450
``strain2``
1451

    
1452
The strain in wich you want the genome region of interest.
1453

    
1454
``config``
1455

    
1456
GLOBAL config variable
1457

    
1458
``big_cur``
1459

    
1460
A largest region than roi use to filter c2c if it is needed.
1461

    
1462
Author(s)
1463
~~~~~~~~~
1464

    
1465
Florent Chuffart
1466

    
1467
Examples
1468
~~~~~~~~
1469

    
1470
::
1471

    
1472
    # Define new translate_cur function...
1473
    translate_cur = function(roi, strain2, config) {
1474
        strain1 = roi$strain_ref
1475
        if (strain1 == strain2) {
1476
            return(roi)
1477
        } else {
1478
          stop("Here is my new translate_cur function...")
1479
        }
1480
    }
1481
    # Binding it by uncomment follwing lines.
1482
    # unlockBinding("translate_cur", as.environment("package:nm"))
1483
    # unlockBinding("translate_cur", getNamespace("nm"))
1484
    # assign("translate_cur", translate_cur, "package:nm")
1485
    # assign("translate_cur", translate_cur, getNamespace("nm"))
1486
    # lockBinding("translate_cur", getNamespace("nm"))
1487
    # lockBinding("translate_cur", as.environment("package:nm"))
1488

    
1489
R: Translate a list of regions from a strain ref to another.
1490

    
1491
Translate a list of regions from a strain ref to another.
1492
---------------------------------------------------------
1493

    
1494
Description
1495
~~~~~~~~~~~
1496

    
1497
This function is an elaborated call to translate\_cur.
1498

    
1499
Usage
1500
~~~~~
1501

    
1502
::
1503

    
1504
    translate_regions(regions, combi, cur_index, config = NULL, roi)
1505

    
1506
Arguments
1507
~~~~~~~~~
1508

    
1509
``regions``
1510

    
1511
Regions to be translated.
1512

    
1513
``combi``
1514

    
1515
Combination of strains.
1516

    
1517
``cur_index``
1518

    
1519
The region of interest index.
1520

    
1521
``config``
1522

    
1523
GLOBAL config variable
1524

    
1525
``roi``
1526

    
1527
The region of interest.
1528

    
1529
Author(s)
1530
~~~~~~~~~
1531

    
1532
Florent Chuffart
1533

    
1534
R: Aggregate regions that intersect themselves.
1535

    
1536
Aggregate regions that intersect themselves.
1537
--------------------------------------------
1538

    
1539
Description
1540
~~~~~~~~~~~
1541

    
1542
This function is based on sort of lower bounds to detect regions that
1543
intersect. We compare lower bound and upper bound of the porevious item.
1544
This function embed a while loop and break break regions list become
1545
stable.
1546

    
1547
Usage
1548
~~~~~
1549

    
1550
::
1551

    
1552
    union_regions(regions)
1553

    
1554
Arguments
1555
~~~~~~~~~
1556

    
1557
``regions``
1558

    
1559
The Regions to be aggregated
1560

    
1561
Author(s)
1562
~~~~~~~~~
1563

    
1564
Florent Chuffart
1565

    
1566
R: Watching analysis of samples
1567

    
1568
Watching analysis of samples
1569
----------------------------
1570

    
1571
Description
1572
~~~~~~~~~~~
1573

    
1574
This function allows to view analysis for a particuler region of the
1575
genome.
1576

    
1577
Usage
1578
~~~~~
1579

    
1580
::
1581

    
1582
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1583
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1584
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1585
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1586
        change_col = TRUE, plot_wp_nucs = TRUE, plot_fuzzy_nucs = TRUE, 
1587
        plot_wp_nuc_model = TRUE, plot_common_nucs = FALSE, plot_common_unrs = FALSE, 
1588
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, plot_sample_id = FALSE, 
1589
        aggregated_intra_strain_nucs = NULL, aligned_inter_strain_nucs = NULL, 
1590
        height = 10, main = NULL, xlab = NULL, ylab = "#reads (per million reads)", 
1591
        config = NULL)
1592

    
1593
Arguments
1594
~~~~~~~~~
1595

    
1596
``replicates``
1597

    
1598
replicates under the form...
1599

    
1600
``read_length``
1601

    
1602
length of the reads
1603

    
1604
``plot_ref_genome``
1605

    
1606
Plot (or not) reference genome.
1607

    
1608
``plot_arrow_raw_reads``
1609

    
1610
Plot (or not) arrows for raw reads.
1611

    
1612
``plot_arrow_nuc_reads``
1613

    
1614
Plot (or not) arrows for reads aasiocied to a nucleosome.
1615

    
1616
``plot_squared_reads``
1617

    
1618
Plot (or not) reads in the square fashion.
1619

    
1620
``plot_coverage``
1621

    
1622
Plot (or not) reads in the covergae fashion. fashion.
1623

    
1624
``plot_gaussian_reads``
1625

    
1626
Plot (or not) gaussian model of a F anf R reads.
1627

    
1628
``plot_gaussian_unified_reads``
1629

    
1630
Plot (or not) gaussian model of a nuc.
1631

    
1632
``plot_ellipse_nucs``
1633

    
1634
Plot (or not) ellipse for a nuc.
1635

    
1636
``change_col``
1637

    
1638
Change the color of each nucleosome.
1639

    
1640
``plot_wp_nucs``
1641

    
1642
Plot (or not) cluster of nucs
1643

    
1644
``plot_fuzzy_nucs``
1645

    
1646
Plot (or not) cluster of fuzzy
1647

    
1648
``plot_wp_nuc_model``
1649

    
1650
Plot (or not) gaussian model for a cluster of nucs
1651

    
1652
``plot_common_nucs``
1653

    
1654
Plot (or not) aligned reads.
1655

    
1656
``plot_common_unrs``
1657

    
1658
Plot (or not) unaligned nucleosomal refgions (UNRs).
1659

    
1660
``plot_wp_nucs_4_nonmnase``
1661

    
1662
Plot (or not) clusters for non inputs samples.
1663

    
1664
``plot_chain``
1665

    
1666
Plot (or not) clusterised nuceosomes between mnase samples.
1667

    
1668
``plot_sample_id``
1669

    
1670
Plot (or not) the sample id for each sample.
1671

    
1672
``aggregated_intra_strain_nucs``
1673

    
1674
list of aggregated intra strain nucs. If NULL, it will be computed.
1675

    
1676
``aligned_inter_strain_nucs``
1677

    
1678
list of aligned inter strain nucs. If NULL, it will be computed.
1679

    
1680
``height``
1681

    
1682
Number of reads in per million read for each sample, graphical parametre
1683
for the y axis.
1684

    
1685
``main``
1686

    
1687
main title of the produced plot
1688

    
1689
``xlab``
1690

    
1691
xlab of the produced plot
1692

    
1693
``ylab``
1694

    
1695
ylab of the produced plot
1696

    
1697
``config``
1698

    
1699
GLOBAL config variable
1700

    
1701
Author(s)
1702
~~~~~~~~~
1703

    
1704
Florent Chuffart