Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ 7646593d

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

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

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

    
7
Util to convert Arabicto Roman
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
Util to convert Roman to Arabic
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 nucleosome for 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. Adajacent nucleosomes are compared two by two.
101
Comparison is based on a log likelihood ratio score. The issue of
102
comparison is adjacents nucleosomes merge or separation. Finally the
103
function returns a list of clusters and all computed *lod\_scores*. Each
104
cluster ows an attribute *wp* for "well positionned". This attribute is
105
set as *TRUE* if the cluster is composed of exactly one nucleosomes of
106
each sample.
107

    
108
Usage
109
~~~~~
110

    
111
::
112

    
113
    aggregate_intra_strain_nucs(samples, lod_thres = 20, coord_max = 2e+07)
114

    
115
Arguments
116
~~~~~~~~~
117

    
118
``samples``
119

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

    
124
``lod_thres``
125

    
126
Log likelihood ration threshold.
127

    
128
``coord_max``
129

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

    
132
Value
133
~~~~~
134

    
135
Returns a list of clusterized nucleosomes, and all computed lod scores.
136

    
137
Author(s)
138
~~~~~~~~~
139

    
140
Florent Chuffart
141

    
142
Examples
143
~~~~~~~~
144

    
145
::
146

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

    
171
R: Aligns nucleosomes between 2 strains.
172

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

    
176
Description
177
~~~~~~~~~~~
178

    
179
This function aligns nucs between two strains for a given genome region.
180

    
181
Usage
182
~~~~~
183

    
184
::
185

    
186
    align_inter_strain_nucs(replicates, wp_nucs_strain_ref1 = NULL, 
187
        wp_nucs_strain_ref2 = NULL, corr_thres = 0.5, lod_thres = 100, 
188
        config = NULL, ...)
189

    
190
Arguments
191
~~~~~~~~~
192

    
193
``replicates``
194

    
195
Set of replicates, ideally 3 per strain.
196

    
197
``wp_nucs_strain_ref1``
198

    
199
List of aggregates nucleosome for strain 1. If it's null this list will
200
be computed.
201

    
202
``wp_nucs_strain_ref2``
203

    
204
List of aggregates nucleosome for strain 2. If it's null this list will
205
be computed.
206

    
207
``corr_thres``
208

    
209
Correlation threshold.
210

    
211
``lod_thres``
212

    
213
LOD cut off.
214

    
215
``config``
216

    
217
GLOBAL config variable
218

    
219
``...``
220

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

    
224
Value
225
~~~~~
226

    
227
Returns a list of clusterized nucleosomes, and all computed lod scores.
228

    
229
Author(s)
230
~~~~~~~~~
231

    
232
Florent Chuffart
233

    
234
Examples
235
~~~~~~~~
236

    
237
::
238

    
239

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

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

    
281
R: Launch deseq methods.
282

    
283
Launch deseq methods.
284
---------------------
285

    
286
Description
287
~~~~~~~~~~~
288

    
289
This function is based on deseq example. It mormalizes data, fit data to
290
GLM model with and without interaction term and compare the two
291
l;=models.
292

    
293
Usage
294
~~~~~
295

    
296
::
297

    
298
    analyse_design(snep_design, reads)
299

    
300
Arguments
301
~~~~~~~~~
302

    
303
``snep_design``
304

    
305
The design to considere.
306

    
307
``reads``
308

    
309
The data to considere.
310

    
311
Author(s)
312
~~~~~~~~~
313

    
314
Florent Chuffart
315

    
316
R: Stage replicates data
317

    
318
Stage replicates data
319
---------------------
320

    
321
Description
322
~~~~~~~~~~~
323

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

    
327
Usage
328
~~~~~
329

    
330
::
331

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

    
335
Arguments
336
~~~~~~~~~
337

    
338
``expe``
339

    
340
a list of vector corresponding to vector of replicates.
341

    
342
``roi``
343

    
344
the region that we are interested in.
345

    
346
``only_fetch``
347

    
348
filter or not inputs.
349

    
350
``get_genome``
351

    
352
Load or not corresponding genome.
353

    
354
``all_samples``
355

    
356
Global list of samples.
357

    
358
``config``
359

    
360
GLOBAL config variable.
361

    
362
Author(s)
363
~~~~~~~~~
364

    
365
Florent Chuffart
366

    
367
Examples
368
~~~~~~~~
369

    
370
::
371

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

    
400
R: reformat an "apply manipulated" list of regions
401

    
402
reformat an "apply manipulated" list of regions
403
-----------------------------------------------
404

    
405
Description
406
~~~~~~~~~~~
407

    
408
Utils to reformat an "apply manipulated" list of regions
409

    
410
Usage
411
~~~~~
412

    
413
::
414

    
415
    collapse_regions(regions)
