Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ 729c934e

Historique | Voir | Annoter | Télécharger (27,53 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: flat reads
793

    
794
flat reads
795
----------
796

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

    
800
Extract reads coordinates from TempleteFilter input sequence
801

    
802
Usage
803
~~~~~
804

    
805
::
806

    
807
    flat_reads(reads, nuc_width)
808

    
809
Arguments
810
~~~~~~~~~
811

    
812
``reads``
813

    
814
TemplateFilter input reads
815

    
816
``nuc_width``
817

    
818
Width used to shift F and R reads.
819

    
820
Value
821
~~~~~
822

    
823
Returns a list of F reads, R reads and joint/shifted F and R reads.
824

    
825
Author(s)
826
~~~~~~~~~
827

    
828
Florent Chuffart
829

    
830
R: Retrieve Reads
831

    
832
Retrieve Reads
833
--------------
834

    
835
Description
836
~~~~~~~~~~~
837

    
838
Retrieve reads for a given marker, combi, form.
839

    
840
Usage
841
~~~~~
842

    
843
::
844

    
845
    get_all_reads(marker, combi, form = "wp", config = NULL)
846

    
847
Arguments
848
~~~~~~~~~
849

    
850
``marker``
851

    
852
The marker to considere.
853

    
854
``combi``
855

    
856
The starin combination to considere.
857

    
858
``form``
859

    
860
The nuc form to considere.
861

    
862
``config``
863

    
864
GLOBAL config variable
865

    
866
Author(s)
867
~~~~~~~~~
868

    
869
Florent Chuffart
870

    
871
R: get comp strand
872

    
873
get comp strand
874
---------------
875

    
876
Description
877
~~~~~~~~~~~
878

    
879
Compute the complementatry strand.
880

    
881
Usage
882
~~~~~
883

    
884
::
885

    
886
    get_comp_strand(strand)
887

    
888
Arguments
889
~~~~~~~~~
890

    
891
``strand``
892

    
893
The original strand.
894

    
895
Value
896
~~~~~
897

    
898
Returns the complementatry strand.
899

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

    
903
Florent Chuffart
904

    
905
R: Build the design for deseq
906

    
907
Build the design for deseq
908
--------------------------
909

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

    
913
This function build the design according sample properties.
914

    
915
Usage
916
~~~~~
917

    
918
::
919

    
920
    get_design(marker, combi, all_samples)
921

    
922
Arguments
923
~~~~~~~~~
924

    
925
``marker``
926

    
927
The marker to considere.
928

    
929
``combi``
930

    
931
The starin combination to considere.
932

    
933
``all_samples``
934

    
935
Global list of samples.
936

    
937
Author(s)
938
~~~~~~~~~
939

    
940
Florent Chuffart
941

    
942
R: Compute the fuzzy nucs.
943

    
944
Compute the fuzzy nucs.
945
-----------------------
946

    
947
Description
948
~~~~~~~~~~~
949

    
950
This function aggregate non common wp nucs for each strain and substract
951
common wp nucs. It does not take care about the size of the resulting
952
fuzzy regions. It will be take into account in the count read part og
953
the pipeline.
954

    
955
Usage
956
~~~~~
957

    
958
::
959

    
960
    get_fuzzy(combi, roi, roi_index, strain_maps, common_nuc_results, 
961
        config = NULL)
962

    
963
Arguments
964
~~~~~~~~~
965

    
966
``combi``
967

    
968
The strain combination to consider.
969

    
970
``roi``
971

    
972
The region of interest.
973

    
974
``roi_index``
975

    
976
The region of interest index.
977

    
978
``strain_maps``
979

    
980
Nuc maps.
981

    
982
``common_nuc_results``
983

    
984
Common wp nuc maps
985

    
986
``config``
987

    
988
GLOBAL config variable
989

    
990
Author(s)
991
~~~~~~~~~
992

    
993
Florent Chuffart
994

    
995
R: Compute the list of SNEPs for a given set of marker, strain...
996

    
997
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
998
-------------------------------------------------------------------------------------
999

    
1000
Description
1001
~~~~~~~~~~~
1002

    
1003
This function uses
1004

    
1005
Usage
1006
~~~~~
1007

    
1008
::
1009

    
1010
    get_sneps(marker, combi, form, all_samples, config = NULL)
1011

    
1012
Arguments
1013
~~~~~~~~~
1014

    
1015
``marker``
1016

    
1017
The marker involved.
1018

    
1019
``combi``
1020

    
1021
The strain combination involved.
1022

    
1023
``form``
1024

    
1025
the nuc form involved.
1026

    
1027
``all_samples``
1028

    
1029
Global list of samples.
1030

    
1031
``config``
1032

    
1033
GLOBAL config variable
1034

    
1035
Author(s)
1036
~~~~~~~~~
1037

    
1038
Florent Chuffart
1039

    
1040
Examples
1041
~~~~~~~~
1042

    
1043
::
1044

    
1045
    marker = "H3K4me1"
1046
    combi = c("BY", "YJM") 
1047
    form = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy"
1048
    # foo = get_sneps(marker, combi, form)
1049
    # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
1050

    
1051
R: Likelihood ratio
1052

    
1053
Likelihood ratio
1054
----------------
1055

    
1056
Description
1057
~~~~~~~~~~~
1058

    
1059
Compute the likelihood log of two set of value from two models Vs. a
1060
unique model.
1061

    
1062
Usage
1063
~~~~~
1064

    
1065
::
1066

    
1067
    lod_score_vecs(x, y)
1068

    
1069
Arguments
1070
~~~~~~~~~
1071

    
1072
``x``
1073

    
1074
First vector.
1075

    
1076
``y``
1077

    
1078
Second vector.
1079

    
1080
Value
1081
~~~~~
1082

    
1083
Returns the likelihood ratio.
1084

    
1085
Author(s)
1086
~~~~~~~~~
1087

    
1088
Florent Chuffart
1089

    
1090
Examples
1091
~~~~~~~~
1092

    
1093
::
1094

    
1095
    # LOD score for 2 set of values
1096
    mean1=5; sd1=2; card2 = 250
1097
    mean2=6; sd2=3; card1 = 200
1098
    x1 = rnorm(card1, mean1, sd1)
1099
    x2 = rnorm(card2, mean2, sd2)  
1100
    min = floor(min(c(x1,x2)))
1101
    max = ceiling(max(c(x1,x2)))
1102
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1103
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1104
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1105
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1106
    lod_score_vecs(x1,x2)
1107

    
1108
R: nm
1109

    
1110
nm
1111
--
1112

    
1113
Description
1114
~~~~~~~~~~~
1115

    
1116
It provides a set of useful functions allowing to perform quantitative
1117
analysis of nucleosomal epigenome.
1118

    
1119
Details
1120
~~~~~~~
1121

    
1122
+---------------+---------------------------------------------------+
1123
| Package:      | nucleominer                                       |
1124
+---------------+---------------------------------------------------+
1125
| Maintainer:   | Florent Chuffart <florent.chuffart@ens-lyon.fr>   |
1126
+---------------+---------------------------------------------------+
1127
| Author:       | Florent Chuffart                                  |
1128
+---------------+---------------------------------------------------+
1129
| Version:      | 2.3.24                                            |
1130
+---------------+---------------------------------------------------+
1131
| License:      | CeCILL                                            |
1132
+---------------+---------------------------------------------------+
1133
| Title:        | nm                                                |
1134
+---------------+---------------------------------------------------+
1135
| Depends:      | seqinr, plotrix, DESeq, cachecache                |
1136
+---------------+---------------------------------------------------+
1137

    
1138
Author(s)
1139
~~~~~~~~~
1140

    
1141
Florent Chuffart
1142

    
1143
R: Performaing ANOVAs
1144

    
1145
Performaing ANOVAs
1146
------------------
1147

    
1148
Description
1149
~~~~~~~~~~~
1150

    
1151
Counts reads and Performs ANOVAS for each common nucleosomes involved.
1152

    
1153
Usage
1154
~~~~~
1155

    
1156
::
1157

    
1158
    perform_anovas(replicates, aligned_inter_strain_nucs, inputs_name = "Mnase_Seq", 
1159
        plot_anova_boxes = FALSE)
1160

    
1161
Arguments
1162
~~~~~~~~~
1163

    
1164
``replicates``
1165

    
1166
Set of replicates, each replicate is a list of samples (ideally 3). Each
1167
sample is a list like *sample = list(id=..., marker=..., strain=...,
1168
roi=..., inputs=..., outputs=...)* with *roi = list(name=..., begin=...,
1169
end=..., chr=..., genome=...)*. In the *perform\_anovas* contexte, we
1170
need 4 replicates (4 \* (3 samples)): 2 strains \* (1 marker + 1 input
1171
(Mnase\_Seq)).
1172

    
1173
``aligned_inter_strain_nucs``
1174

    
1175
List of common nucleosomes.
1176

    
1177
``inputs_name``
1178

    
1179
Name of the input.
1180

    
1181
``plot_anova_boxes``
1182

    
1183
Plot (or not) boxplot for each nuc.
1184

    
1185
Value
1186
~~~~~
1187

    
1188
Returns ANOVA results and comunted reads.
1189

    
1190
Author(s)
1191
~~~~~~~~~
1192

    
1193
Florent Chuffart
1194

    
1195
R: Plot the distribution of reads.
1196

    
1197
Plot the distribution of reads.
1198
-------------------------------
1199

    
1200
Description
1201
~~~~~~~~~~~
1202

    
1203
This fuxntion use the deseq nomalization feature to compare
1204
qualitatively the distribution.
1205

    
1206
Usage
1207
~~~~~
1208

    
1209
::
1210

    
1211
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1212

    
1213
Arguments
1214
~~~~~~~~~
1215

    
1216
``strain``
1217

    
1218
The strain to considere.
1219

    
1220
``marker``
1221

    
1222
The marker to considere.
1223

    
1224
``res``
1225

    
1226
Data
1227

    
1228
``all_samples``
1229

    
1230
Global list of samples.
1231

    
1232
``NEWPLOT``
1233

    
1234
If FALSE the curve will be add to the current plot.
1235

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

    
1239
Florent Chuffart
1240

    
1241
R: Remove wp nucs from common nucs list.
1242

    
1243
Remove wp nucs from common nucs list.
1244
-------------------------------------
1245

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

    
1249
It is based on common wp nucs index on nucs and region.
1250

    
1251
Usage
1252
~~~~~
1253

    
1254
::
1255

    
1256
    remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, strain)
