Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ 9fdbfada

Historique | Voir | Annoter | Télécharger (28,19 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: Extract a sub part of the corresponding c2c file
401

    
402
Extract a sub part of the corresponding c2c file
403
------------------------------------------------
404

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

    
408
This fonction allow to acces to a specific part of the c2c file.
409

    
410
Usage
411
~~~~~
412

    
413
::
414

    
415
    c2c_extraction(strain1, strain2, chr = NULL, lower_bound = NULL, 
416
        upper_bound = NULL, config = NULL)
417

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

    
421
``strain1``
422

    
423
the key strain
424

    
425
``strain2``
426

    
427
the target strain
428

    
429
``chr``
430

    
431
if defined, the c2c will filtered according to the chromosome value
432

    
433
``lower_bound``
434

    
435
if defined, the c2c will filtered for part of the genome upper than
436
lower\_bound
437

    
438
``upper_bound``
439

    
440
if defined, the c2c will filtered for part of the genome lower than
441
upper\_bound
442

    
443
``config``
444

    
445
GLOBAL config variable
446

    
447
Author(s)
448
~~~~~~~~~
449

    
450
Florent Chuffart
451

    
452
R: reformat an "apply manipulated" list of regions
453

    
454
reformat an "apply manipulated" list of regions
455
-----------------------------------------------
456

    
457
Description
458
~~~~~~~~~~~
459

    
460
Utils to reformat an "apply manipulated" list of regions
461

    
462
Usage
463
~~~~~
464

    
465
::
466

    
467
    collapse_regions(regions)
468

    
469
Arguments
470
~~~~~~~~~
471

    
472
+---------------+----+
473
| ``regions``   |    |
474
+---------------+----+
475

    
476
Author(s)
477
~~~~~~~~~
478

    
479
Florent Chuffart
480

    
481
R: Compute Common Uninterrupted Regions (CUR)
482

    
483
Compute Common Uninterrupted Regions (CUR)
484
------------------------------------------
485

    
486
Description
487
~~~~~~~~~~~
488

    
489
CURs are regions that can be aligned between the genomes
490

    
491
Usage
492
~~~~~
493

    
494
::
495

    
496
    compute_inter_all_strain_curs(diff_allowed = 30, min_cur_width = 4000, 
497
        config = NULL)
498

    
499
Arguments
500
~~~~~~~~~
501

    
502
``diff_allowed``
503

    
504
the maximum indel width allowe din a CUR
505

    
506
``min_cur_width``
507

    
508
The minimum width of a CUR
509

    
510
``config``
511

    
512
GLOBAL config variable
513

    
514
Author(s)
515
~~~~~~~~~
516

    
517
Florent Chuffart
518

    
519
R: Crop bound of regions according to region of interest bound
520

    
521
Crop bound of regions according to region of interest bound
522
-----------------------------------------------------------
523

    
524
Description
525
~~~~~~~~~~~
526

    
527
The fucntion is no more necessary since we remove "big\_roi" bug in
528
translate\_roi function.
529

    
530
Usage
531
~~~~~
532

    
533
::
534

    
535
    crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL)
536

    
537
Arguments
538
~~~~~~~~~
539

    
540
``tmp_fuzzy_nucs``
541

    
542
the regiuons to be croped.
543

    
544
``roi``
545

    
546
The region of interest.
547

    
548
``strain``
549

    
550
The strain to consider.
551

    
552
``config``
553

    
554
GLOBAL config variable
555

    
556
Author(s)
557
~~~~~~~~~
558

    
559
Florent Chuffart
560

    
561
R: Adding list to a dataframe.
562

    
563
Adding list to a dataframe.
564
---------------------------
565

    
566
Description
567
~~~~~~~~~~~
568

    
569
Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*. Return
570
the dataframe *df*.
571

    
572
Usage
573
~~~~~
574

    
575
::
576

    
577
    dfadd(df, l)
578

    
579
Arguments
580
~~~~~~~~~
581

    
582
``df``
583

    
584
A dataframe
585

    
586
``l``
587

    
588
A list
589

    
590
Value
591
~~~~~
592

    
593
Return the dataframe *df*.
594

    
595
Author(s)
596
~~~~~~~~~
597

    
598
Florent Chuffart
599

    
600
Examples
601
~~~~~~~~
602

    
603
::
604

    
605
    ## Here dataframe is NULL