416

    
417
Arguments
418
~~~~~~~~~
419

    
420
+---------------+----+
421
| ``regions``   |    |
422
+---------------+----+
423

    
424
Author(s)
425
~~~~~~~~~
426

    
427
Florent Chuffart
428

    
429
R: Compute Common Uninterrupted Regions (CUR)
430

    
431
Compute Common Uninterrupted Regions (CUR)
432
------------------------------------------
433

    
434
Description
435
~~~~~~~~~~~
436

    
437
CURs are regions that can be aligned between the genomes
438

    
439
Usage
440
~~~~~
441

    
442
::
443

    
444
    compute_inter_all_strain_curs(diff_allowed = 10, min_cur_width = 200, 
445
        config = NULL, plot = FALSE)
446

    
447
Arguments
448
~~~~~~~~~
449

    
450
``diff_allowed``
451

    
452
the maximum indel width allowe din a CUR
453

    
454
``min_cur_width``
455

    
456
The minimum width of a CUR
457

    
458
``config``
459

    
460
GLOBAL config variable
461

    
462
``plot``
463

    
464
Plot CURs or not
465

    
466
Author(s)
467
~~~~~~~~~
468

    
469
Florent Chuffart
470

    
471
R: Crop bound of regions according to region of interest bound
472

    
473
Crop bound of regions according to region of interest bound
474
-----------------------------------------------------------
475

    
476
Description
477
~~~~~~~~~~~
478

    
479
The fucntion is no more necessary since we remove "big\_roi" bug in
480
translate\_roi function.
481

    
482
Usage
483
~~~~~
484

    
485
::
486

    
487
    crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL)
488

    
489
Arguments
490
~~~~~~~~~
491

    
492
``tmp_fuzzy_nucs``
493

    
494
the regiuons to be croped.
495

    
496
``roi``
497

    
498
The region of interest.
499

    
500
``strain``
501

    
502
The strain to consider.
503

    
504
``config``
505

    
506
GLOBAL config variable
507

    
508
Author(s)
509
~~~~~~~~~
510

    
511
Florent Chuffart
512

    
513
R: Adding list to a dataframe.
514

    
515
Adding list to a dataframe.
516
---------------------------
517

    
518
Description
519
~~~~~~~~~~~
520

    
521
Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*. Return
522
the dataframe *df*.
523

    
524
Usage
525
~~~~~
526

    
527
::
528

    
529
    dfadd(df, l)
530

    
531
Arguments
532
~~~~~~~~~
533

    
534
``df``
535

    
536
A dataframe
537

    
538
``l``
539

    
540
A list
541

    
542
Value
543
~~~~~
544

    
545
Return the dataframe *df*.
546

    
547
Author(s)
548
~~~~~~~~~
549

    
550
Florent Chuffart
551

    
552
Examples
553
~~~~~~~~
554

    
555
::
556

    
557
    ## Here dataframe is NULL
558
    print(df)
559
    df = NULL
560

    
561
    # Initialize df
562
    df = dfadd(df, list(key1 = "value1", key2 = "value2"))
563
    print(df)
564

    
565
    # Adding elements to df
566
    df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
567
    print(df)
568

    
569
R: Extract wp nucs from nuc map.
570

    
571
Extract wp nucs from nuc map.
572
-----------------------------
573

    
574
Description
575
~~~~~~~~~~~
576

    
577
Function based on common wp nuc index and roi\_index.
578

    
579
Usage
580
~~~~~
581

    
582
::
583

    
584
    extract_wp(strain_maps, roi_index, strain, tmp_common_nucs)