1257

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

    
1261
``strain_maps``
1262

    
1263
Nuc maps.
1264

    
1265
``roi_index``
1266

    
1267
The region of interest index.
1268

    
1269
``tmp_common_nucs``
1270

    
1271
the list of wp nucs.
1272

    
1273
``strain``
1274

    
1275
The strain to consider.
1276

    
1277
Author(s)
1278
~~~~~~~~~
1279

    
1280
Florent Chuffart
1281

    
1282
R: sign from strand
1283

    
1284
sign from strand
1285
----------------
1286

    
1287
Description
1288
~~~~~~~~~~~
1289

    
1290
Get the sign of strand
1291

    
1292
Usage
1293
~~~~~
1294

    
1295
::
1296

    
1297
    sign_from_strand(strands)
1298

    
1299
Arguments
1300
~~~~~~~~~
1301

    
1302
+---------------+----+
1303
| ``strands``   |    |
1304
+---------------+----+
1305

    
1306
Value
1307
~~~~~
1308

    
1309
If strand in forward then returns 1 else returns -1
1310

    
1311
Author(s)
1312
~~~~~~~~~
1313

    
1314
Florent Chuffart
1315

    
1316
R: Substract to a list of regions an other list of regions that...
1317

    
1318
Substract to a list of regions an other list of regions that intersect it.
1319
--------------------------------------------------------------------------
1320

    
1321
Description
1322
~~~~~~~~~~~
1323

    
1324
This fucntion embed a recursive part. It occurs when a substracted
1325
region split an original region on two.
1326

    
1327
Usage
1328
~~~~~
1329

    
1330
::
1331

    
1332
    substract_region(region1, region2)