606
    print(df)
607
    df = NULL
608

    
609
    # Initialize df
610
    df = dfadd(df, list(key1 = "value1", key2 = "value2"))
611
    print(df)
612

    
613
    # Adding elements to df
614
    df = dfadd(df, list(key1 = "value1'", key2 = "value2'"))
615
    print(df)
616

    
617
R: Prefetch data
618

    
619
Prefetch data
620
-------------
621

    
622
Description
623
~~~~~~~~~~~
624

    
625
Fetch and filter inputs and outpouts per region of interest. Organize it
626
per replicates.
627

    
628
Usage
629
~~~~~
630

    
631
::
632

    
633
    fetch_mnase_replicates(strain, roi, all_samples, config = NULL, 
634
        only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE)
635

    
636
Arguments
637
~~~~~~~~~
638

    
639
``strain``
640

    
641
The strain we want mnase replicatesList of replicates. Each replicates
642
is a vector of sample ids.
643

    
644
``roi``
645

    
646
Region of interest.
647

    
648
``all_samples``
649

    
650
Global list of samples.
651

    
652
``config``
653

    
654
GLOBAL config variable
655

    
656
``only_fetch``
657

    
658
If TRUE, only fetch and not filtering. It is used tio load sample files
659
into memory before forking.
660

    
661
``get_genome``
662

    
663
If TRUE, load corresponding genome sequence.
664

    
665
``get_ouputs``
666

    
667
If TRUE, get also ouput corresponding TF output files.
668

    
669
Author(s)
670
~~~~~~~~~
671

    
672
Florent Chuffart
673

    
674
R: Filter TemplateFilter inputs
675

    
676
Filter TemplateFilter inputs
677
----------------------------
678

    
679
Description
680
~~~~~~~~~~~
681

    
682
This function filters TemplateFilter inputs according genome area
683
observed properties. It takes into account reads that are at the
684
frontier of this area and the strand of these reads.
685

    
686
Usage
687
~~~~~
688

    
689
::
690

    
691
    filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160, 
692
        only_f = FALSE, only_r = FALSE, filter_for_coverage = FALSE)
693

    
694
Arguments
695
~~~~~~~~~
696

    
697
``inputs``
698

    
699
TF inputs to be filtered.
700

    
701
``chr``
702

    
703
Chromosome observed, here chr is an integer.
704

    
705
``x_min``
706

    
707
Coordinate of the first bp observed.
708

    
709
``x_max``
710

    
711
Coordinate of the last bp observed.
712

    
713
``nuc_width``
714

    
715
Nucleosome width.
716

    
717
``only_f``
718

    
719
Filter only F reads.
720

    
721
``only_r``
722

    
723
Filter only R reads.
724

    
725
``filter_for_coverage``
726

    
727
Does it filter for plot coverage?
728

    
729
Value
730
~~~~~
731

    
732
Returns filtred inputs.
733

    
734
Author(s)
735
~~~~~~~~~
736

    
737
Florent Chuffart
738

    
739
R: Filter TemplateFilter outputs
740

    
741
Filter TemplateFilter outputs
742
-----------------------------
743

    
744
Description
745
~~~~~~~~~~~
746

    
747
This function filters TemplateFilter outputs according, not only genome
748
area observerved properties, but also correlation and overlap threshold.
749

    
750
Usage
751
~~~~~
752

    
753
::
754

    
755
    filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160, 
756
        ol_bp = 59, corr_thres = 0.5)
757

    
758
Arguments
759
~~~~~~~~~
760

    
761
``tf_outputs``
762

    
763
TemplateFilter outputs.
764

    
765
``chr``
766

    
767
Chromosome observed, here chr is an integer.
768

    
769
``x_min``
770

    
771
Coordinate of the first bp observed.
772

    
773
``x_max``
774

    
775
Coordinate of the last bp observed.
776

    
777
``nuc_width``
778

    
779
Nucleosome width.
780

    
781
``ol_bp``
782

    
783
Overlap Threshold.
784

    
785
``corr_thres``
786

    
787
Correlation threshold.
788

    
789
Value
790
~~~~~
791

    
792
Returns filtered TemplateFilter Outputs
793

    
794
Author(s)
795
~~~~~~~~~
796

    
797
Florent Chuffart
798

    
799
R: to flat aggregate\_intra\_strain\_nucs function output
800

    
801
to flat aggregate\_intra\_strain\_nucs function output
802
------------------------------------------------------
803

    
804
Description
805
~~~~~~~~~~~
806

    
807
This function builds a dataframe of all clusters obtain from
808
aggregate\_intra\_strain\_nucs function.
809

    
810
Usage
811
~~~~~
812

    
813
::
814

    
815
    flat_aggregated_intra_strain_nucs(partial_strain_maps, roi_index)
