Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ a0b91fee

Historique | Voir | Annoter | Télécharger (26,85 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: Compute Common Uninterrupted Regions (CUR)
401

    
402
Compute Common Uninterrupted Regions (CUR)
403
------------------------------------------
404

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

    
408
CURs are regions that can be aligned between the genomes
409

    
410
Usage
411
~~~~~
412

    
413
::
414

    
415
    compute_inter_all_strain_curs(diff_allowed = 10, min_cur_width = 200, 
416
        config = NULL, plot = FALSE)
417

    
418
Arguments
419
~~~~~~~~~
420

    
421
``diff_allowed``
422

    
423
the maximum indel width allowe din a CUR
424

    
425
``min_cur_width``
426

    
427
The minimum width of a CUR
428

    
429
``config``
430

    
431
GLOBAL config variable
432

    
433
``plot``
434

    
435
Plot CURs or not
436

    
437
Author(s)
438
~~~~~~~~~
439

    
440
Florent Chuffart
441

    
442
R: Crop bound of regions according to region of interest bound
443

    
444
Crop bound of regions according to region of interest bound
445
-----------------------------------------------------------
446

    
447
Description
448
~~~~~~~~~~~
449

    
450
The fucntion is no more necessary since we remove "big\_roi" bug in
451
translate\_roi function.
452

    
453
Usage
454
~~~~~
455

    
456
::
457

    
458
    crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL)
459

    
460
Arguments
461
~~~~~~~~~
462

    
463
``tmp_fuzzy_nucs``
464

    
465
the regiuons to be croped.
466

    
467
``roi``
468

    
469
The region of interest.
470

    
471
``strain``
472

    
473
The strain to consider.
474

    
475
``config``
476

    
477
GLOBAL config variable
478

    
479
Author(s)
480
~~~~~~~~~
481

    
482
Florent Chuffart
483

    
484
R: Adding list to a dataframe.
485

    
486
Adding list to a dataframe.
487
---------------------------
488

    
489
Description
490
~~~~~~~~~~~
491

    
492
Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*. Return
493
the dataframe *df*.
494

    
495
Usage
496
~~~~~
497

    
498
::
499

    
500
    dfadd(df, l)
501

    
502
Arguments
503
~~~~~~~~~
504

    
505
``df``
506

    
507
A dataframe
508

    
509
``l``
510

    
511
A list
512

    
513
Value
514
~~~~~
515

    
516
Return the dataframe *df*.
517

    
518
Author(s)
519
~~~~~~~~~
520

    
521
Florent Chuffart
522

    
523
Examples
524
~~~~~~~~
525

    
526
::
527

    
528
    ## Here dataframe is NULL
529
    print(df)
530
    df = NULL
531

    
532
    # Initialize df
533
    df = dfadd(df, list(key1 = "value1", key2 = "value2"))
534
    print(df)
535

    
536
    # Adding elements to df
537
    df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
538
    print(df)
539

    
540
R: Extract wp nucs from nuc map.
541

    
542
Extract wp nucs from nuc map.
543
-----------------------------
544

    
545
Description
546
~~~~~~~~~~~
547

    
548
Function based on common wp nuc index and roi\_index.
549

    
550
Usage
551
~~~~~
552

    
553
::
554

    
555
    extract_wp(strain_maps, roi_index, strain, tmp_common_nucs)
556

    
557
Arguments
558
~~~~~~~~~
559

    
560
``strain_maps``
561

    
562
Nuc maps.
563

    
564
``roi_index``
565

    
566
The region of interest index.
567

    
568
``strain``
569

    
570
The strain to consider.
571

    
572
``tmp_common_nucs``
573

    
574
the list of wp nucs.
575

    
576
Author(s)
577
~~~~~~~~~
578

    
579
Florent Chuffart
580

    
581
R: Prefetch data
582

    
583
Prefetch data
584
-------------
585

    
586
Description
587
~~~~~~~~~~~
588

    
589
Fetch and filter inputs and outpouts per region of interest. Organize it
590
per replicates.
591

    
592
Usage
593
~~~~~
594

    
595
::
596

    
597
    fetch_mnase_replicates(strain, roi, all_samples, config = NULL, 
598
        only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE)