585

    
586
Arguments
587
~~~~~~~~~
588

    
589
``strain_maps``
590

    
591
Nuc maps.
592

    
593
``roi_index``
594

    
595
The region of interest index.
596

    
597
``strain``
598

    
599
The strain to consider.
600

    
601
``tmp_common_nucs``
602

    
603
the list of wp nucs.
604

    
605
Author(s)
606
~~~~~~~~~
607

    
608
Florent Chuffart
609

    
610
R: Prefetch data
611

    
612
Prefetch data
613
-------------
614

    
615
Description
616
~~~~~~~~~~~
617

    
618
Fetch and filter inputs and outpouts per region of interest. Organize it
619
per replicates.
620

    
621
Usage
622
~~~~~
623

    
624
::
625

    
626
    fetch_mnase_replicates(strain, roi, all_samples, config = NULL, 
627
        only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE)
628

    
629
Arguments
630
~~~~~~~~~
631

    
632
``strain``
633

    
634
The strain we want mnase replicatesList of replicates. Each replicates
635
is a vector of sample ids.
636

    
637
``roi``
638

    
639
Region of interest.
640

    
641
``all_samples``
642

    
643
Global list of samples.
644

    
645
``config``
646

    
647
GLOBAL config variable
648

    
649
``only_fetch``
650

    
651
If TRUE, only fetch and not filtering. It is used tio load sample files
652
into memory before forking.
653

    
654
``get_genome``
655

    
656
If TRUE, load corresponding genome sequence.
657

    
658
``get_ouputs``
659

    
660
If TRUE, get also ouput corresponding TF output files.
661

    
662
Author(s)
663
~~~~~~~~~
664

    
665
Florent Chuffart
666

    
667
R: Filter TemplateFilter inputs
668

    
669
Filter TemplateFilter inputs
670
----------------------------
671

    
672
Description
673
~~~~~~~~~~~
674

    
675
This function filters TemplateFilter inputs according genome area
676
observed properties. It takes into account reads that are at the
677
frontier of this area and the strand of these reads.
678

    
679
Usage
680
~~~~~
681

    
682
::
683

    
684
    filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160, 
685
        only_f = FALSE, only_r = FALSE, filter_for_coverage = FALSE)
686

    
687
Arguments
688
~~~~~~~~~
689

    
690
``inputs``
691

    
692
TF inputs to be filtered.
693

    
694
``chr``
695

    
696
Chromosome observed, here chr is an integer.
697

    
698
``x_min``
699

    
700
Coordinate of the first bp observed.
701

    
702
``x_max``
703

    
704
Coordinate of the last bp observed.
705

    
706
``nuc_width``
707

    
708
Nucleosome width.
709

    
710
``only_f``
711

    
712
Filter only F reads.
713

    
714
``only_r``
715

    
716
Filter only R reads.
717

    
718
``filter_for_coverage``
719

    
720
Does it filter for plot coverage?
721

    
722
Value
723
~~~~~
724

    
725
Returns filtred inputs.
726

    
727
Author(s)
728
~~~~~~~~~
729

    
730
Florent Chuffart
731

    
732
R: Filter TemplateFilter outputs
733

    
734
Filter TemplateFilter outputs
735
-----------------------------
736

    
737
Description
738
~~~~~~~~~~~
739

    
740
This function filters TemplateFilter outputs according, not only genome
741
area observerved properties, but also correlation and overlap threshold.
742

    
743
Usage
744
~~~~~
745

    
746
::
747

    
748
    filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160, 
749
        ol_bp = 59, corr_thres = 0.5)
750

    
751
Arguments
752
~~~~~~~~~
753

    
754
``tf_outputs``
755

    
756
TemplateFilter outputs.
757

    
758
``chr``
759

    
760
Chromosome observed, here chr is an integer.
761

    
762
``x_min``
763

    
764
Coordinate of the first bp observed.
765

    
766
``x_max``
767

    
768
Coordinate of the last bp observed.
769

    
770
``nuc_width``
771

    
772
Nucleosome width.
773

    
774
``ol_bp``
775

    
776
Overlap Threshold.
777

    
778
``corr_thres``
779

    
780
Correlation threshold.
781

    
782
Value
783
~~~~~
784

    
785
Returns filtered TemplateFilter Outputs
786

    
787
Author(s)
788
~~~~~~~~~
789

    
790
Florent Chuffart
791

    
792
R: to flat aggregate\_intra\_strain\_nucs function output
793

    
794
to flat aggregate\_intra\_strain\_nucs function output
795
------------------------------------------------------
796

    
797
Description
798
~~~~~~~~~~~
799

    
800
This function builds a dataframe of all clusters obtain from
801
aggregate\_intra\_strain\_nucs function.
802

    
803
Usage
804
~~~~~
805

    
806
::
807

    
808
    flat_aggregated_intra_strain_nucs(partial_strain_maps, roi_index)
