Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ master

Historique | Voir | Annoter | Télécharger (29,64 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, 
115
        coord_max = 2e+07)
116

    
117
Arguments
118
~~~~~~~~~
119

    
120
``samples``
121

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

    
126
``llr_thres``
127

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

    
130
``coord_max``
131

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

    
134
Value
135
~~~~~
136

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

    
139
Author(s)
140
~~~~~~~~~
141

    
142
Florent Chuffart
143

    
144
Examples
145
~~~~~~~~
146

    
147
::
148

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

    
173
R: Aligns nucleosomes between 2 strains.
174

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

    
178
Description
179
~~~~~~~~~~~
180

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

    
184
Usage
185
~~~~~
186

    
187
::
188

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

    
193
Arguments
194
~~~~~~~~~
195

    
196
``replicates``
197

    
198
Set of replicates, ideally 3 per strain.
199

    
200
``wp_nucs_strain_ref1``
201

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

    
205
``wp_nucs_strain_ref2``
206

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

    
210
``corr_thres``
211

    
212
Correlation threshold.
213

    
214
``llr_thres``
215

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

    
218
``config``
219

    
220
GLOBAL config variable
221

    
222
``...``
223

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

    
227
Value
228
~~~~~
229

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

    
232
Author(s)
233
~~~~~~~~~
234

    
235
Florent Chuffart
236

    
237
Examples
238
~~~~~~~~
239

    
240
::
241

    
242

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

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

    
284
R: Compute the list of SNEPs for a given set of marker, strain...
285

    
286
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
287
-------------------------------------------------------------------------------------
288

    
289
Description
290
~~~~~~~~~~~
291

    
292
This function uses
293

    
294
Usage
295
~~~~~
296

    
297
::
298

    
299
    analyse_count_table(marker, combi, form, all_samples, 
300
        FDR = 1e-04, config = NULL)
301

    
302
Arguments
303
~~~~~~~~~
304

    
305
``marker``
306

    
307
The marker involved.
308

    
309
``combi``
310

    
311
The strain combination involved.
312

    
313
``form``
314

    
315
the nuc form involved.
316

    
317
``all_samples``
318

    
319
Global list of samples.
320

    
321
``FDR``
322

    
323
``config``
324

    
325
GLOBAL config variable
326

    
327
Author(s)
328
~~~~~~~~~
329

    
330
Florent Chuffart
331

    
332
Examples
333
~~~~~~~~
334

    
335
::
336

    
337
    marker = "H3K4me1"
338
    combi = c("BY", "YJM")
339
    form = "wpunr" # "wp" | "unr" | "wpunr"
340
    # foo = analyse_count_table(marker, combi, form)
341
    # foo = analyse_count_table("H4K12ac", c("BY", "RM"), "wp")
342

    
343
R: Build count table for a set of samples.
344

    
345
Build count table for a set of samples.
346
---------------------------------------
347

    
348
Description
349
~~~~~~~~~~~
350

    
351
This function build a count table for a set of sample.
352

    
353
Usage
354
~~~~~
355

    
356
::
357

    
358
    build_count_table(marker, combi, form, curs, all_samples, 
359
        config = NULL)
360

    
361
Arguments
362
~~~~~~~~~
363

    
364
``marker``
365

    
366
The marker that we want to build the count table.
367

    
368
``combi``
369

    
370
The combinations of strains that we want to build the count table.
371

    
372
``form``
373

    
374
The nucleosome that we want to observe: "wp" for sel;l position and
375
"unr" for UNR.
376

    
377
``curs``
378

    
379
The list of CURs
380

    
381
``all_samples``
382

    
383
A table that describe all our samples.
384

    
385
``config``
386

    
387
GLOBAL config variable.
388

    
389
Author(s)
390
~~~~~~~~~
391

    
392
Florent Chuffart
393

    
394
R: Extract maps from TemplateFilter outputs
395

    
396
Extract maps from TemplateFilter outputs
397
----------------------------------------
398

    
399
Description
400
~~~~~~~~~~~
401

    
402
This function extracts from TemplateFilter outputs./ This is from there
403
that aggregate\_intra\_strain\_nucs and align\_inter\_strain\_nucs
404
fucntions are calles. This fucntion write well positionned, fuzzy and
405
both maps in the config$RESULTS\_DIR directory.
406

    
407
Usage
408
~~~~~
409

    
410
::
411

    
412
    build_maps(strains, combis, all_samples, curs, config = NULL)