599

    
600
Arguments
601
~~~~~~~~~
602

    
603
``strain``
604

    
605
The strain we want mnase replicatesList of replicates. Each replicates
606
is a vector of sample ids.
607

    
608
``roi``
609

    
610
Region of interest.
611

    
612
``all_samples``
613

    
614
Global list of samples.
615

    
616
``config``
617

    
618
GLOBAL config variable
619

    
620
``only_fetch``
621

    
622
If TRUE, only fetch and not filtering. It is used tio load sample files
623
into memory before forking.
624

    
625
``get_genome``
626

    
627
If TRUE, load corresponding genome sequence.
628

    
629
``get_ouputs``
630

    
631
If TRUE, get also ouput corresponding TF output files.
632

    
633
Author(s)
634
~~~~~~~~~
635

    
636
Florent Chuffart
637

    
638
R: Filter TemplateFilter inputs
639

    
640
Filter TemplateFilter inputs
641
----------------------------
642

    
643
Description
644
~~~~~~~~~~~
645

    
646
This function filters TemplateFilter inputs according genome area
647
observed properties. It takes into account reads that are at the
648
frontier of this area and the strand of these reads.
649

    
650
Usage
651
~~~~~
652

    
653
::
654

    
655
    filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160, 
656
        only_f = FALSE, only_r = FALSE)
657

    
658
Arguments
659
~~~~~~~~~
660

    
661
``inputs``
662

    
663
TF inputs to be filtered.
664

    
665
``chr``
666

    
667
Chromosome observed, here chr is an integer.
668

    
669
``x_min``
670

    
671
Coordinate of the first bp observed.
672

    
673
``x_max``
674

    
675
Coordinate of the last bp observed.
676

    
677
``nuc_width``
678

    
679
Nucleosome width.
680

    
681
``only_f``
682

    
683
Filter only F reads.
684

    
685
``only_r``
686

    
687
Filter only R reads.
688

    
689
Value
690
~~~~~
691

    
692
Returns filtred inputs.
693

    
694
Author(s)
695
~~~~~~~~~
696

    
697
Florent Chuffart
698

    
699
R: Filter TemplateFilter outputs
700

    
701
Filter TemplateFilter outputs
702
-----------------------------
703

    
704
Description
705
~~~~~~~~~~~
706

    
707
This function filters TemplateFilter outputs according, not only genome
708
area observerved properties, but also correlation and overlap threshold.
709

    
710
Usage
711
~~~~~
712

    
713
::
714

    
715
    filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160, 
716
        ol_bp = 59, corr_thres = 0.5)
717

    
718
Arguments
719
~~~~~~~~~
720

    
721
``tf_outputs``
722

    
723
TemplateFilter outputs.
724

    
725
``chr``
726

    
727
Chromosome observed, here chr is an integer.
728

    
729
``x_min``
730

    
731
Coordinate of the first bp observed.
732

    
733
``x_max``
734

    
735
Coordinate of the last bp observed.
736

    
737
``nuc_width``
738

    
739
Nucleosome width.
740

    
741
``ol_bp``
742

    
743
Overlap Threshold.
744

    
745
``corr_thres``
746

    
747
Correlation threshold.
748

    
749
Value
750
~~~~~
751

    
752
Returns filtered TemplateFilter Outputs
753

    
754
Author(s)
755
~~~~~~~~~
756

    
757
Florent Chuffart
758

    
759
R: flat reads
760

    
761
flat reads
762
----------
763

    
764
Description
765
~~~~~~~~~~~
766

    
767
Extract reads coordinates from TempleteFilter input sequence
768

    
769
Usage
770
~~~~~
771

    
772
::
773

    
774
    flat_reads(reads, nuc_width)