1333

    
1334
Arguments
1335
~~~~~~~~~
1336

    
1337
``region1``
1338

    
1339
Original regions.
1340

    
1341
``region2``
1342

    
1343
Regions to substract.
1344

    
1345
Author(s)
1346
~~~~~~~~~
1347

    
1348
Florent Chuffart
1349

    
1350
R: Switch a pairlist
1351

    
1352
Switch a pairlist
1353
-----------------
1354

    
1355
Description
1356
~~~~~~~~~~~
1357

    
1358
Take a pairlist key:value and return the switched pairlist value:key.
1359

    
1360
Usage
1361
~~~~~
1362

    
1363
::
1364

    
1365
    switch_pairlist(l)
1366

    
1367
Arguments
1368
~~~~~~~~~
1369

    
1370
``l``
1371

    
1372
The pairlist to switch.
1373

    
1374
Value
1375
~~~~~
1376

    
1377
The switched pairlist.
1378

    
1379
Author(s)
1380
~~~~~~~~~
1381

    
1382
Florent Chuffart
1383

    
1384
Examples
1385
~~~~~~~~
1386

    
1387
::
1388

    
1389
    l = list(key1 = "value1", key2 = "value2")
1390
    print(switch_pairlist(l))
1391

    
1392
R: Translate a list of regions from a strain ref to another.
1393

    
1394
Translate a list of regions from a strain ref to another.
1395
---------------------------------------------------------
1396

    
1397
Description
1398
~~~~~~~~~~~
1399

    
1400
This function is an eloborated call to translate\_roi.
1401

    
1402
Usage
1403
~~~~~
1404

    
1405
::
1406

    
1407
    translate_regions(regions, combi, roi_index, config = NULL, roi)