413

    
414
Arguments
415
~~~~~~~~~
416

    
417
``strains``
418

    
419
The strains for which we want to extract intra strain information.
420

    
421
``combis``
422

    
423
The combinations of strains for which we want to extract inter strain
424
information.
425

    
426
``all_samples``
427

    
428
A table that describe all our samples.
429

    
430
``curs``
431

    
432
The list of CURs
433

    
434
``config``
435

    
436
GLOBAL config variable.
437

    
438
Author(s)
439
~~~~~~~~~
440

    
441
Florent Chuffart
442

    
443
R: Stage replicates data
444

    
445
Stage replicates data
446
---------------------
447

    
448
Description
449
~~~~~~~~~~~
450

    
451
This function loads in memory the data corresponding to the given
452
experiments.
453

    
454
Usage
455
~~~~~
456

    
457
::
458

    
459
    build_replicates(expe, roi, only_fetch = FALSE, get_genome = FALSE, 
460
        all_samples, config = NULL)
461

    
462
Arguments
463
~~~~~~~~~
464

    
465
``expe``
466

    
467
a list of vectors corresponding to replicates.
468

    
469
``roi``
470

    
471
the region that we are interested in.
472

    
473
``only_fetch``
474

    
475
filter or not inputs.
476

    
477
``get_genome``
478

    
479
Load or not corresponding genome.
480

    
481
``all_samples``
482

    
483
Global list of samples.
484

    
485
``config``
486

    
487
GLOBAL config variable.
488

    
489
Author(s)
490
~~~~~~~~~
491

    
492
Florent Chuffart
493

    
494
Examples
495
~~~~~~~~
496

    
497
::
498

    
499
    # library(rjson)
500
    # library(nucleominer)
501
    #
502
    # # Read config file
503
    # json_conf_file = "nucleominer_config.json"
504
    # config = fromJSON(paste(readLines(json_conf_file), collapse=""))
505
    # # Read sample file
506
    # all_samples = read.cvs(config$CSV_SAMPLE_FILE, sep=";", header=TRUE, stringsAsFactors=FALSE)
507
    # # here are the sample ids in a list
508
    # expes = list(c(1))
509
    # # here is the region that we wnt to see the coverage
510
    # cur = list(chr="8", begin=472000, end=474000, strain_ref="BY")
511
    # # it displays the corverage
512
    # replicates = build_replicates(expes, cur, all_samples=all_samples, config=config)
513
    # out = watch_samples(replicates, config$READ_LENGTH,
514
    #       plot_coverage = TRUE,
515
    #       plot_squared_reads = FALSE,
516
    #       plot_ref_genome = FALSE,
517
    #       plot_arrow_raw_reads = FALSE,
518
    #       plot_arrow_nuc_reads = FALSE,
519
    #       plot_gaussian_reads = FALSE,
520
    #       plot_gaussian_unified_reads = FALSE,
521
    #       plot_ellipse_nucs = FALSE,
522
    #       plot_wp_nucs = FALSE,
523
    #       plot_wp_nuc_model = FALSE,
524
    #       plot_common_nucs = FALSE,
525
    #       height = 50)
526

    
527
R: Extract a sub part of the corresponding c2c file
528

    
529
Extract a sub part of the corresponding c2c file
530
------------------------------------------------
531

    
532
Description
533
~~~~~~~~~~~
534

    
535
This fonction allows to access to a specific part of the c2c file.
536

    
537
Usage
538
~~~~~
539

    
540
::
541

    
542
    c2c_extraction(strain1, strain2, chr = NULL, lower_bound = NULL, 
543
        upper_bound = NULL, config = NULL)
544

    
545
Arguments
546
~~~~~~~~~
547

    
548
``strain1``
549

    
550
the key strain
551

    
552
``strain2``
553

    
554
the target strain
555

    
556
``chr``
557

    
558
if defined, the c2c will be filtered according to the chromosome value
559

    
560
``lower_bound``
561

    
562
if defined, the c2c will be filtered for part of the genome upper than
563
lower\_bound
564

    
565
``upper_bound``
566

    
567
if defined, the c2c will be filtered for part of the genome lower than
568
upper\_bound
569

    
570
``config``
571

    
572
GLOBAL config variable
573

    
574
Author(s)
575
~~~~~~~~~
576

    
577
Florent Chuffart
578

    
579
R: reformat an "apply manipulated" list of regions
580

    
581
reformat an "apply manipulated" list of regions
582
-----------------------------------------------
583

    
584
Description
585
~~~~~~~~~~~
586

    
587
Utils to reformat an "apply manipulated" list of regions
588

    
589
Usage
590
~~~~~
591

    
592
::
593

    
594
    collapse_regions(regions)
595

    
596
Arguments
597
~~~~~~~~~
598

    
599
+---------------+----+
600
| ``regions``   |    |
601
+---------------+----+
602

    
603
Author(s)
604
~~~~~~~~~
605

    
606
Florent Chuffart
607

    
608
R: Compute Common Uninterrupted Regions (CUR)
609

    
610
Compute Common Uninterrupted Regions (CUR)
611
------------------------------------------
612

    
613
Description
614
~~~~~~~~~~~
615

    
616
CURs are regions that can be aligned between the genomes
617

    
618
Usage
619
~~~~~
620

    
621
::
622

    
623
    compute_curs(diff_allowed = 30, min_cur_width = 4000, 
624
        combis = list(c("BY", "RM"), c("BY", "YJM"), c("RM", 
625
            "YJM")), config = NULL)