775

    
776
Arguments
777
~~~~~~~~~
778

    
779
``reads``
780

    
781
TemplateFilter input reads
782

    
783
``nuc_width``
784

    
785
Width used to shift F and R reads.
786

    
787
Value
788
~~~~~
789

    
790
Returns a list of F reads, R reads and joint/shifted F and R reads.
791

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

    
795
Florent Chuffart
796

    
797
R: Retrieve Reads
798

    
799
Retrieve Reads
800
--------------
801

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

    
805
Retrieve reads for a given marker, combi, form.
806

    
807
Usage
808
~~~~~
809

    
810
::
811

    
812
    get_all_reads(marker, combi, form = "wp")
813

    
814
Arguments
815
~~~~~~~~~
816

    
817
``marker``
818

    
819
The marker to considere.
820

    
821
``combi``
822

    
823
The starin combination to considere.
824

    
825
``form``
826

    
827
The nuc form to considere.
828

    
829
Author(s)
830
~~~~~~~~~
831

    
832
Florent Chuffart
833

    
834
R: get comp strand
835

    
836
get comp strand
837
---------------
838

    
839
Description
840
~~~~~~~~~~~
841

    
842
Compute the complementatry strand.
843

    
844
Usage
845
~~~~~
846

    
847
::
848

    
849
    get_comp_strand(strand)
850

    
851
Arguments
852
~~~~~~~~~
853

    
854
``strand``
855

    
856
The original strand.
857

    
858
Value
859
~~~~~
860

    
861
Returns the complementatry strand.
862

    
863
Author(s)
864
~~~~~~~~~
865

    
866
Florent Chuffart
867

    
868
R: Build the design for deseq
869

    
870
Build the design for deseq
871
--------------------------
872

    
873
Description
874
~~~~~~~~~~~
875

    
876
This function build the design according sample properties.
877

    
878
Usage
879
~~~~~
880

    
881
::
882

    
883
    get_design(marker, combi, all_samples)
884

    
885
Arguments
886
~~~~~~~~~
887

    
888
``marker``
889

    
890
The marker to considere.
891

    
892
``combi``
893

    
894
The starin combination to considere.
895

    
896
``all_samples``
897

    
898
Global list of samples.
899

    
900
Author(s)
901
~~~~~~~~~
902

    
903
Florent Chuffart
904

    
905
R: Compute the fuzzy nucs.
906

    
907
Compute the fuzzy nucs.
908
-----------------------
909

    
910
Description
911
~~~~~~~~~~~
912

    
913
This function aggregate non common wp nucs for each strain and substract
914
common wp nucs. It does not take care about the size of the resulting
915
fuzzy regions. It will be take into account in the count read part og
916
the pipeline.
917

    
918
Usage
919
~~~~~
920

    
921
::
922

    
923
    get_fuzzy(combi, roi, roi_index, strain_maps, common_nuc_results, 
924
        config = NULL)
925

    
926
Arguments
927
~~~~~~~~~
928

    
929
``combi``
930

    
931
The strain combination to consider.
932

    
933
``roi``
934

    
935
The region of interest.
936

    
937
``roi_index``
938

    
939
The region of interest index.
940

    
941
``strain_maps``
942

    
943
Nuc maps.
944

    
945
``common_nuc_results``
946

    
947
Common wp nuc maps
948

    
949
``config``
950

    
951
GLOBAL config variable
952

    
953
Author(s)
954
~~~~~~~~~
955

    
956
Florent Chuffart
957

    
958
R: Compute the list of SNEPs for a given set of marker, strain...
959

    
960
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
961
-------------------------------------------------------------------------------------
962

    
963
Description
964
~~~~~~~~~~~
965

    
966
This function uses
967

    
968
Usage
969
~~~~~
970

    
971
::
972

    
973
    get_sneps(marker, combi, form, all_samples)
974

    
975
Arguments
976
~~~~~~~~~
977

    
978
``marker``
979

    
980
The marker involved.
981

    
982
``combi``
983

    
984
The strain combination involved.
985

    
986
``form``
987

    
988
the nuc form involved.
989

    
990
``all_samples``
991

    
992
Global list of samples.
993

    
994
Author(s)
995
~~~~~~~~~
996

    
997
Florent Chuffart
998

    
999
Examples
1000
~~~~~~~~
1001

    
1002
::
1003

    
1004
    marker = "H3K4me1"