816

    
817
Arguments
818
~~~~~~~~~
819

    
820
``partial_strain_maps``
821

    
822
the output of aggregate\_intra\_strain\_nucs function
823

    
824
``roi_index``
825

    
826
the index of the roi involved
827

    
828
Value
829
~~~~~
830

    
831
Returns a dataframe of all clusters obtain from
832
aggregate\_intra\_strain\_nucs function.
833

    
834
Author(s)
835
~~~~~~~~~
836

    
837
Florent Chuffart
838

    
839
R: flat reads
840

    
841
flat reads
842
----------
843

    
844
Description
845
~~~~~~~~~~~
846

    
847
Extract reads coordinates from TempleteFilter input sequence
848

    
849
Usage
850
~~~~~
851

    
852
::
853

    
854
    flat_reads(reads, nuc_width)
855

    
856
Arguments
857
~~~~~~~~~
858

    
859
``reads``
860

    
861
TemplateFilter input reads
862

    
863
``nuc_width``
864

    
865
Width used to shift F and R reads.
866

    
867
Value
868
~~~~~
869

    
870
Returns a list of F reads, R reads and joint/shifted F and R reads.
871

    
872
Author(s)
873
~~~~~~~~~
874

    
875
Florent Chuffart
876

    
877
R: Retrieve Reads
878

    
879
Retrieve Reads
880
--------------
881

    
882
Description
883
~~~~~~~~~~~
884

    
885
Retrieve reads for a given marker, combi, form.
886

    
887
Usage
888
~~~~~
889

    
890
::
891

    
892
    get_all_reads(marker, combi, form = "wp", config = NULL)
893

    
894
Arguments
895
~~~~~~~~~
896

    
897
``marker``
898

    
899
The marker to considere.
900

    
901
``combi``
902

    
903
The starin combination to considere.
904

    
905
``form``
906

    
907
The nuc form to considere.
908

    
909
``config``
910

    
911
GLOBAL config variable
912

    
913
Author(s)
914
~~~~~~~~~
915

    
916
Florent Chuffart
917

    
918
R: get comp strand
919

    
920
get comp strand
921
---------------
922

    
923
Description
924
~~~~~~~~~~~
925

    
926
Compute the complementatry strand.
927

    
928
Usage
929
~~~~~
930

    
931
::
932

    
933
    get_comp_strand(strand)
934

    
935
Arguments
936
~~~~~~~~~
937

    
938
``strand``
939

    
940
The original strand.
941

    
942
Value
943
~~~~~
944

    
945
Returns the complementatry strand.
946

    
947
Author(s)
948
~~~~~~~~~
949

    
950
Florent Chuffart
951

    
952
R: Build the design for deseq
953

    
954
Build the design for deseq
955
--------------------------
956

    
957
Description
958
~~~~~~~~~~~
959

    
960
This function build the design according sample properties.
961

    
962
Usage
963
~~~~~
964

    
965
::
966

    
967
    get_design(marker, combi, all_samples)
968

    
969
Arguments
970
~~~~~~~~~
971

    
972
``marker``
973

    
974
The marker to considere.
975

    
976
``combi``
977

    
978
The starin combination to considere.
979

    
980
``all_samples``
981

    
982
Global list of samples.
983

    
984
Author(s)
985
~~~~~~~~~
986

    
987
Florent Chuffart
988

    
989
R: Compute the fuzzy list for a given strain.
990

    
991
Compute the fuzzy list for a given strain.
992
------------------------------------------
993

    
994
Description
995
~~~~~~~~~~~
996

    
997
This function grabs the nucleosomes detxted by template\_filter that
998
have been rejected bt aggregate\_intra\_strain\_nucs as well positions.
999

    
1000
Usage
1001
~~~~~
1002

    
1003
::
1004

    
1005
    get_intra_strain_fuzzy(wp_maps, roi, strain, config = NULL)