626

    
627
Arguments
628
~~~~~~~~~
629

    
630
``diff_allowed``
631

    
632
the maximum indel width allowe din a CUR
633

    
634
``min_cur_width``
635

    
636
The minimum width of a CUR
637

    
638
``combis``
639

    
640
list of strain than will be tested as uninterrupted regions
641

    
642
``config``
643

    
644
GLOBAL config variable
645

    
646
Author(s)
647
~~~~~~~~~
648

    
649
Florent Chuffart
650

    
651
R: count reads cur
652

    
653
count reads cur
654
---------------
655

    
656
Usage
657
~~~~~
658

    
659
::
660

    
661
    count_reads_cur(...)
662

    
663
Arguments
664
~~~~~~~~~
665

    
666
+-----------+----+
667
| ``...``   |    |
668
+-----------+----+
669

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

    
673
Florent Chuffart
674

    
675
R: Crop bound of regions according to region of interest bound
676

    
677
Crop bound of regions according to region of interest bound
678
-----------------------------------------------------------
679

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

    
683
The fucntion is no more necessary since we remove "big\_cur" bug in
684
translate\_cur function.
685

    
686
Usage
687
~~~~~
688

    
689
::
690

    
691
    crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL)
692

    
693
Arguments
694
~~~~~~~~~
695

    
696
``tmp_fuzzy_nucs``
697

    
698
the regiuons to be croped.
699

    
700
``roi``
701

    
702
The region of interest.
703

    
704
``strain``
705

    
706
The strain to consider.
707

    
708
``config``
709

    
710
GLOBAL config variable
711

    
712
Author(s)
713
~~~~~~~~~
714

    
715
Florent Chuffart
716

    
717
R: Adding list to a dataframe.
718

    
719
Adding list to a dataframe.
720
---------------------------
721

    
722
Description
723
~~~~~~~~~~~
724

    
725
Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*. Return
726
the dataframe *df*.
727

    
728
Usage
729
~~~~~
730

    
731
::
732

    
733
    dfadd(df, l)
734

    
735
Arguments
736
~~~~~~~~~
737

    
738
``df``
739

    
740
A dataframe
741

    
742
``l``
743

    
744
A list
745

    
746
Value
747
~~~~~
748

    
749
Return the dataframe *df*.
750

    
751
Author(s)
752
~~~~~~~~~
753

    
754
Florent Chuffart
755

    
756
Examples
757
~~~~~~~~
758

    
759
::
760

    
761
    ## Here dataframe is NULL
762
    print(df)
763
    df = NULL
764

    
765
    # Initialize df
766
    df = dfadd(df, list(key1 = "value1", key2 = "value2"))
767
    print(df)
768

    
769
    # Adding elements to df
770
    df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
771
    print(df)
772

    
773
R: extract maps
774

    
775
extract maps
776
------------
777

    
778
Usage
779
~~~~~
780

    
781
::
782

    
783
    extract_maps(...)
784

    
785
Arguments
786
~~~~~~~~~
787

    
788
+-----------+----+
789
| ``...``   |    |
790
+-----------+----+
791

    
792
Author(s)
793
~~~~~~~~~
794

    
795
Florent Chuffart
796

    
797
R: Prefetch data
798

    
799
Prefetch data
800
-------------
801

    
802
Description
803
~~~~~~~~~~~
804

    
805
Fetch and filter inputs and outpouts per region of interest. Organize it
806
per replicates.
807

    
808
Usage
809
~~~~~
810

    
811
::
812

    
813
    fetch_mnase_replicates(strain, roi, all_samples, config = NULL, 
814
        only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE)
815

    
816
Arguments
817
~~~~~~~~~
818

    
819
``strain``
820

    
821
The strain we want mnase replicatesList of replicates. Each replicates
822
is a vector of sample ids.
823

    
824
``roi``
825

    
826
Region of interest.
827

    
828
``all_samples``
829

    
830
Global list of samples.
831

    
832
``config``
833

    
834
GLOBAL config variable
835

    
836
``only_fetch``
837

    
838
If TRUE, only fetch and not filtering. It is used tio load sample files
839
into memory before forking.
840

    
841
``get_genome``
842

    
843
If TRUE, load corresponding genome sequence.
844

    
845
``get_ouputs``
846

    
847
If TRUE, get also ouput corresponding TF output files.
848

    
849
Author(s)
850
~~~~~~~~~
851

    
852
Florent Chuffart
853

    
854
R: Filter TemplateFilter inputs
855

    
856
Filter TemplateFilter inputs
857
----------------------------
858

    
859
Description
860
~~~~~~~~~~~
861

    
862
This function filters TemplateFilter inputs according genome area
863
observed properties. It takes into account reads that are at the
864
frontier of this area and the strand of these reads.
865

    
866
Usage
867
~~~~~
868

    
869
::
870

    
871
    filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160, 