1005
    combi = c("BY", "YJM") 
1006
    form = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy"
1007
    # foo = get_sneps(marker, combi, form)
1008
    # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
1009

    
1010
R: Likelihood ratio
1011

    
1012
Likelihood ratio
1013
----------------
1014

    
1015
Description
1016
~~~~~~~~~~~
1017

    
1018
Compute the likelihood log of two set of value from two models Vs. a
1019
unique model.
1020

    
1021
Usage
1022
~~~~~
1023

    
1024
::
1025

    
1026
    lod_score_vecs(x, y)
1027

    
1028
Arguments
1029
~~~~~~~~~
1030

    
1031
``x``
1032

    
1033
First vector.
1034

    
1035
``y``
1036

    
1037
Second vector.
1038

    
1039
Value
1040
~~~~~
1041

    
1042
Returns the likelihood ratio.
1043

    
1044
Author(s)
1045
~~~~~~~~~
1046

    
1047
Florent Chuffart
1048

    
1049
Examples
1050
~~~~~~~~
1051

    
1052
::
1053

    
1054
    # LOD score for 2 set of values
1055
    mean1=5; sd1=2; card2 = 250
1056
    mean2=6; sd2=3; card1 = 200
1057
    x1 = rnorm(card1, mean1, sd1)
1058
    x2 = rnorm(card2, mean2, sd2)  
1059
    min = floor(min(c(x1,x2)))
1060
    max = ceiling(max(c(x1,x2)))
1061
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1062
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1063
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1064
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1065
    lod_score_vecs(x1,x2)
1066

    
1067
R: nm
1068

    
1069
nm
1070
--
1071

    
1072
Description
1073
~~~~~~~~~~~
1074

    
1075
It provides a set of useful functions allowing to perform quantitative
1076
analysis of nucleosomal epigenome.
1077

    
1078
Details
1079
~~~~~~~
1080

    
1081
+---------------+---------------------------------------------------+
1082
| Package:      | nucleominer                                       |
1083
+---------------+---------------------------------------------------+
1084
| Maintainer:   | Florent Chuffart <florent.chuffart@ens-lyon.fr>   |
1085
+---------------+---------------------------------------------------+
1086
| Author:       | Florent Chuffart                                  |
1087
+---------------+---------------------------------------------------+
1088
| Version:      | 2.3.14                                            |
1089
+---------------+---------------------------------------------------+
1090
| License:      | CeCILL                                            |
1091
+---------------+---------------------------------------------------+
1092
| Title:        | nm                                                |
1093
+---------------+---------------------------------------------------+
1094
| Depends:      | seqinr, plotrix, DESeq, cachecache                |
1095
+---------------+---------------------------------------------------+
1096

    
1097
Author(s)
1098
~~~~~~~~~
1099

    
1100
Florent Chuffart
1101

    
1102
R: Performaing ANOVAs
1103

    
1104
Performaing ANOVAs
1105
------------------
1106

    
1107
Description
1108
~~~~~~~~~~~
1109

    
1110
Counts reads and Performs ANOVAS for each common nucleosomes involved.
1111

    
1112
Usage
1113
~~~~~
1114

    
1115
::
1116

    
1117
    perform_anovas(replicates, aligned_inter_strain_nucs, inputs_name = "Mnase_Seq", 
1118
        plot_anova_boxes = FALSE)