1006

    
1007
Arguments
1008
~~~~~~~~~
1009

    
1010
``wp_maps``
1011

    
1012
Well positionned nucleosomes map.
1013

    
1014
``roi``
1015

    
1016
The region of interest.
1017

    
1018
``strain``
1019

    
1020
The strain we want to extracvt the fuzzy map.
1021

    
1022
``config``
1023

    
1024
GLOBAL config variable.
1025

    
1026
Author(s)
1027
~~~~~~~~~
1028

    
1029
Florent Chuffart
1030

    
1031
R: Compute the list of SNEPs for a given set of marker, strain...
1032

    
1033
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
1034
-------------------------------------------------------------------------------------
1035

    
1036
Description
1037
~~~~~~~~~~~
1038

    
1039
This function uses
1040

    
1041
Usage
1042
~~~~~
1043

    
1044
::
1045

    
1046
    get_sneps(marker, combi, form, all_samples, config = NULL)
1047

    
1048
Arguments
1049
~~~~~~~~~
1050

    
1051
``marker``
1052

    
1053
The marker involved.
1054

    
1055
``combi``
1056

    
1057
The strain combination involved.
1058

    
1059
``form``
1060

    
1061
the nuc form involved.
1062

    
1063
``all_samples``
1064

    
1065
Global list of samples.
1066

    
1067
``config``
1068

    
1069
GLOBAL config variable
1070

    
1071
Author(s)
1072
~~~~~~~~~
1073

    
1074
Florent Chuffart
1075

    
1076
Examples
1077
~~~~~~~~
1078

    
1079
::
1080

    
1081
    marker = "H3K4me1"
1082
    combi = c("BY", "YJM")
1083
    form = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy"
1084
    # foo = get_sneps(marker, combi, form)
1085
    # foo = get_sneps("H4K12ac", c("BY", "RM"), "wp")
1086

    
1087
R: Compute the unaligned nucleosomal regions (UNRs).
1088

    
1089
Compute the unaligned nucleosomal regions (UNRs).
1090
-------------------------------------------------
1091

    
1092
Description
1093
~~~~~~~~~~~
1094

    
1095
This function aggregate non common wp nucs for each strain and substract
1096
common wp nucs. It does not take care about the size of the resulting
1097
UNR. It will be take into account in the count read part og the
1098
pipeline.
1099

    
1100
Usage
1101
~~~~~
1102

    
1103
::
1104

    
1105
    get_unrs(combi, roi, roi_index, wp_maps, fuzzy_maps, common_nuc_results, 
1106
        config = NULL)
1107

    
1108
Arguments
1109
~~~~~~~~~
1110

    
1111
``combi``
1112

    
1113
The strain combination to consider.
1114

    
1115
``roi``
1116

    
1117
The region of interest.
1118

    
1119
``roi_index``
1120

    
1121
The region of interest index.
1122

    
1123
``wp_maps``
1124

    
1125
Well positionned nucleosomes maps.
1126

    
1127
``fuzzy_maps``
1128

    
1129
Fuzzy nucleosomes maps.
1130

    
1131
``common_nuc_results``
1132

    
1133
Common wp nuc maps
1134

    
1135
``config``
1136

    
1137
GLOBAL config variable
1138

    
1139
Author(s)
1140
~~~~~~~~~
1141

    
1142
Florent Chuffart
1143

    
1144
R: Returns the intersection of 2 list on regions.
1145

    
1146
Returns the intersection of 2 list on regions.
1147
----------------------------------------------
1148

    
1149
Description
1150
~~~~~~~~~~~
1151

    
1152
This function...
1153

    
1154
Usage
1155
~~~~~
1156

    
1157
::
1158

    
1159
    intersect_region(region1, region2)
1160

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

    
1164
``region1``
1165

    
1166
Original regions.
1167

    
1168
``region2``
1169

    
1170
Regions to intersect.
1171

    
1172
Author(s)
1173
~~~~~~~~~
1174

    
1175
Florent Chuffart
1176

    
1177
R: Likelihood ratio
1178

    
1179
Likelihood ratio
1180
----------------
1181

    
1182
Description
1183
~~~~~~~~~~~
1184

    
1185
Compute the likelihood log of two set of value from two models Vs. a
1186
unique model.
1187

    
1188
Usage
1189
~~~~~
1190

    
1191
::
1192

    
1193
    lod_score_vecs(x, y)