809

    
810
Arguments
811
~~~~~~~~~
812

    
813
``partial_strain_maps``
814

    
815
the output of aggregate\_intra\_strain\_nucs function
816

    
817
``roi_index``
818

    
819
the index of the roi involved
820

    
821
Value
822
~~~~~
823

    
824
Returns a dataframe of all clusters obtain from
825
aggregate\_intra\_strain\_nucs function.
826

    
827
Author(s)
828
~~~~~~~~~
829

    
830
Florent Chuffart
831

    
832
R: flat reads
833

    
834
flat reads
835
----------
836

    
837
Description
838
~~~~~~~~~~~
839

    
840
Extract reads coordinates from TempleteFilter input sequence
841

    
842
Usage
843
~~~~~
844

    
845
::
846

    
847
    flat_reads(reads, nuc_width)
848

    
849
Arguments
850
~~~~~~~~~
851

    
852
``reads``
853

    
854
TemplateFilter input reads
855

    
856
``nuc_width``
857

    
858
Width used to shift F and R reads.
859

    
860
Value
861
~~~~~
862

    
863
Returns a list of F reads, R reads and joint/shifted F and R reads.
864

    
865
Author(s)
866
~~~~~~~~~
867

    
868
Florent Chuffart
869

    
870
R: Retrieve Reads
871

    
872
Retrieve Reads
873
--------------
874

    
875
Description
876
~~~~~~~~~~~
877

    
878
Retrieve reads for a given marker, combi, form.
879

    
880
Usage
881
~~~~~
882

    
883
::
884

    
885
    get_all_reads(marker, combi, form = "wp", config = NULL)
886

    
887
Arguments
888
~~~~~~~~~
889

    
890
``marker``
891

    
892
The marker to considere.
893

    
894
``combi``
895

    
896
The starin combination to considere.
897

    
898
``form``
899

    
900
The nuc form to considere.
901

    
902
``config``
903

    
904
GLOBAL config variable
905

    
906
Author(s)
907
~~~~~~~~~
908

    
909
Florent Chuffart
910

    
911
R: get comp strand
912

    
913
get comp strand
914
---------------
915

    
916
Description
917
~~~~~~~~~~~
918

    
919
Compute the complementatry strand.
920

    
921
Usage
922
~~~~~
923

    
924
::
925

    
926
    get_comp_strand(strand)
927

    
928
Arguments
929
~~~~~~~~~
930

    
931
``strand``
932

    
933
The original strand.
934

    
935
Value
936
~~~~~
937

    
938
Returns the complementatry strand.
939

    
940
Author(s)
941
~~~~~~~~~
942

    
943
Florent Chuffart
944

    
945
R: Build the design for deseq
946

    
947
Build the design for deseq
948
--------------------------
949

    
950
Description
951
~~~~~~~~~~~
952

    
953
This function build the design according sample properties.
954

    
955
Usage
956
~~~~~
957

    
958
::
959

    
960
    get_design(marker, combi, all_samples)
961

    
962
Arguments
963
~~~~~~~~~
964

    
965
``marker``
966

    
967
The marker to considere.
968

    
969
``combi``
970

    
971
The starin combination to considere.
972

    
973
``all_samples``
974

    
975
Global list of samples.
976

    
977
Author(s)
978
~~~~~~~~~
979

    
980
Florent Chuffart
981

    
982
R: Compute the fuzzy nucs.
983

    
984
Compute the fuzzy nucs.
985
-----------------------
986

    
987
Description
988
~~~~~~~~~~~
989

    
990
This function aggregate non common wp nucs for each strain and substract
991
common wp nucs. It does not take care about the size of the resulting
992
fuzzy regions. It will be take into account in the count read part og
993
the pipeline.
994

    
995
Usage
996
~~~~~
997

    
998
::
999

    
1000
    get_fuzzy(combi, roi, roi_index, strain_maps, common_nuc_results, 
1001
        config = NULL)