1119

    
1120
Arguments
1121
~~~~~~~~~
1122

    
1123
``replicates``
1124

    
1125
Set of replicates, each replicate is a list of samples (ideally 3). Each
1126
sample is a list like *sample = list(id=..., marker=..., strain=...,
1127
roi=..., inputs=..., outputs=...)* with *roi = list(name=..., begin=...,
1128
end=..., chr=..., genome=...)*. In the *perform\_anovas* contexte, we
1129
need 4 replicates (4 \* (3 samples)): 2 strains \* (1 marker + 1 input
1130
(Mnase\_Seq)).
1131

    
1132
``aligned_inter_strain_nucs``
1133

    
1134
List of common nucleosomes.
1135

    
1136
``inputs_name``
1137

    
1138
Name of the input.
1139

    
1140
``plot_anova_boxes``
1141

    
1142
Plot (or not) boxplot for each nuc.
1143

    
1144
Value
1145
~~~~~
1146

    
1147
Returns ANOVA results and comunted reads.
1148

    
1149
Author(s)
1150
~~~~~~~~~
1151

    
1152
Florent Chuffart
1153

    
1154
R: Plot the distribution of reads.
1155

    
1156
Plot the distribution of reads.
1157
-------------------------------
1158

    
1159
Description
1160
~~~~~~~~~~~
1161

    
1162
This fuxntion use the deseq nomalization feature to compare
1163
qualitatively the distribution.
1164

    
1165
Usage
1166
~~~~~
1167

    
1168
::
1169

    
1170
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1171

    
1172
Arguments
1173
~~~~~~~~~
1174

    
1175
``strain``
1176

    
1177
The strain to considere.
1178

    
1179
``marker``
1180

    
1181
The marker to considere.
1182

    
1183
``res``
1184

    
1185
Data
1186

    
1187
``all_samples``
1188

    
1189
Global list of samples.
1190

    
1191
``NEWPLOT``
1192

    
1193
If FALSE the curve will be add to the current plot.
1194

    
1195
Author(s)
1196
~~~~~~~~~
1197

    
1198
Florent Chuffart
1199

    
1200
R: Remove wp nucs from common nucs list.
1201

    
1202
Remove wp nucs from common nucs list.
1203
-------------------------------------
1204

    
1205
Description
1206
~~~~~~~~~~~
1207

    
1208
It is based on common wp nucs index on nucs and region.
1209

    
1210
Usage
1211
~~~~~
1212

    
1213
::
1214

    
1215
    remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, strain)
1216

    
1217
Arguments
1218
~~~~~~~~~
1219

    
1220
``strain_maps``
1221

    
1222
Nuc maps.
1223

    
1224
``roi_index``
1225

    
1226
The region of interest index.
1227

    
1228
``tmp_common_nucs``
1229

    
1230
the list of wp nucs.
1231

    
1232
``strain``
1233

    
1234
The strain to consider.
1235

    
1236
Author(s)
1237
~~~~~~~~~
1238

    
1239
Florent Chuffart
1240

    
1241
R: sign from strand
1242

    
1243
sign from strand
1244
----------------
1245

    
1246
Description
1247
~~~~~~~~~~~
1248

    
1249
Get the sign of strand
1250

    
1251
Usage
1252
~~~~~
1253

    
1254
::
1255

    
1256
    sign_from_strand(strands)
1257

    
1258
Arguments
1259
~~~~~~~~~
1260

    
1261
+---------------+----+
1262
| ``strands``   |    |
1263
+---------------+----+
1264

    
1265
Value
1266
~~~~~
1267

    
1268
If strand in forward then returns 1 else returns -1
1269

    
1270
Author(s)
1271
~~~~~~~~~
1272

    
1273
Florent Chuffart
1274

    
1275
R: Substract to a list of regions an other list of regions that...
1276

    
1277
Substract to a list of regions an other list of regions that intersect it.
1278
--------------------------------------------------------------------------
1279

    
1280
Description
1281
~~~~~~~~~~~
1282

    
1283
This fucntion embed a recursive part. It occurs when a substracted
1284
region split an original region on two.
1285

    
1286
Usage
1287
~~~~~
1288

    
1289
::
1290

    
1291
    substract_region(region1, region2)