1194

    
1195
Arguments
1196
~~~~~~~~~
1197

    
1198
``x``
1199

    
1200
First vector.
1201

    
1202
``y``
1203

    
1204
Second vector.
1205

    
1206
Value
1207
~~~~~
1208

    
1209
Returns the likelihood ratio.
1210

    
1211
Author(s)
1212
~~~~~~~~~
1213

    
1214
Florent Chuffart
1215

    
1216
Examples
1217
~~~~~~~~
1218

    
1219
::
1220

    
1221
    # LOD score for 2 set of values
1222
    mean1=5; sd1=2; card2 = 250
1223
    mean2=6; sd2=3; card1 = 200
1224
    x1 = rnorm(card1, mean1, sd1)
1225
    x2 = rnorm(card2, mean2, sd2)
1226
    min = floor(min(c(x1,x2)))
1227
    max = ceiling(max(c(x1,x2)))
1228
    hist(c(x1,x2), xlim=c(min, max), breaks=min:max)
1229
    lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2)
1230
    lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3)
1231
    lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4)
1232
    lod_score_vecs(x1,x2)
1233

    
1234
R: nm
1235

    
1236
nm
1237
--
1238

    
1239
Description
1240
~~~~~~~~~~~
1241

    
1242
It provides a set of useful functions allowing to perform quantitative
1243
analysis of nucleosomal epigenome.
1244

    
1245
Details
1246
~~~~~~~
1247

    
1248
+---------------+---------------------------------------------------+
1249
| Package:      | nucleominer                                       |
1250
+---------------+---------------------------------------------------+
1251
| Maintainer:   | Florent Chuffart <florent.chuffart@ens-lyon.fr>   |
1252
+---------------+---------------------------------------------------+
1253
| Author:       | Florent Chuffart                                  |
1254
+---------------+---------------------------------------------------+
1255
| Version:      | 2.3.33                                            |
1256
+---------------+---------------------------------------------------+
1257
| License:      | CeCILL                                            |
1258
+---------------+---------------------------------------------------+
1259
| Title:        | nm                                                |
1260
+---------------+---------------------------------------------------+
1261
| Depends:      | seqinr, plotrix, DESeq, cachecache                |
1262
+---------------+---------------------------------------------------+
1263

    
1264
Author(s)
1265
~~~~~~~~~
1266

    
1267
Florent Chuffart
1268

    
1269
R: Plot the distribution of reads.
1270

    
1271
Plot the distribution of reads.
1272
-------------------------------
1273

    
1274
Description
1275
~~~~~~~~~~~
1276

    
1277
This fuxntion use the deseq nomalization feature to compare
1278
qualitatively the distribution.
1279

    
1280
Usage
1281
~~~~~
1282

    
1283
::
1284

    
1285
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1286

    
1287
Arguments
1288
~~~~~~~~~
1289

    
1290
``strain``
1291

    
1292
The strain to considere.
1293

    
1294
``marker``
1295

    
1296
The marker to considere.
1297

    
1298
``res``
1299

    
1300
Data
1301

    
1302
``all_samples``
1303

    
1304
Global list of samples.
1305

    
1306
``NEWPLOT``
1307

    
1308
If FALSE the curve will be add to the current plot.
1309

    
1310
Author(s)
1311
~~~~~~~~~
1312

    
1313
Florent Chuffart
1314

    
1315
R: sign from strand
1316

    
1317
sign from strand
1318
----------------
1319

    
1320
Description
1321
~~~~~~~~~~~
1322

    
1323
Get the sign of strand
1324

    
1325
Usage
1326
~~~~~
1327

    
1328
::
1329

    
1330
    sign_from_strand(strands)
1331

    
1332
Arguments
1333
~~~~~~~~~
1334

    
1335
+---------------+----+
1336
| ``strands``   |    |
1337
+---------------+----+
1338

    
1339
Value
1340
~~~~~
1341

    
1342
If strand in forward then returns 1 else returns -1
1343

    
1344
Author(s)
1345
~~~~~~~~~
1346

    
1347
Florent Chuffart
1348

    
1349
R: Substract to a list of regions an other list of regions that...
1350

    
1351
Substract to a list of regions an other list of regions that intersect it.
1352
--------------------------------------------------------------------------
1353

    
1354
Description
1355
~~~~~~~~~~~
1356

    
1357
This fucntion embed a recursive part. It occurs when a substracted
1358
region split an original region on two.
1359

    
1360
Usage
1361
~~~~~
1362

    
1363
::
1364

    
1365
    substract_region(region1, region2)