1408

    
1409
Arguments
1410
~~~~~~~~~
1411

    
1412
``regions``
1413

    
1414
Regions to be translated.
1415

    
1416
``combi``
1417

    
1418
Combination of strains.
1419

    
1420
``roi_index``
1421

    
1422
The region of interest index.
1423

    
1424
``config``
1425

    
1426
GLOBAL config variable
1427

    
1428
``roi``
1429

    
1430
The region of interest.
1431

    
1432
Author(s)
1433
~~~~~~~~~
1434

    
1435
Florent Chuffart
1436

    
1437
R: Translate coords of a genome region.
1438

    
1439
Translate coords of a genome region.
1440
------------------------------------
1441

    
1442
Description
1443
~~~~~~~~~~~
1444

    
1445
This function is used in the examples, usualy you have to define your
1446
own translation function and overwrite this one using *unlockBinding*
1447
features. Please, refer to the example.
1448

    
1449
Usage
1450
~~~~~
1451

    
1452
::
1453

    
1454
    translate_roi(roi, strain2, config = NULL, big_roi = NULL)
1455

    
1456
Arguments
1457
~~~~~~~~~
1458

    
1459
``roi``
1460

    
1461
Original genome region of interest.
1462

    
1463
``strain2``
1464

    
1465
The strain in wich you want the genome region of interest.
1466

    
1467
``config``
1468

    
1469
GLOBAL config variable
1470

    
1471
``big_roi``
1472

    
1473
A largest region than roi use to filter c2c if it is needed.
1474

    
1475
Author(s)
1476
~~~~~~~~~
1477

    
1478
Florent Chuffart
1479

    
1480
Examples
1481
~~~~~~~~
1482

    
1483
::
1484

    
1485
    # Define new translate_roi function...
1486
    translate_roi = function(roi, strain2, config) {
1487
        strain1 = roi$strain_ref
1488
        if (strain1 == strain2) {
1489
            return(roi)
1490
        } else {
1491
          stop("Here is my new translate_roi function...")      
1492
        }   
1493
    }
1494
    # Binding it by uncomment follwing lines.
1495
    # unlockBinding("translate_roi", as.environment("package:nm"))
1496
    # unlockBinding("translate_roi", getNamespace("nm"))
1497
    # assign("translate_roi", translate_roi, "package:nm")
1498
    # assign("translate_roi", translate_roi, getNamespace("nm"))
1499
    # lockBinding("translate_roi", getNamespace("nm"))