1002

    
1003
Arguments
1004
~~~~~~~~~
1005

    
1006
``combi``
1007

    
1008
The strain combination to consider.
1009

    
1010
``roi``
1011

    
1012
The region of interest.
1013

    
1014
``roi_index``
1015

    
1016
The region of interest index.
1017

    
1018
``strain_maps``
1019

    
1020
Nuc maps.
1021

    
1022
``common_nuc_results``
1023

    
1024
Common wp nuc maps
1025

    
1026
``config``
1027

    
1028
GLOBAL config variable
1029

    
1030
Author(s)
1031
~~~~~~~~~
1032

    
1033
Florent Chuffart
1034

    
1035
R: Compute the list of SNEPs for a given set of marker, strain...
1036

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

    
1040
Description
1041
~~~~~~~~~~~
1042

    
1043
This function uses
1044

    
1045
Usage
1046
~~~~~
1047

    
1048
::
1049

    
1050
    get_sneps(marker, combi, form, all_samples, config = NULL)
1051

    
1052
Arguments
1053
~~~~~~~~~
1054

    
1055
``marker``
1056

    
1057
The marker involved.
1058

    
1059
``combi``
1060

    
1061
The strain combination involved.
1062

    
1063
``form``
1064

    
1065
the nuc form involved.
1066

    
1067
``all_samples``
1068

    
1069
Global list of samples.
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 = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy"
1088
    # foo = get_sneps(marker, combi, form)
1089
    # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
1090

    
1091
R: Likelihood ratio
1092

    
1093
Likelihood ratio
1094
----------------
1095

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

    
1099
Compute the likelihood log of two set of value from two models Vs. a
1100
unique model.
1101

    
1102
Usage
1103
~~~~~
1104

    
1105
::
1106

    
1107
    lod_score_vecs(x, y)
1108

    
1109
Arguments
1110
~~~~~~~~~
1111

    
1112
``x``
1113

    
1114
First vector.
1115

    
1116
``y``
1117

    
1118
Second vector.
1119

    
1120
Value
1121
~~~~~
1122

    
1123
Returns the likelihood ratio.
1124

    
1125
Author(s)
1126
~~~~~~~~~
1127

    
1128
Florent Chuffart
1129

    
1130
Examples
1131
~~~~~~~~
1132

    
1133
::
1134

    
1135
    # LOD score for 2 set of values
1136
    mean1=5; sd1=2; card2 = 250
1137
    mean2=6; sd2=3; card1 = 200
1138
    x1 = rnorm(card1, mean1, sd1)
1139
    x2 = rnorm(card2, mean2, sd2)  
1140
    min = floor(min(c(x1,x2)))
1141
    max = ceiling(max(c(x1,x2)))
1142
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1143
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1144
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1145
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1146
    lod_score_vecs(x1,x2)
1147

    
1148
R: nm
1149

    
1150
nm
1151
--
1152

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

    
1156
It provides a set of useful functions allowing to perform quantitative
1157
analysis of nucleosomal epigenome.
1158

    
1159
Details
1160
~~~~~~~
1161

    
1162
+---------------+---------------------------------------------------+
1163
| Package:      | nucleominer                                       |
1164
+---------------+---------------------------------------------------+
1165
| Maintainer:   | Florent Chuffart <florent.chuffart@ens-lyon.fr>   |
1166
+---------------+---------------------------------------------------+
1167
| Author:       | Florent Chuffart                                  |
1168
+---------------+---------------------------------------------------+
1169
| Version:      | 2.3.27                                            |
1170
+---------------+---------------------------------------------------+
1171
| License:      | CeCILL                                            |
1172
+---------------+---------------------------------------------------+
1173
| Title:        | nm                                                |
1174
+---------------+---------------------------------------------------+
1175
| Depends:      | seqinr, plotrix, DESeq, cachecache                |
1176
+---------------+---------------------------------------------------+
1177

    
1178
Author(s)
1179
~~~~~~~~~
1180

    
1181
Florent Chuffart
1182

    
1183
R: Performaing ANOVAs
1184

    
1185
Performaing ANOVAs
1186
------------------
1187

    
1188
Description
1189
~~~~~~~~~~~
1190

    
1191
Counts reads and Performs ANOVAS for each common nucleosomes involved.
1192

    
1193
Usage
1194
~~~~~
1195

    
1196
::
1197

    
1198
    perform_anovas(replicates, aligned_inter_strain_nucs, inputs_name = "Mnase_Seq", 
1199
        plot_anova_boxes = FALSE)