1366

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

    
1370
``region1``
1371

    
1372
Original regions.
1373

    
1374
``region2``
1375

    
1376
Regions to substract.
1377

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

    
1381
Florent Chuffart
1382

    
1383
R: Switch a pairlist
1384

    
1385
Switch a pairlist
1386
-----------------
1387

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

    
1391
Take a pairlist key:value and return the switched pairlist value:key.
1392

    
1393
Usage
1394
~~~~~
1395

    
1396
::
1397

    
1398
    switch_pairlist(l)
1399

    
1400
Arguments
1401
~~~~~~~~~
1402

    
1403
``l``
1404

    
1405
The pairlist to switch.
1406

    
1407
Value
1408
~~~~~
1409

    
1410
The switched pairlist.
1411

    
1412
Author(s)
1413
~~~~~~~~~
1414

    
1415
Florent Chuffart
1416

    
1417
Examples
1418
~~~~~~~~
1419

    
1420
::
1421

    
1422
    l = list(key1 = "value1", key2 = "value2")
1423
    print(switch_pairlist(l))
1424

    
1425
R: Translate a list of regions from a strain ref to another.
1426

    
1427
Translate a list of regions from a strain ref to another.
1428
---------------------------------------------------------
1429

    
1430
Description
1431
~~~~~~~~~~~
1432

    
1433
This function is an eloborated call to translate\_roi.
1434

    
1435
Usage
1436
~~~~~
1437

    
1438
::
1439

    
1440
    translate_regions(regions, combi, roi_index, config = NULL, roi)
1441

    
1442
Arguments
1443
~~~~~~~~~
1444

    
1445
``regions``
1446

    
1447
Regions to be translated.
1448

    
1449
``combi``
1450

    
1451
Combination of strains.
1452

    
1453
``roi_index``
1454

    
1455
The region of interest index.
1456

    
1457
``config``
1458

    
1459
GLOBAL config variable
1460

    
1461
``roi``
1462

    
1463
The region of interest.
1464

    
1465
Author(s)
1466
~~~~~~~~~
1467

    
1468
Florent Chuffart
1469

    
1470
R: Translate coords of a genome region.
1471

    
1472
Translate coords of a genome region.
1473
------------------------------------
1474

    
1475
Description
1476
~~~~~~~~~~~
1477

    
1478
This function is used in the examples, usualy you have to define your
1479
own translation function and overwrite this one using *unlockBinding*
1480
features. Please, refer to the example.
1481

    
1482
Usage
1483
~~~~~
1484

    
1485
::
1486

    
1487
    translate_roi(roi, strain2, config = NULL, big_roi = NULL)
1488

    
1489
Arguments
1490
~~~~~~~~~
1491

    
1492
``roi``
1493

    
1494
Original genome region of interest.
1495

    
1496
``strain2``
1497

    
1498
The strain in wich you want the genome region of interest.
1499

    
1500
``config``
1501

    
1502
GLOBAL config variable
1503

    
1504
``big_roi``
1505

    
1506
A largest region than roi use to filter c2c if it is needed.
1507

    
1508
Author(s)
1509
~~~~~~~~~
1510

    
1511
Florent Chuffart
1512

    
1513
Examples
1514
~~~~~~~~
1515

    
1516
::
1517

    
1518
    # Define new translate_roi function...
1519
    translate_roi = function(roi, strain2, config) {
1520
        strain1 = roi$strain_ref
1521
        if (strain1 == strain2) {
1522
            return(roi)
1523
        } else {
1524
          stop("Here is my new translate_roi function...")
1525
        }
1526
    }
1527
    # Binding it by uncomment follwing lines.
1528
    # unlockBinding("translate_roi", as.environment("package:nm"))
1529
    # unlockBinding("translate_roi", getNamespace("nm"))
1530
    # assign("translate_roi", translate_roi, "package:nm")
1531
    # assign("translate_roi", translate_roi, getNamespace("nm"))
1532
    # lockBinding("translate_roi", getNamespace("nm"))