872
        only_f = FALSE, only_r = FALSE, filter_for_coverage = FALSE)
873

    
874
Arguments
875
~~~~~~~~~
876

    
877
``inputs``
878

    
879
TF inputs to be filtered.
880

    
881
``chr``
882

    
883
Chromosome observed, here chr is an integer.
884

    
885
``x_min``
886

    
887
Coordinate of the first bp observed.
888

    
889
``x_max``
890

    
891
Coordinate of the last bp observed.
892

    
893
``nuc_width``
894

    
895
Nucleosome width.
896

    
897
``only_f``
898

    
899
Filter only F reads.
900

    
901
``only_r``
902

    
903
Filter only R reads.
904

    
905
``filter_for_coverage``
906

    
907
Does it filter for plot coverage?
908

    
909
Value
910
~~~~~
911

    
912
Returns filtred inputs.
913

    
914
Author(s)
915
~~~~~~~~~
916

    
917
Florent Chuffart
918

    
919
R: Filter TemplateFilter outputs
920

    
921
Filter TemplateFilter outputs
922
-----------------------------
923

    
924
Description
925
~~~~~~~~~~~
926

    
927
This function filters TemplateFilter outputs according, not only genome
928
area observerved properties, but also correlation and overlapping
929
threshold.
930

    
931
Usage
932
~~~~~
933

    
934
::
935

    
936
    filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160, 
937
        ol_bp = 59, corr_thres = 0.5)
938

    
939
Arguments
940
~~~~~~~~~
941

    
942
``tf_outputs``
943

    
944
TemplateFilter outputs.
945

    
946
``chr``
947

    
948
Chromosome observed, here chr is an integer.
949

    
950
``x_min``
951

    
952
Coordinate of the first bp observed.
953

    
954
``x_max``
955

    
956
Coordinate of the last bp observed.
957

    
958
``nuc_width``
959

    
960
Nucleosome width.
961

    
962
``ol_bp``
963

    
964
Overlap Threshold.
965

    
966
``corr_thres``
967

    
968
Correlation threshold.
969

    
970
Value
971
~~~~~
972

    
973
Returns filtered TemplateFilter Outputs
974

    
975
Author(s)
976
~~~~~~~~~
977

    
978
Florent Chuffart
979

    
980
R: to flat aggregate\_intra\_strain\_nucs function output
981

    
982
to flat aggregate\_intra\_strain\_nucs function output
983
------------------------------------------------------
984

    
985
Description
986
~~~~~~~~~~~
987

    
988
This function builds a dataframe of all clusters obtain from
989
aggregate\_intra\_strain\_nucs function.
990

    
991
Usage
992
~~~~~
993

    
994
::
995

    
996
    flat_aggregated_intra_strain_nucs(partial_strain_maps, 
997
        cur_index, nb_tracks = 3)
998

    
999
Arguments
1000
~~~~~~~~~
1001

    
1002
``partial_strain_maps``
1003

    
1004
the output of aggregate\_intra\_strain\_nucs function
1005

    
1006
``cur_index``
1007

    
1008
the index of the roi involved
1009

    
1010
``nb_tracks``
1011

    
1012
the number of replicates
1013

    
1014
Value
1015
~~~~~
1016

    
1017
Returns a dataframe of all clusters obtain from
1018
aggregate\_intra\_strain\_nucs function.
1019

    
1020
Author(s)
1021
~~~~~~~~~
1022

    
1023
Florent Chuffart
1024

    
1025
R: flat reads
1026

    
1027
flat reads
1028
----------
1029

    
1030
Description
1031
~~~~~~~~~~~
1032

    
1033
Extract reads coordinates from TempleteFilter input sequence
1034

    
1035
Usage
1036
~~~~~
1037

    
1038
::
1039

    
1040
    flat_reads(reads, nuc_width)
1041

    
1042
Arguments
1043
~~~~~~~~~
1044

    
1045
``reads``
1046

    
1047
TemplateFilter input reads
1048

    
1049
``nuc_width``
1050

    
1051
Width used to shift F and R reads.
1052

    
1053
Value
1054
~~~~~
1055

    
1056
Returns a list of F reads, R reads and joint/shifted F and R reads.
1057

    
1058
Author(s)
1059
~~~~~~~~~
1060

    
1061
Florent Chuffart
1062

    
1063
R: Retrieve Reads
1064

    
1065
Retrieve Reads
1066
--------------
1067

    
1068
Description
1069
~~~~~~~~~~~
1070

    
1071
Retrieve reads for a given marker, combi, form.
1072

    
1073
Usage
1074
~~~~~
1075

    
1076
::
1077

    
1078
    get_all_reads(marker, combi, form = "wp", config = NULL)