1200

    
1201
Arguments
1202
~~~~~~~~~
1203

    
1204
``replicates``
1205

    
1206
Set of replicates, each replicate is a list of samples (ideally 3). Each
1207
sample is a list like *sample = list(id=..., marker=..., strain=...,
1208
roi=..., inputs=..., outputs=...)* with *roi = list(name=..., begin=...,
1209
end=..., chr=..., genome=...)*. In the *perform\_anovas* contexte, we
1210
need 4 replicates (4 \* (3 samples)): 2 strains \* (1 marker + 1 input
1211
(Mnase\_Seq)).
1212

    
1213
``aligned_inter_strain_nucs``
1214

    
1215
List of common nucleosomes.
1216

    
1217
``inputs_name``
1218

    
1219
Name of the input.
1220

    
1221
``plot_anova_boxes``
1222

    
1223
Plot (or not) boxplot for each nuc.
1224

    
1225
Value
1226
~~~~~
1227

    
1228
Returns ANOVA results and comunted reads.
1229

    
1230
Author(s)
1231
~~~~~~~~~
1232

    
1233
Florent Chuffart
1234

    
1235
R: Plot the distribution of reads.
1236

    
1237
Plot the distribution of reads.
1238
-------------------------------
1239

    
1240
Description
1241
~~~~~~~~~~~
1242

    
1243
This fuxntion use the deseq nomalization feature to compare
1244
qualitatively the distribution.
1245

    
1246
Usage
1247
~~~~~
1248

    
1249
::
1250

    
1251
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1252

    
1253
Arguments
1254
~~~~~~~~~
1255

    
1256
``strain``
1257

    
1258
The strain to considere.
1259

    
1260
``marker``
1261

    
1262
The marker to considere.
1263

    
1264
``res``
1265

    
1266
Data
1267

    
1268
``all_samples``
1269

    
1270
Global list of samples.
1271

    
1272
``NEWPLOT``
1273

    
1274
If FALSE the curve will be add to the current plot.
1275

    
1276
Author(s)
1277
~~~~~~~~~
1278

    
1279
Florent Chuffart
1280

    
1281
R: Remove wp nucs from common nucs list.
1282

    
1283
Remove wp nucs from common nucs list.
1284
-------------------------------------
1285

    
1286
Description
1287
~~~~~~~~~~~
1288

    
1289
It is based on common wp nucs index on nucs and region.
1290

    
1291
Usage
1292
~~~~~
1293

    
1294
::
1295

    
1296
    remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, strain)
1297

    
1298
Arguments
1299
~~~~~~~~~
1300

    
1301
``strain_maps``
1302

    
1303
Nuc maps.
1304

    
1305
``roi_index``
1306

    
1307
The region of interest index.
1308

    
1309
``tmp_common_nucs``
1310

    
1311
the list of wp nucs.
1312

    
1313
``strain``
1314

    
1315
The strain to consider.
1316

    
1317
Author(s)
1318
~~~~~~~~~
1319

    
1320
Florent Chuffart
1321

    
1322
R: sign from strand
1323

    
1324
sign from strand
1325
----------------
1326

    
1327
Description
1328
~~~~~~~~~~~
1329

    
1330
Get the sign of strand
1331

    
1332
Usage
1333
~~~~~
1334

    
1335
::
1336

    
1337
    sign_from_strand(strands)
1338

    
1339
Arguments
1340
~~~~~~~~~
1341

    
1342
+---------------+----+
1343
| ``strands``   |    |
1344
+---------------+----+
1345

    
1346
Value
1347
~~~~~
1348

    
1349
If strand in forward then returns 1 else returns -1
1350

    
1351
Author(s)
1352
~~~~~~~~~
1353

    
1354
Florent Chuffart
1355

    
1356
R: Substract to a list of regions an other list of regions that...
1357

    
1358
Substract to a list of regions an other list of regions that intersect it.
1359
--------------------------------------------------------------------------
1360

    
1361
Description
1362
~~~~~~~~~~~
1363

    
1364
This fucntion embed a recursive part. It occurs when a substracted
1365
region split an original region on two.
1366

    
1367
Usage
1368
~~~~~
1369

    
1370
::
1371

    
1372
    substract_region(region1, region2)