1533
    # lockBinding("translate_roi", as.environment("package:nm"))
1534

    
1535
R: Aggregate regions that intersect themnselves.
1536

    
1537
Aggregate regions that intersect themnselves.
1538
---------------------------------------------
1539

    
1540
Description
1541
~~~~~~~~~~~
1542

    
1543
This function is based on sort of lower bounds to detect regions that
1544
intersect. We compare lower bound and upper bound of the porevious item.
1545
This function embed a while loop and break break regions list become
1546
stable.
1547

    
1548
Usage
1549
~~~~~
1550

    
1551
::
1552

    
1553
    union_regions(regions)
1554

    
1555
Arguments
1556
~~~~~~~~~
1557

    
1558
``regions``
1559

    
1560
The Regions to be aggregated
1561

    
1562
Author(s)
1563
~~~~~~~~~
1564

    
1565
Florent Chuffart
1566

    
1567
R: Watching analysis of samples
1568

    
1569
Watching analysis of samples
1570
----------------------------
1571

    
1572
Description
1573
~~~~~~~~~~~
1574

    
1575
This function allows to view analysis for a particuler region of the
1576
genome.
1577

    
1578
Usage
1579
~~~~~
1580

    
1581
::
1582

    
1583
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1584
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1585
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1586
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1587
        change_col = TRUE, plot_wp_nucs = TRUE, plot_fuzzy_nucs = TRUE, 
1588
        plot_wp_nuc_model = TRUE, plot_common_nucs = FALSE, plot_common_unrs = FALSE, 
1589
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, aggregated_intra_strain_nucs = NULL, 
1590
        aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
1591

    
1592
Arguments
1593
~~~~~~~~~
1594

    
1595
``replicates``
1596

    
1597
replicates under the form...
1598

    
1599
``read_length``
1600

    
1601
length of the reads
1602

    
1603
``plot_ref_genome``
1604

    
1605
Plot (or not) reference genome.
1606

    
1607
``plot_arrow_raw_reads``
1608

    
1609
Plot (or not) arrows for raw reads.
1610

    
1611
``plot_arrow_nuc_reads``
1612

    
1613
Plot (or not) arrows for reads aasiocied to a nucleosome.
1614

    
1615
``plot_squared_reads``
1616

    
1617
Plot (or not) reads in the square fashion.
1618

    
1619
``plot_coverage``
1620

    
1621
Plot (or not) reads in the covergae fashion. fashion.
1622

    
1623
``plot_gaussian_reads``
1624

    
1625
Plot (or not) gaussian model of a F anf R reads.
1626

    
1627
``plot_gaussian_unified_reads``
1628

    
1629
Plot (or not) gaussian model of a nuc.
1630

    
1631
``plot_ellipse_nucs``
1632

    
1633
Plot (or not) ellipse for a nuc.
1634

    
1635
``change_col``
1636

    
1637
Change the color of each nucleosome.
1638

    
1639
``plot_wp_nucs``
1640

    
1641
Plot (or not) cluster of nucs
1642

    
1643
``plot_fuzzy_nucs``
1644

    
1645
Plot (or not) cluster of fuzzy
1646

    
1647
``plot_wp_nuc_model``
1648

    
1649
Plot (or not) gaussian model for a cluster of nucs
1650

    
1651
``plot_common_nucs``
1652

    
1653
Plot (or not) aligned reads.
1654

    
1655
``plot_common_unrs``
1656

    
1657
Plot (or not) unaligned nucleosomal refgions (UNRs).
1658

    
1659
``plot_wp_nucs_4_nonmnase``
1660

    
1661
Plot (or not) clusters for non inputs samples.
1662

    
1663
``plot_chain``
1664

    
1665
Plot (or not) clusterised nuceosomes between mnase samples.
1666

    
1667
``aggregated_intra_strain_nucs``
1668

    
1669
list of aggregated intra strain nucs. If NULL, it will be computed.
1670

    
1671
``aligned_inter_strain_nucs``
1672

    
1673
list of aligned inter strain nucs. If NULL, it will be computed.
1674

    
1675
``height``
1676

    
1677
Number of reads in per million read for each sample, graphical parametre
1678
for the y axis.
1679

    
1680
``config``
1681

    
1682
GLOBAL config variable
1683

    
1684
Author(s)
1685
~~~~~~~~~
1686

    
1687
Florent Chuffart