1079

    
1080
Arguments
1081
~~~~~~~~~
1082

    
1083
``marker``
1084

    
1085
The marker to considere.
1086

    
1087
``combi``
1088

    
1089
The starin combination to considere.
1090

    
1091
``form``
1092

    
1093
The nuc form to considere.
1094

    
1095
``config``
1096

    
1097
GLOBAL config variable
1098

    
1099
Author(s)
1100
~~~~~~~~~
1101

    
1102
Florent Chuffart
1103

    
1104
R: get comp strand
1105

    
1106
get comp strand
1107
---------------
1108

    
1109
Description
1110
~~~~~~~~~~~
1111

    
1112
Compute the complementatry strand.
1113

    
1114
Usage
1115
~~~~~
1116

    
1117
::
1118

    
1119
    get_comp_strand(strand)
1120

    
1121
Arguments
1122
~~~~~~~~~
1123

    
1124
``strand``
1125

    
1126
The original strand.
1127

    
1128
Value
1129
~~~~~
1130

    
1131
Returns the complementatry strand.
1132

    
1133
Author(s)
1134
~~~~~~~~~
1135

    
1136
Florent Chuffart
1137

    
1138
R: Build the design for DESeq
1139

    
1140
Build the design for DESeq
1141
--------------------------
1142

    
1143
Description
1144
~~~~~~~~~~~
1145

    
1146
This function build the design according sample properties.
1147

    
1148
Usage
1149
~~~~~
1150

    
1151
::
1152

    
1153
    get_design(marker, combi, all_samples)
1154

    
1155
Arguments
1156
~~~~~~~~~
1157

    
1158
``marker``
1159

    
1160
The marker to considere.
1161

    
1162
``combi``
1163

    
1164
The starin combination to considere.
1165

    
1166
``all_samples``
1167

    
1168
Global list of samples.
1169

    
1170
Author(s)
1171
~~~~~~~~~
1172

    
1173
Florent Chuffart
1174

    
1175
R: Compute the fuzzy list for a given strain.
1176

    
1177
Compute the fuzzy list for a given strain.
1178
------------------------------------------
1179

    
1180
Description
1181
~~~~~~~~~~~
1182

    
1183
This function grabs the nucleosomes detxted by template\_filter that
1184
have been rejected bt aggregate\_intra\_strain\_nucs as well positions.
1185

    
1186
Usage
1187
~~~~~
1188

    
1189
::
1190

    
1191
    get_intra_strain_fuzzy(wp_map, roi, strain, config = NULL)
1192

    
1193
Arguments
1194
~~~~~~~~~
1195

    
1196
``wp_map``
1197

    
1198
Well positionned nucleosomes map.
1199

    
1200
``roi``
1201

    
1202
The region of interest.
1203

    
1204
``strain``
1205

    
1206
The strain we want to extracvt the fuzzy map.
1207

    
1208
``config``
1209

    
1210
GLOBAL config variable.
1211

    
1212
Author(s)
1213
~~~~~~~~~
1214

    
1215
Florent Chuffart
1216

    
1217
R: Compute the unaligned nucleosomal regions (UNRs).
1218

    
1219
Compute the unaligned nucleosomal regions (UNRs).
1220
-------------------------------------------------
1221

    
1222
Description
1223
~~~~~~~~~~~
1224

    
1225
This function aggregate non common wp nucs for each strain and substract
1226
common wp nucs. It does not take care about the size of the resulting
1227
UNR. It will be take into account in the count read part og the
1228
pipeline.
1229

    
1230
Usage
1231
~~~~~
1232

    
1233
::
1234

    
1235
    get_unrs(combi, roi, cur_index, wp_maps, fuzzy_maps, 
1236
        common_nuc_results, config = NULL)
1237

    
1238
Arguments
1239
~~~~~~~~~
1240

    
1241
``combi``
1242

    
1243
The strain combination to consider.
1244

    
1245
``roi``
1246

    
1247
The region of interest.
1248

    
1249
``cur_index``
1250

    
1251
The region of interest index.
1252

    
1253
``wp_maps``
1254

    
1255
Well positionned nucleosomes maps.
1256

    
1257
``fuzzy_maps``
1258

    
1259
Fuzzy nucleosomes maps.
1260

    
1261
``common_nuc_results``
1262

    
1263
Common wp nuc maps
1264

    
1265
``config``
1266

    
1267
GLOBAL config variable
1268

    
1269
Author(s)
1270
~~~~~~~~~
1271

    
1272
Florent Chuffart
1273

    
1274
R: Returns the intersection of 2 list on regions.
1275

    
1276
Returns the intersection of 2 list on regions.
1277
----------------------------------------------
1278

    
1279
Description
1280
~~~~~~~~~~~
1281

    
1282
This function...
1283

    
1284
Usage
1285
~~~~~
1286

    
1287
::
1288

    
1289
    intersect_region(region1, region2)