1373

    
1374
Arguments
1375
~~~~~~~~~
1376

    
1377
``region1``
1378

    
1379
Original regions.
1380

    
1381
``region2``
1382

    
1383
Regions to substract.
1384

    
1385
Author(s)
1386
~~~~~~~~~
1387

    
1388
Florent Chuffart
1389

    
1390
R: Switch a pairlist
1391

    
1392
Switch a pairlist
1393
-----------------
1394

    
1395
Description
1396
~~~~~~~~~~~
1397

    
1398
Take a pairlist key:value and return the switched pairlist value:key.
1399

    
1400
Usage
1401
~~~~~
1402

    
1403
::
1404

    
1405
    switch_pairlist(l)
1406

    
1407
Arguments
1408
~~~~~~~~~
1409

    
1410
``l``
1411

    
1412
The pairlist to switch.
1413

    
1414
Value
1415
~~~~~
1416

    
1417
The switched pairlist.
1418

    
1419
Author(s)
1420
~~~~~~~~~
1421

    
1422
Florent Chuffart
1423

    
1424
Examples
1425
~~~~~~~~
1426

    
1427
::
1428

    
1429
    l = list(key1 = "value1", key2 = "value2")
1430
    print(switch_pairlist(l))
1431

    
1432
R: Translate a list of regions from a strain ref to another.
1433

    
1434
Translate a list of regions from a strain ref to another.
1435
---------------------------------------------------------
1436

    
1437
Description
1438
~~~~~~~~~~~
1439

    
1440
This function is an eloborated call to translate\_roi.
1441

    
1442
Usage
1443
~~~~~
1444

    
1445
::
1446

    
1447
    translate_regions(regions, combi, roi_index, config = NULL, roi)
1448

    
1449
Arguments
1450
~~~~~~~~~
1451

    
1452
``regions``
1453

    
1454
Regions to be translated.
1455

    
1456
``combi``
1457

    
1458
Combination of strains.
1459

    
1460
``roi_index``
1461

    
1462
The region of interest index.
1463

    
1464
``config``
1465

    
1466
GLOBAL config variable
1467

    
1468
``roi``
1469

    
1470
The region of interest.
1471

    
1472
Author(s)
1473
~~~~~~~~~
1474

    
1475
Florent Chuffart
1476

    
1477
R: Translate coords of a genome region.
1478

    
1479
Translate coords of a genome region.
1480
------------------------------------
1481

    
1482
Description
1483
~~~~~~~~~~~
1484

    
1485
This function is used in the examples, usualy you have to define your
1486
own translation function and overwrite this one using *unlockBinding*
1487
features. Please, refer to the example.
1488

    
1489
Usage
1490
~~~~~
1491

    
1492
::
1493

    
1494
    translate_roi(roi, strain2, config = NULL, big_roi = NULL)
1495

    
1496
Arguments
1497
~~~~~~~~~
1498

    
1499
``roi``
1500

    
1501
Original genome region of interest.
1502

    
1503
``strain2``
1504

    
1505
The strain in wich you want the genome region of interest.
1506

    
1507
``config``
1508

    
1509
GLOBAL config variable
1510

    
1511
``big_roi``
1512

    
1513
A largest region than roi use to filter c2c if it is needed.
1514

    
1515
Author(s)
1516
~~~~~~~~~
1517

    
1518
Florent Chuffart
1519

    
1520
Examples
1521
~~~~~~~~
1522

    
1523
::
1524

    
1525
    # Define new translate_roi function...
1526
    translate_roi = function(roi, strain2, config) {
1527
        strain1 = roi$strain_ref
1528
        if (strain1 == strain2) {
1529
            return(roi)
1530
        } else {
1531
          stop("Here is my new translate_roi function...")      
1532
        }   
1533
    }
1534
    # Binding it by uncomment follwing lines.
1535
    # unlockBinding("translate_roi", as.environment("package:nm"))
1536
    # unlockBinding("translate_roi", getNamespace("nm"))
1537
    # assign("translate_roi", translate_roi, "package:nm")