1292

    
1293
Arguments
1294
~~~~~~~~~
1295

    
1296
``region1``
1297

    
1298
Original regions.
1299

    
1300
``region2``
1301

    
1302
Regions to substract.
1303

    
1304
Author(s)
1305
~~~~~~~~~
1306

    
1307
Florent Chuffart
1308

    
1309
R: Switch a pairlist
1310

    
1311
Switch a pairlist
1312
-----------------
1313

    
1314
Description
1315
~~~~~~~~~~~
1316

    
1317
Take a pairlist key:value and return the switched pairlist value:key.
1318

    
1319
Usage
1320
~~~~~
1321

    
1322
::
1323

    
1324
    switch_pairlist(l)
1325

    
1326
Arguments
1327
~~~~~~~~~
1328

    
1329
``l``
1330

    
1331
The pairlist to switch.
1332

    
1333
Value
1334
~~~~~
1335

    
1336
The switched pairlist.
1337

    
1338
Author(s)
1339
~~~~~~~~~
1340

    
1341
Florent Chuffart
1342

    
1343
Examples
1344
~~~~~~~~
1345

    
1346
::
1347

    
1348
    l = list(key1 = "value1", key2 = "value2")
1349
    print(switch_pairlist(l))
1350

    
1351
R: Translate a list of regions from a strain ref to another.
1352

    
1353
Translate a list of regions from a strain ref to another.
1354
---------------------------------------------------------
1355

    
1356
Description
1357
~~~~~~~~~~~
1358

    
1359
This function is an eloborated call to translate\_roi.
1360

    
1361
Usage
1362
~~~~~
1363

    
1364
::
1365

    
1366
    translate_regions(regions, combi, roi_index, config = NULL, roi)
1367

    
1368
Arguments
1369
~~~~~~~~~
1370

    
1371
``regions``
1372

    
1373
Regions to be translated.
1374

    
1375
``combi``
1376

    
1377
Combination of strains.
1378

    
1379
``roi_index``
1380

    
1381
The region of interest index.
1382

    
1383
``config``
1384

    
1385
GLOBAL config variable
1386

    
1387
``roi``
1388

    
1389
The region of interest.
1390

    
1391
Author(s)
1392
~~~~~~~~~
1393

    
1394
Florent Chuffart
1395

    
1396
R: Translate coords of a genome region.
1397

    
1398
Translate coords of a genome region.
1399
------------------------------------
1400

    
1401
Description
1402
~~~~~~~~~~~
1403

    
1404
This function is used in the examples, usualy you have to define your
1405
own translation function and overwrite this one using *unlockBinding*
1406
features. Please, refer to the example.
1407

    
1408
Usage
1409
~~~~~
1410

    
1411
::
1412

    
1413
    translate_roi(roi, strain2, config = NULL, big_roi = NULL)
1414

    
1415
Arguments
1416
~~~~~~~~~
1417

    
1418
``roi``
1419

    
1420
Original genome region of interest.
1421

    
1422
``strain2``
1423

    
1424
The strain in wich you want the genome region of interest.
1425

    
1426
``config``
1427

    
1428
GLOBAL config variable
1429

    
1430
``big_roi``
1431

    
1432
A largest region than roi use to filter c2c if it is needed.
1433

    
1434
Author(s)
1435
~~~~~~~~~
1436

    
1437
Florent Chuffart
1438

    
1439
Examples
1440
~~~~~~~~
1441

    
1442
::
1443

    
1444
    # Define new translate_roi function...
1445
    translate_roi = function(roi, strain2, config) {
1446
        strain1 = roi$strain_ref
1447
        if (strain1 == strain2) {
1448
            return(roi)
1449
        } else {
1450
          stop("Here is my new translate_roi function...")      
1451
        }   
1452
    }
1453
    # Binding it by uncomment follwing lines.
1454
    # unlockBinding("translate_roi", as.environment("package:nm"))
1455
    # unlockBinding("translate_roi", getNamespace("nm"))
1456
    # assign("translate_roi", translate_roi, "package:nm")
1457
    # assign("translate_roi", translate_roi, getNamespace("nm"))
1458
    # lockBinding("translate_roi", getNamespace("nm"))
1459
    # lockBinding("translate_roi", as.environment("package:nm"))    
