Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ 0303dbe8

Historique | Voir | Annoter | Télécharger (27,01 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 list of SNEPs for a given set of marker, strain...
983

    
984
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
985
-------------------------------------------------------------------------------------
986

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

    
990
This function uses
991

    
992
Usage
993
~~~~~
994

    
995
::
996

    
997
    get_sneps(marker, combi, form, all_samples, config = NULL)
998

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

    
1002
``marker``
1003

    
1004
The marker involved.
1005

    
1006
``combi``
1007

    
1008
The strain combination involved.
1009

    
1010
``form``
1011

    
1012
the nuc form involved.
1013

    
1014
``all_samples``
1015

    
1016
Global list of samples.
1017

    
1018
``config``
1019

    
1020
GLOBAL config variable
1021

    
1022
Author(s)
1023
~~~~~~~~~
1024

    
1025
Florent Chuffart
1026

    
1027
Examples
1028
~~~~~~~~
1029

    
1030
::
1031

    
1032
    marker = "H3K4me1"
1033
    combi = c("BY", "YJM")
1034
    form = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy"
1035
    # foo = get_sneps(marker, combi, form)
1036
    # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
1037

    
1038
R: Likelihood ratio
1039

    
1040
Likelihood ratio
1041
----------------
1042

    
1043
Description
1044
~~~~~~~~~~~
1045

    
1046
Compute the likelihood log of two set of value from two models Vs. a
1047
unique model.
1048

    
1049
Usage
1050
~~~~~
1051

    
1052
::
1053

    
1054
    lod_score_vecs(x, y)
1055

    
1056
Arguments
1057
~~~~~~~~~
1058

    
1059
``x``
1060

    
1061
First vector.
1062

    
1063
``y``
1064

    
1065
Second vector.
1066

    
1067
Value
1068
~~~~~
1069

    
1070
Returns the likelihood ratio.
1071

    
1072
Author(s)
1073
~~~~~~~~~
1074

    
1075
Florent Chuffart
1076

    
1077
Examples
1078
~~~~~~~~
1079

    
1080
::
1081

    
1082
    # LOD score for 2 set of values
1083
    mean1=5; sd1=2; card2 = 250
1084
    mean2=6; sd2=3; card1 = 200
1085
    x1 = rnorm(card1, mean1, sd1)
1086
    x2 = rnorm(card2, mean2, sd2)
1087
    min = floor(min(c(x1,x2)))
1088
    max = ceiling(max(c(x1,x2)))
1089
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1090
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1091
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1092
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1093
    lod_score_vecs(x1,x2)
1094

    
1095
R: nm
1096

    
1097
nm
1098
--
1099

    
1100
Description
1101
~~~~~~~~~~~
1102

    
1103
It provides a set of useful functions allowing to perform quantitative
1104
analysis of nucleosomal epigenome.
1105

    
1106
Details
1107
~~~~~~~
1108

    
1109
+---------------+---------------------------------------------------+
1110
| Package:      | nucleominer                                       |
1111
+---------------+---------------------------------------------------+
1112
| Maintainer:   | Florent Chuffart <florent.chuffart@ens-lyon.fr>   |
1113
+---------------+---------------------------------------------------+
1114
| Author:       | Florent Chuffart                                  |
1115
+---------------+---------------------------------------------------+
1116
| Version:      | 2.3.31                                            |
1117
+---------------+---------------------------------------------------+
1118
| License:      | CeCILL                                            |
1119
+---------------+---------------------------------------------------+
1120
| Title:        | nm                                                |
1121
+---------------+---------------------------------------------------+
1122
| Depends:      | seqinr, plotrix, DESeq, cachecache                |
1123
+---------------+---------------------------------------------------+
1124

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

    
1128
Florent Chuffart
1129

    
1130
R: Performaing ANOVAs
1131

    
1132
Performaing ANOVAs
1133
------------------
1134

    
1135
Description
1136
~~~~~~~~~~~
1137

    
1138
Counts reads and Performs ANOVAS for each common nucleosomes involved.
1139

    
1140
Usage
1141
~~~~~
1142

    
1143
::
1144

    
1145
    perform_anovas(replicates, aligned_inter_strain_nucs, inputs_name = "Mnase_Seq", 
1146
        plot_anova_boxes = FALSE)
1147

    
1148
Arguments
1149
~~~~~~~~~
1150

    
1151
``replicates``
1152

    
1153
Set of replicates, each replicate is a list of samples (ideally 3). Each
1154
sample is a list like *sample = list(id=..., marker=..., strain=...,
1155
roi=..., inputs=..., outputs=...)* with *roi = list(name=..., begin=...,
1156
end=..., chr=..., genome=...)*. In the *perform\_anovas* contexte, we
1157
need 4 replicates (4 \* (3 samples)): 2 strains \* (1 marker + 1 input
1158
(Mnase\_Seq)).
1159

    
1160
``aligned_inter_strain_nucs``
1161

    
1162
List of common nucleosomes.
1163

    
1164
``inputs_name``
1165

    
1166
Name of the input.
1167

    
1168
``plot_anova_boxes``
1169

    
1170
Plot (or not) boxplot for each nuc.
1171

    
1172
Value
1173
~~~~~
1174

    
1175
Returns ANOVA results and comunted reads.
1176

    
1177
Author(s)
1178
~~~~~~~~~
1179

    
1180
Florent Chuffart
1181

    
1182
R: Plot the distribution of reads.
1183

    
1184
Plot the distribution of reads.
1185
-------------------------------
1186

    
1187
Description
1188
~~~~~~~~~~~
1189

    
1190
This fuxntion use the deseq nomalization feature to compare
1191
qualitatively the distribution.
1192

    
1193
Usage
1194
~~~~~
1195

    
1196
::
1197

    
1198
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1199

    
1200
Arguments
1201
~~~~~~~~~
1202

    
1203
``strain``
1204

    
1205
The strain to considere.
1206

    
1207
``marker``
1208

    
1209
The marker to considere.
1210

    
1211
``res``
1212

    
1213
Data
1214

    
1215
``all_samples``
1216

    
1217
Global list of samples.
1218

    
1219
``NEWPLOT``
1220

    
1221
If FALSE the curve will be add to the current plot.
1222

    
1223
Author(s)
1224
~~~~~~~~~
1225

    
1226
Florent Chuffart
1227

    
1228
R: sign from strand
1229

    
1230
sign from strand
1231
----------------
1232

    
1233
Description
1234
~~~~~~~~~~~
1235

    
1236
Get the sign of strand
1237

    
1238
Usage
1239
~~~~~
1240

    
1241
::
1242

    
1243
    sign_from_strand(strands)
1244

    
1245
Arguments
1246
~~~~~~~~~
1247

    
1248
+---------------+----+
1249
| ``strands``   |    |
1250
+---------------+----+
1251

    
1252
Value
1253
~~~~~
1254

    
1255
If strand in forward then returns 1 else returns -1
1256

    
1257
Author(s)
1258
~~~~~~~~~
1259

    
1260
Florent Chuffart
1261

    
1262
R: Substract to a list of regions an other list of regions that...
1263

    
1264
Substract to a list of regions an other list of regions that intersect it.
1265
--------------------------------------------------------------------------
1266

    
1267
Description
1268
~~~~~~~~~~~
1269

    
1270
This fucntion embed a recursive part. It occurs when a substracted
1271
region split an original region on two.
1272

    
1273
Usage
1274
~~~~~
1275

    
1276
::
1277

    
1278
    substract_region(region1, region2)
1279

    
1280
Arguments
1281
~~~~~~~~~
1282

    
1283
``region1``
1284

    
1285
Original regions.
1286

    
1287
``region2``
1288

    
1289
Regions to substract.
1290

    
1291
Author(s)
1292
~~~~~~~~~
1293

    
1294
Florent Chuffart
1295

    
1296
R: Switch a pairlist
1297

    
1298
Switch a pairlist
1299
-----------------
1300

    
1301
Description
1302
~~~~~~~~~~~
1303

    
1304
Take a pairlist key:value and return the switched pairlist value:key.
1305

    
1306
Usage
1307
~~~~~
1308

    
1309
::
1310

    
1311
    switch_pairlist(l)
1312

    
1313
Arguments
1314
~~~~~~~~~
1315

    
1316
``l``
1317

    
1318
The pairlist to switch.
1319

    
1320
Value
1321
~~~~~
1322

    
1323
The switched pairlist.
1324

    
1325
Author(s)
1326
~~~~~~~~~
1327

    
1328
Florent Chuffart
1329

    
1330
Examples
1331
~~~~~~~~
1332

    
1333
::
1334

    
1335
    l = list(key1 = "value1", key2 = "value2")
1336
    print(switch_pairlist(l))
1337

    
1338
R: Translate a list of regions from a strain ref to another.
1339

    
1340
Translate a list of regions from a strain ref to another.
1341
---------------------------------------------------------
1342

    
1343
Description
1344
~~~~~~~~~~~
1345

    
1346
This function is an eloborated call to translate\_roi.
1347

    
1348
Usage
1349
~~~~~
1350

    
1351
::
1352

    
1353
    translate_regions(regions, combi, roi_index, config = NULL, roi)
1354

    
1355
Arguments
1356
~~~~~~~~~
1357

    
1358
``regions``
1359

    
1360
Regions to be translated.
1361

    
1362
``combi``
1363

    
1364
Combination of strains.
1365

    
1366
``roi_index``
1367

    
1368
The region of interest index.
1369

    
1370
``config``
1371

    
1372
GLOBAL config variable
1373

    
1374
``roi``
1375

    
1376
The region of interest.
1377

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

    
1381
Florent Chuffart
1382

    
1383
R: Translate coords of a genome region.
1384

    
1385
Translate coords of a genome region.
1386
------------------------------------
1387

    
1388
Description
1389
~~~~~~~~~~~
1390

    
1391
This function is used in the examples, usualy you have to define your
1392
own translation function and overwrite this one using *unlockBinding*
1393
features. Please, refer to the example.
1394

    
1395
Usage
1396
~~~~~
1397

    
1398
::
1399

    
1400
    translate_roi(roi, strain2, config = NULL, big_roi = NULL)
1401

    
1402
Arguments
1403
~~~~~~~~~
1404

    
1405
``roi``
1406

    
1407
Original genome region of interest.
1408

    
1409
``strain2``
1410

    
1411
The strain in wich you want the genome region of interest.
1412

    
1413
``config``
1414

    
1415
GLOBAL config variable
1416

    
1417
``big_roi``
1418

    
1419
A largest region than roi use to filter c2c if it is needed.
1420

    
1421
Author(s)
1422
~~~~~~~~~
1423

    
1424
Florent Chuffart
1425

    
1426
Examples
1427
~~~~~~~~
1428

    
1429
::
1430

    
1431
    # Define new translate_roi function...
1432
    translate_roi = function(roi, strain2, config) {
1433
        strain1 = roi$strain_ref
1434
        if (strain1 == strain2) {
1435
            return(roi)
1436
        } else {
1437
          stop("Here is my new translate_roi function...")      
1438
        }   
1439
    }
1440
    # Binding it by uncomment follwing lines.
1441
    # unlockBinding("translate_roi", as.environment("package:nm"))
1442
    # unlockBinding("translate_roi", getNamespace("nm"))
1443
    # assign("translate_roi", translate_roi, "package:nm")
1444
    # assign("translate_roi", translate_roi, getNamespace("nm"))
1445
    # lockBinding("translate_roi", getNamespace("nm"))
1446
    # lockBinding("translate_roi", as.environment("package:nm"))    
1447

    
1448
R: Aggregate regions that intersect themnselves.
1449

    
1450
Aggregate regions that intersect themnselves.
1451
---------------------------------------------
1452

    
1453
Description
1454
~~~~~~~~~~~
1455

    
1456
This function is based on sort of lower bounds to detect regions that
1457
intersect. We compare lower bound and upper bound of the porevious item.
1458
This function embed a while loop and break break regions list become
1459
stable.
1460

    
1461
Usage
1462
~~~~~
1463

    
1464
::
1465

    
1466
    union_regions(regions)
1467

    
1468
Arguments
1469
~~~~~~~~~
1470

    
1471
``regions``
1472

    
1473
The Regions to be aggregated
1474

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

    
1478
Florent Chuffart
1479

    
1480
R: Watching analysis of samples
1481

    
1482
Watching analysis of samples
1483
----------------------------
1484

    
1485
Description
1486
~~~~~~~~~~~
1487

    
1488
This function allows to view analysis for a particuler region of the
1489
genome.
1490

    
1491
Usage
1492
~~~~~
1493

    
1494
::
1495

    
1496
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1497
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1498
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1499
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1500
        change_col = TRUE, plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, 
1501
        plot_common_nucs = TRUE, plot_anovas = FALSE, plot_anova_boxes = FALSE, 
1502
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, aggregated_intra_strain_nucs = NULL, 
1503
        aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
1504

    
1505
Arguments
1506
~~~~~~~~~
1507

    
1508
``replicates``
1509

    
1510
replicates under the form...
1511

    
1512
``read_length``
1513

    
1514
length of the reads
1515

    
1516
``plot_ref_genome``
1517

    
1518
Plot (or not) reference genome.
1519

    
1520
``plot_arrow_raw_reads``
1521

    
1522
Plot (or not) arrows for raw reads.
1523

    
1524
``plot_arrow_nuc_reads``
1525

    
1526
Plot (or not) arrows for reads aasiocied to a nucleosome.
1527

    
1528
``plot_squared_reads``
1529

    
1530
Plot (or not) reads in the square fashion.
1531

    
1532
``plot_coverage``
1533

    
1534
Plot (or not) reads in the covergae fashion. fashion.
1535

    
1536
``plot_gaussian_reads``
1537

    
1538
Plot (or not) gaussian model of a F anf R reads.
1539

    
1540
``plot_gaussian_unified_reads``
1541

    
1542
Plot (or not) gaussian model of a nuc.
1543

    
1544
``plot_ellipse_nucs``
1545

    
1546
Plot (or not) ellipse for a nuc.
1547

    
1548
``change_col``
1549

    
1550
Change the color of each nucleosome.
1551

    
1552
``plot_wp_nucs``
1553

    
1554
Plot (or not) cluster of nucs
1555

    
1556
``plot_wp_nuc_model``
1557

    
1558
Plot (or not) gaussian model for a cluster of nucs
1559

    
1560
``plot_common_nucs``
1561

    
1562
Plot (or not) aligned reads.
1563

    
1564
``plot_anovas``
1565

    
1566
Plot (or not) scatter for each nuc.
1567

    
1568
``plot_anova_boxes``
1569

    
1570
Plot (or not) boxplot for each nuc.
1571

    
1572
``plot_wp_nucs_4_nonmnase``
1573

    
1574
Plot (or not) clusters for non inputs samples.
1575

    
1576
``plot_chain``
1577

    
1578
Plot (or not) clusterised nuceosomes between mnase samples.
1579

    
1580
``aggregated_intra_strain_nucs``
1581

    
1582
list of aggregated intra strain nucs. If NULL, it will be computed.
1583

    
1584
``aligned_inter_strain_nucs``
1585

    
1586
list of aligned inter strain nucs. If NULL, it will be computed.
1587

    
1588
``height``
1589

    
1590
Number of reads in per million read for each sample, graphical parametre
1591
for the y axis.
1592

    
1593
``config``
1594

    
1595
GLOBAL config variable
1596

    
1597
Author(s)
1598
~~~~~~~~~
1599

    
1600
Florent Chuffart