1290

    
1291
Arguments
1292
~~~~~~~~~
1293

    
1294
``region1``
1295

    
1296
Original regions.
1297

    
1298
``region2``
1299

    
1300
Regions to intersect.
1301

    
1302
Author(s)
1303
~~~~~~~~~
1304

    
1305
Florent Chuffart
1306

    
1307
R: Likelihood ratio
1308

    
1309
Likelihood ratio
1310
----------------
1311

    
1312
Description
1313
~~~~~~~~~~~
1314

    
1315
Compute the log likelihood ratio of two or more set of value.
1316

    
1317
Usage
1318
~~~~~
1319

    
1320
::
1321

    
1322
    llr_score_nvecs(xs)
1323

    
1324
Arguments
1325
~~~~~~~~~
1326

    
1327
``xs``
1328

    
1329
list of vectors.
1330

    
1331
Value
1332
~~~~~
1333

    
1334
Returns the log likelihood ratio.
1335

    
1336
Author(s)
1337
~~~~~~~~~
1338

    
1339
Florent Chuffart
1340

    
1341
Examples
1342
~~~~~~~~
1343

    
1344
::
1345

    
1346
    # LLR score for 2 set of values
1347
    mean1=5; sd1=2; card2 = 250
1348
    mean2=6; sd2=3; card1 = 200
1349
    x1 = rnorm(card1, mean1, sd1)
1350
    x2 = rnorm(card2, mean2, sd2)
1351
    min = floor(min(c(x1,x2)))
1352
    max = ceiling(max(c(x1,x2)))
1353
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1354
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1355
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1356
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1357
    llr_score_nvecs(list(x1,x2))
1358

    
1359
R: mread fasta
1360

    
1361
mread fasta
1362
-----------
1363

    
1364
Usage
1365
~~~~~
1366

    
1367
::
1368

    
1369
    mread.fasta(...)
1370

    
1371
Arguments
1372
~~~~~~~~~
1373

    
1374
+-----------+----+
1375
| ``...``   |    |
1376
+-----------+----+
1377

    
1378
Author(s)
1379
~~~~~~~~~
1380

    
1381
Florent Chuffart
1382

    
1383
R: mread table
1384

    
1385
mread table
1386
-----------
1387

    
1388
Usage
1389
~~~~~
1390

    
1391
::
1392

    
1393
    mread.table(...)
1394

    
1395
Arguments
1396
~~~~~~~~~
1397

    
1398
+-----------+----+
1399
| ``...``   |    |
1400
+-----------+----+
1401

    
1402
Author(s)
1403
~~~~~~~~~
1404

    
1405
Florent Chuffart
1406

    
1407
R: Plot the distribution of reads.
1408

    
1409
Plot the distribution of reads.
1410
-------------------------------
1411

    
1412
Description
1413
~~~~~~~~~~~
1414

    
1415
This fuxntion use the DESeq nomalization feature to compare
1416
qualitatively the distribution.
1417

    
1418
Usage
1419
~~~~~
1420

    
1421
::
1422

    
1423
    plot_dist_samples(strain, marker, res, all_samples, 
1424
        NEWPLOT = TRUE)
1425

    
1426
Arguments
1427
~~~~~~~~~
1428

    
1429
``strain``
1430

    
1431
The strain to considere.
1432

    
1433
``marker``
1434

    
1435
The marker to considere.
1436

    
1437
``res``
1438

    
1439
Data
1440

    
1441
``all_samples``
1442

    
1443
Global list of samples.
1444

    
1445
``NEWPLOT``
1446

    
1447
If FALSE the curve will be add to the current plot.
1448

    
1449
Author(s)
1450
~~~~~~~~~
1451

    
1452
Florent Chuffart
1453

    
1454
R: sign from strand
1455

    
1456
sign from strand
1457
----------------
1458

    
1459
Description
1460
~~~~~~~~~~~
1461

    
1462
Get the sign of strand
1463

    
1464
Usage
1465
~~~~~
1466

    
1467
::
1468

    
1469
    sign_from_strand(strands)
1470

    
1471
Arguments
1472
~~~~~~~~~
1473

    
1474
+---------------+----+
1475
| ``strands``   |    |
1476
+---------------+----+
1477

    
1478
Value
1479
~~~~~
1480

    
1481
If strand in forward then returns 1 else returns -1
1482

    
1483
Author(s)
1484
~~~~~~~~~
1485

    
1486
Florent Chuffart
1487

    
1488
R: Substract to a list of regions an other list of regions that...
1489

    
1490
Substract to a list of regions an other list of regions that intersect it.
1491
--------------------------------------------------------------------------
1492

    
1493
Description
1494
~~~~~~~~~~~
1495

    
1496
This fucntion embed a recursive part. It occurs when a substracted
1497
region split an original region on two.
1498

    
1499
Usage
1500
~~~~~
1501

    
1502
::
1503

    
1504
    substract_region(region1, region2)