1460

    
1461
R: Aggregate regions that intersect themnselves.
1462

    
1463
Aggregate regions that intersect themnselves.
1464
---------------------------------------------
1465

    
1466
Description
1467
~~~~~~~~~~~
1468

    
1469
This function is based on sort of lower bounds to detect regions that
1470
intersect. We compare lower bound and upper bound of the porevious item.
1471
This function embed a while loop and break break regions list become
1472
stable.
1473

    
1474
Usage
1475
~~~~~
1476

    
1477
::
1478

    
1479
    union_regions(regions)
1480

    
1481
Arguments
1482
~~~~~~~~~
1483

    
1484
``regions``
1485

    
1486
The Regions to be aggregated
1487

    
1488
Author(s)
1489
~~~~~~~~~
1490

    
1491
Florent Chuffart
1492

    
1493
R: Watching analysis of samples
1494

    
1495
Watching analysis of samples
1496
----------------------------
1497

    
1498
Description
1499
~~~~~~~~~~~
1500

    
1501
This function allows to view analysis for a particuler region of the
1502
genome.
1503

    
1504
Usage
1505
~~~~~
1506

    
1507
::
1508

    
1509
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1510
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1511
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1512
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1513
        plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, plot_common_nucs = TRUE, 
1514
        plot_anovas = FALSE, plot_anova_boxes = FALSE, plot_wp_nucs_4_nonmnase = FALSE, 
1515
        aggregated_intra_strain_nucs = NULL, aligned_inter_strain_nucs = NULL, 
1516
        height = 10, config = NULL)
1517

    
1518
Arguments
1519
~~~~~~~~~
1520

    
1521
``replicates``
1522

    
1523
replicates under the form...
1524

    
1525
``read_length``
1526

    
1527
length of the reads
1528

    
1529
``plot_ref_genome``
1530

    
1531
Plot (or not) reference genome.
1532

    
1533
``plot_arrow_raw_reads``
1534

    
1535
Plot (or not) arrows for raw reads.
1536

    
1537
``plot_arrow_nuc_reads``
1538

    
1539
Plot (or not) arrows for reads aasiocied to a nucleosome.
1540

    
1541
``plot_squared_reads``
1542

    
1543
Plot (or not) reads in the square fashion.
1544

    
1545
``plot_coverage``
1546

    
1547
Plot (or not) reads in the covergae fashion. fashion.
1548

    
1549
``plot_gaussian_reads``
1550

    
1551
Plot (or not) gaussian model of a F anf R reads.
1552

    
1553
``plot_gaussian_unified_reads``
1554

    
1555
Plot (or not) gaussian model of a nuc.
1556

    
1557
``plot_ellipse_nucs``
1558

    
1559
Plot (or not) ellipse for a nuc.
1560

    
1561
``plot_wp_nucs``
1562

    
1563
Plot (or not) cluster of nucs
1564

    
1565
``plot_wp_nuc_model``
1566

    
1567
Plot (or not) gaussian model for a cluster of nucs
1568

    
1569
``plot_common_nucs``
1570

    
1571
Plot (or not) aligned reads.
1572

    
1573
``plot_anovas``
1574

    
1575
Plot (or not) scatter for each nuc.
1576

    
1577
``plot_anova_boxes``
1578

    
1579
Plot (or not) boxplot for each nuc.
1580

    
1581
``plot_wp_nucs_4_nonmnase``
1582

    
1583
Plot (or not) clusters for non inputs samples.
1584

    
1585
``aggregated_intra_strain_nucs``
1586

    
1587
list of aggregated intra strain nucs. If NULL, it will be computed.
1588

    
1589
``aligned_inter_strain_nucs``
1590

    
1591
list of aligned inter strain nucs. If NULL, it will be computed.
1592

    
1593
``height``
1594

    
1595
Number of reads in per million read for each sample, graphical parametre
1596
for the y axis.
1597

    
1598
``config``
1599

    
1600
GLOBAL config variable
1601

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

    
1605
Florent Chuffart