1538
    # assign("translate_roi", translate_roi, getNamespace("nm"))
1539
    # lockBinding("translate_roi", getNamespace("nm"))
1540
    # lockBinding("translate_roi", as.environment("package:nm"))    
1541

    
1542
R: Aggregate regions that intersect themnselves.
1543

    
1544
Aggregate regions that intersect themnselves.
1545
---------------------------------------------
1546

    
1547
Description
1548
~~~~~~~~~~~
1549

    
1550
This function is based on sort of lower bounds to detect regions that
1551
intersect. We compare lower bound and upper bound of the porevious item.
1552
This function embed a while loop and break break regions list become
1553
stable.
1554

    
1555
Usage
1556
~~~~~
1557

    
1558
::
1559

    
1560
    union_regions(regions)
1561

    
1562
Arguments
1563
~~~~~~~~~
1564

    
1565
``regions``
1566

    
1567
The Regions to be aggregated
1568

    
1569
Author(s)
1570
~~~~~~~~~
1571

    
1572
Florent Chuffart
1573

    
1574
R: Watching analysis of samples
1575

    
1576
Watching analysis of samples
1577
----------------------------
1578

    
1579
Description
1580
~~~~~~~~~~~
1581

    
1582
This function allows to view analysis for a particuler region of the
1583
genome.
1584

    
1585
Usage
1586
~~~~~
1587

    
1588
::
1589

    
1590
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1591
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1592
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1593
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1594
        change_col = TRUE, plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, 
1595
        plot_common_nucs = TRUE, plot_anovas = FALSE, plot_anova_boxes = FALSE, 
1596
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, aggregated_intra_strain_nucs = NULL, 
1597
        aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
1598

    
1599
Arguments
1600
~~~~~~~~~
1601

    
1602
``replicates``
1603

    
1604
replicates under the form...
1605

    
1606
``read_length``
1607

    
1608
length of the reads
1609

    
1610
``plot_ref_genome``
1611

    
1612
Plot (or not) reference genome.
1613

    
1614
``plot_arrow_raw_reads``
1615

    
1616
Plot (or not) arrows for raw reads.
1617

    
1618
``plot_arrow_nuc_reads``
1619

    
1620
Plot (or not) arrows for reads aasiocied to a nucleosome.
1621

    
1622
``plot_squared_reads``
1623

    
1624
Plot (or not) reads in the square fashion.
1625

    
1626
``plot_coverage``
1627

    
1628
Plot (or not) reads in the covergae fashion. fashion.
1629

    
1630
``plot_gaussian_reads``
1631

    
1632
Plot (or not) gaussian model of a F anf R reads.
1633

    
1634
``plot_gaussian_unified_reads``
1635

    
1636
Plot (or not) gaussian model of a nuc.
1637

    
1638
``plot_ellipse_nucs``
1639

    
1640
Plot (or not) ellipse for a nuc.
1641

    
1642
``change_col``
1643

    
1644
Change the color of each nucleosome.
1645

    
1646
``plot_wp_nucs``
1647

    
1648
Plot (or not) cluster of nucs
1649

    
1650
``plot_wp_nuc_model``
1651

    
1652
Plot (or not) gaussian model for a cluster of nucs
1653

    
1654
``plot_common_nucs``
1655

    
1656
Plot (or not) aligned reads.
1657

    
1658
``plot_anovas``
1659

    
1660
Plot (or not) scatter for each nuc.
1661

    
1662
``plot_anova_boxes``
1663

    
1664
Plot (or not) boxplot for each nuc.
1665

    
1666
``plot_wp_nucs_4_nonmnase``
1667

    
1668
Plot (or not) clusters for non inputs samples.
1669

    
1670
``plot_chain``
1671

    
1672
Plot (or not) clusterised nuceosomes between mnase samples.
1673

    
1674
``aggregated_intra_strain_nucs``
1675

    
1676
list of aggregated intra strain nucs. If NULL, it will be computed.
1677

    
1678
``aligned_inter_strain_nucs``
1679

    
1680
list of aligned inter strain nucs. If NULL, it will be computed.
1681

    
1682
``height``
1683

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

    
1687
``config``
1688

    
1689
GLOBAL config variable
1690

    
1691
Author(s)
1692
~~~~~~~~~
1693

    
1694
Florent Chuffart