1505

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

    
1509
``region1``
1510

    
1511
Original regions.
1512

    
1513
``region2``
1514

    
1515
Regions to substract.
1516

    
1517
Author(s)
1518
~~~~~~~~~
1519

    
1520
Florent Chuffart
1521

    
1522
R: Switch a pairlist
1523

    
1524
Switch a pairlist
1525
-----------------
1526

    
1527
Description
1528
~~~~~~~~~~~
1529

    
1530
Take a pairlist key:value and return the switched pairlist value:key.
1531

    
1532
Usage
1533
~~~~~
1534

    
1535
::
1536

    
1537
    switch_pairlist(l)
1538

    
1539
Arguments
1540
~~~~~~~~~
1541

    
1542
``l``
1543

    
1544
The pairlist to switch.
1545

    
1546
Value
1547
~~~~~
1548

    
1549
The switched pairlist.
1550

    
1551
Author(s)
1552
~~~~~~~~~
1553

    
1554
Florent Chuffart
1555

    
1556
Examples
1557
~~~~~~~~
1558

    
1559
::
1560

    
1561
    l = list(key1 = "value1", key2 = "value2")
1562
    print(switch_pairlist(l))
1563

    
1564
R: Translate coords of a genome region.
1565

    
1566
Translate coords of a genome region.
1567
------------------------------------
1568

    
1569
Description
1570
~~~~~~~~~~~
1571

    
1572
This function is used in the examples, usualy you have to define your
1573
own translation function and overwrite this one using *unlockBinding*
1574
features. Please, refer to the example.
1575

    
1576
Usage
1577
~~~~~
1578

    
1579
::
1580

    
1581
    translate_cur(roi, strain2, config = NULL, big_cur = NULL)
1582

    
1583
Arguments
1584
~~~~~~~~~
1585

    
1586
``roi``
1587

    
1588
Original genome region of interest.
1589

    
1590
``strain2``
1591

    
1592
The strain in wich you want the genome region of interest.
1593

    
1594
``config``
1595

    
1596
GLOBAL config variable
1597

    
1598
``big_cur``
1599

    
1600
A largest region than roi use to filter c2c if it is needed.
1601

    
1602
Author(s)
1603
~~~~~~~~~
1604

    
1605
Florent Chuffart
1606

    
1607
Examples
1608
~~~~~~~~
1609

    
1610
::
1611

    
1612
    # Define new translate_cur function...
1613
    translate_cur = function(roi, strain2, config) {
1614
        strain1 = roi$strain_ref
1615
        if (strain1 == strain2) {
1616
            return(roi)
1617
        } else {
1618
          stop("Here is my new translate_cur function...")
1619
        }
1620
    }
1621
    # Binding it by uncomment follwing lines.
1622
    # unlockBinding("translate_cur", as.environment("package:nm"))
1623
    # unlockBinding("translate_cur", getNamespace("nm"))
1624
    # assign("translate_cur", translate_cur, "package:nm")
1625
    # assign("translate_cur", translate_cur, getNamespace("nm"))
1626
    # lockBinding("translate_cur", getNamespace("nm"))
1627
    # lockBinding("translate_cur", as.environment("package:nm"))
1628

    
1629
R: Translate a list of regions from a strain ref to another.
1630

    
1631
Translate a list of regions from a strain ref to another.
1632
---------------------------------------------------------
1633

    
1634
Description
1635
~~~~~~~~~~~
1636

    
1637
This function is an elaborated call to translate\_cur.
1638

    
1639
Usage
1640
~~~~~
1641

    
1642
::
1643

    
1644
    translate_regions(regions, combi, cur_index, config = NULL, 
1645
        roi)
1646

    
1647
Arguments
1648
~~~~~~~~~
1649

    
1650
``regions``
1651

    
1652
Regions to be translated.
1653

    
1654
``combi``
1655

    
1656
Combination of strains.
1657

    
1658
``cur_index``
1659

    
1660
The region of interest index.
1661

    
1662
``config``
1663

    
1664
GLOBAL config variable
1665

    
1666
``roi``
1667

    
1668
The region of interest.
1669

    
1670
Author(s)
1671
~~~~~~~~~
1672

    
1673
Florent Chuffart
1674

    
1675
R: Aggregate regions that intersect themselves.
1676

    
1677
Aggregate regions that intersect themselves.
1678
--------------------------------------------
1679

    
1680
Description
1681
~~~~~~~~~~~
1682

    
1683
This function is based on sort of lower bounds to detect regions that
1684
intersect. We compare lower bound and upper bound of the porevious item.
1685
This function embed a while loop and break break regions list become
1686
stable.
1687

    
1688
Usage
1689
~~~~~
1690

    
1691
::
1692

    
1693
    union_regions(regions)