1500
    # lockBinding("translate_roi", as.environment("package:nm"))    
1501

    
1502
R: Aggregate regions that intersect themnselves.
1503

    
1504
Aggregate regions that intersect themnselves.
1505
---------------------------------------------
1506

    
1507
Description
1508
~~~~~~~~~~~
1509

    
1510
This function is based on sort of lower bounds to detect regions that
1511
intersect. We compare lower bound and upper bound of the porevious item.
1512
This function embed a while loop and break break regions list become
1513
stable.
1514

    
1515
Usage
1516
~~~~~
1517

    
1518
::
1519

    
1520
    union_regions(regions)
1521

    
1522
Arguments
1523
~~~~~~~~~
1524

    
1525
``regions``
1526

    
1527
The Regions to be aggregated
1528

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

    
1532
Florent Chuffart
1533

    
1534
R: Watching analysis of samples
1535

    
1536
Watching analysis of samples
1537
----------------------------
1538

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

    
1542
This function allows to view analysis for a particuler region of the
1543
genome.
1544

    
1545
Usage
1546
~~~~~
1547

    
1548
::
1549

    
1550
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1551
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1552
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1553
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1554
        plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, plot_common_nucs = TRUE, 
1555
        plot_anovas = FALSE, plot_anova_boxes = FALSE, plot_wp_nucs_4_nonmnase = FALSE, 
1556
        plot_chain = FALSE, aggregated_intra_strain_nucs = NULL, 
1557
        aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
1558

    
1559
Arguments
1560
~~~~~~~~~
1561

    
1562
``replicates``
1563

    
1564
replicates under the form...
1565

    
1566
``read_length``
1567

    
1568
length of the reads
1569

    
1570
``plot_ref_genome``
1571

    
1572
Plot (or not) reference genome.
1573

    
1574
``plot_arrow_raw_reads``
1575

    
1576
Plot (or not) arrows for raw reads.
1577

    
1578
``plot_arrow_nuc_reads``
1579

    
1580
Plot (or not) arrows for reads aasiocied to a nucleosome.
1581

    
1582
``plot_squared_reads``
1583

    
1584
Plot (or not) reads in the square fashion.
1585

    
1586
``plot_coverage``
1587

    
1588
Plot (or not) reads in the covergae fashion. fashion.
1589

    
1590
``plot_gaussian_reads``
1591

    
1592
Plot (or not) gaussian model of a F anf R reads.
1593

    
1594
``plot_gaussian_unified_reads``
1595

    
1596
Plot (or not) gaussian model of a nuc.
1597

    
1598
``plot_ellipse_nucs``
1599

    
1600
Plot (or not) ellipse for a nuc.
1601

    
1602
``plot_wp_nucs``
1603

    
1604
Plot (or not) cluster of nucs
1605

    
1606
``plot_wp_nuc_model``
1607

    
1608
Plot (or not) gaussian model for a cluster of nucs
1609

    
1610
``plot_common_nucs``
1611

    
1612
Plot (or not) aligned reads.
1613

    
1614
``plot_anovas``
1615

    
1616
Plot (or not) scatter for each nuc.
1617

    
1618
``plot_anova_boxes``
1619

    
1620
Plot (or not) boxplot for each nuc.
1621

    
1622
``plot_wp_nucs_4_nonmnase``
1623

    
1624
Plot (or not) clusters for non inputs samples.
1625

    
1626
``plot_chain``
1627

    
1628
Plot (or not) clusterised nuceosomes between mnase samples.
1629

    
1630
``aggregated_intra_strain_nucs``
1631

    
1632
list of aggregated intra strain nucs. If NULL, it will be computed.
1633

    
1634
``aligned_inter_strain_nucs``
1635

    
1636
list of aligned inter strain nucs. If NULL, it will be computed.
1637

    
1638
``height``
1639

    
1640
Number of reads in per million read for each sample, graphical parametre
1641
for the y axis.
1642

    
1643
``config``
1644

    
1645
GLOBAL config variable
1646

    
1647
Author(s)
1648
~~~~~~~~~
1649

    
1650
Florent Chuffart