1694

    
1695
Arguments
1696
~~~~~~~~~
1697

    
1698
``regions``
1699

    
1700
The Regions to be aggregated
1701

    
1702
Author(s)
1703
~~~~~~~~~
1704

    
1705
Florent Chuffart
1706

    
1707
R: Watching analysis of samples
1708

    
1709
Watching analysis of samples
1710
----------------------------
1711

    
1712
Description
1713
~~~~~~~~~~~
1714

    
1715
This function allows to view analysis for a particuler region of the
1716
genome.
1717

    
1718
Usage
1719
~~~~~
1720

    
1721
::
1722

    
1723
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1724
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1725
        plot_squared_reads = TRUE, plot_coverage = FALSE, 
1726
        plot_gaussian_reads = TRUE, plot_gaussian_unified_reads = TRUE, 
1727
        plot_ellipse_nucs = TRUE, change_col = TRUE, plot_wp_nucs = TRUE, 
1728
        plot_fuzzy_nucs = FALSE, plot_wp_nuc_model = TRUE, 
1729
        plot_common_nucs = FALSE, plot_common_unrs = FALSE, 
1730
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, 
1731
        plot_sample_id = FALSE, aggregated_intra_strain_nucs = NULL, 
1732
        aligned_inter_strain_nucs = NULL, height = 10, 
1733
        main = NULL, xlab = NULL, ylab = "#reads (per million reads)", 
1734
        config = NULL)
1735

    
1736
Arguments
1737
~~~~~~~~~
1738

    
1739
``replicates``
1740

    
1741
replicates under the form...
1742

    
1743
``read_length``
1744

    
1745
length of the reads
1746

    
1747
``plot_ref_genome``
1748

    
1749
Plot (or not) reference genome.
1750

    
1751
``plot_arrow_raw_reads``
1752

    
1753
Plot (or not) arrows for raw reads.
1754

    
1755
``plot_arrow_nuc_reads``
1756

    
1757
Plot (or not) arrows for reads aasiocied to a nucleosome.
1758

    
1759
``plot_squared_reads``
1760

    
1761
Plot (or not) reads in the square fashion.
1762

    
1763
``plot_coverage``
1764

    
1765
Plot (or not) reads in the covergae fashion. fashion.
1766

    
1767
``plot_gaussian_reads``
1768

    
1769
Plot (or not) gaussian model of a F anf R reads.
1770

    
1771
``plot_gaussian_unified_reads``
1772

    
1773
Plot (or not) gaussian model of a nuc.
1774

    
1775
``plot_ellipse_nucs``
1776

    
1777
Plot (or not) ellipse for a nuc.
1778

    
1779
``change_col``
1780

    
1781
Change the color of each nucleosome.
1782

    
1783
``plot_wp_nucs``
1784

    
1785
Plot (or not) cluster of nucs
1786

    
1787
``plot_fuzzy_nucs``
1788

    
1789
Plot (or not) cluster of fuzzy
1790

    
1791
``plot_wp_nuc_model``
1792

    
1793
Plot (or not) gaussian model for a cluster of nucs
1794

    
1795
``plot_common_nucs``
1796

    
1797
Plot (or not) aligned reads.
1798

    
1799
``plot_common_unrs``
1800

    
1801
Plot (or not) unaligned nucleosomal refgions (UNRs).
1802

    
1803
``plot_wp_nucs_4_nonmnase``
1804

    
1805
Plot (or not) clusters for non inputs samples.
1806

    
1807
``plot_chain``
1808

    
1809
Plot (or not) clusterised nuceosomes between mnase samples.
1810

    
1811
``plot_sample_id``
1812

    
1813
Plot (or not) the sample id for each sample.
1814

    
1815
``aggregated_intra_strain_nucs``
1816

    
1817
list of aggregated intra strain nucs. If NULL, it will be computed.
1818

    
1819
``aligned_inter_strain_nucs``
1820

    
1821
list of aligned inter strain nucs. If NULL, it will be computed.
1822

    
1823
``height``
1824

    
1825
Number of reads in per million read for each sample, graphical parametre
1826
for the y axis.
1827

    
1828
``main``
1829

    
1830
main title of the produced plot
1831

    
1832
``xlab``
1833

    
1834
xlab of the produced plot
1835

    
1836
``ylab``
1837

    
1838
ylab of the produced plot
1839

    
1840
``config``
1841

    
1842
GLOBAL config variable
1843

    
1844
Author(s)
1845
~~~~~~~~~
1846

    
1847
Florent Chuffart