Statistiques
| Branche: | Révision :

root / doc / sphinx_doc / rref.rst @ ec2936ea

Historique | Voir | Annoter | Télécharger (28,44 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 *llr\_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, llr_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
``llr_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 llr 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, llr_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
``llr_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 llr scores.
228

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

    
232
Florent Chuffart
233

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

    
237
::
238

    
239

    
240
        # Define new translate_cur function...
241
        translate_cur = function(roi, strain2, big_cur=NULL, config=NULL) {
242
          return(roi)
243
        }
244
        # Binding it by uncomment follwing lines.
245
        unlockBinding("translate_cur", as.environment("package:nucleominer"))
246
        unlockBinding("translate_cur", getNamespace("nucleominer"))
247
        assign("translate_cur", translate_cur, "package:nucleominer")
248
        assign("translate_cur", translate_cur, getNamespace("nucleominer"))
249
        lockBinding("translate_cur", getNamespace("nucleominer"))
250
        lockBinding("translate_cur", 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_cur(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\_cur" bug in
528
translate\_cur 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 overlapping
749
threshold.
750

    
751
Usage
752
~~~~~
753

    
754
::
755

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

    
759
Arguments
760
~~~~~~~~~
761

    
762
``tf_outputs``
763

    
764
TemplateFilter outputs.
765

    
766
``chr``
767

    
768
Chromosome observed, here chr is an integer.
769

    
770
``x_min``
771

    
772
Coordinate of the first bp observed.
773

    
774
``x_max``
775

    
776
Coordinate of the last bp observed.
777

    
778
``nuc_width``
779

    
780
Nucleosome width.
781

    
782
``ol_bp``
783

    
784
Overlap Threshold.
785

    
786
``corr_thres``
787

    
788
Correlation threshold.
789

    
790
Value
791
~~~~~
792

    
793
Returns filtered TemplateFilter Outputs
794

    
795
Author(s)
796
~~~~~~~~~
797

    
798
Florent Chuffart
799

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

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

    
805
Description
806
~~~~~~~~~~~
807

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

    
811
Usage
812
~~~~~
813

    
814
::
815

    
816
    flat_aggregated_intra_strain_nucs(partial_strain_maps, cur_index)
817

    
818
Arguments
819
~~~~~~~~~
820

    
821
``partial_strain_maps``
822

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

    
825
``cur_index``
826

    
827
the index of the roi involved
828

    
829
Value
830
~~~~~
831

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

    
835
Author(s)
836
~~~~~~~~~
837

    
838
Florent Chuffart
839

    
840
R: flat reads
841

    
842
flat reads
843
----------
844

    
845
Description
846
~~~~~~~~~~~
847

    
848
Extract reads coordinates from TempleteFilter input sequence
849

    
850
Usage
851
~~~~~
852

    
853
::
854

    
855
    flat_reads(reads, nuc_width)
856

    
857
Arguments
858
~~~~~~~~~
859

    
860
``reads``
861

    
862
TemplateFilter input reads
863

    
864
``nuc_width``
865

    
866
Width used to shift F and R reads.
867

    
868
Value
869
~~~~~
870

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

    
873
Author(s)
874
~~~~~~~~~
875

    
876
Florent Chuffart
877

    
878
R: Retrieve Reads
879

    
880
Retrieve Reads
881
--------------
882

    
883
Description
884
~~~~~~~~~~~
885

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

    
888
Usage
889
~~~~~
890

    
891
::
892

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

    
895
Arguments
896
~~~~~~~~~
897

    
898
``marker``
899

    
900
The marker to considere.
901

    
902
``combi``
903

    
904
The starin combination to considere.
905

    
906
``form``
907

    
908
The nuc form to considere.
909

    
910
``config``
911

    
912
GLOBAL config variable
913

    
914
Author(s)
915
~~~~~~~~~
916

    
917
Florent Chuffart
918

    
919
R: get comp strand
920

    
921
get comp strand
922
---------------
923

    
924
Description
925
~~~~~~~~~~~
926

    
927
Compute the complementatry strand.
928

    
929
Usage
930
~~~~~
931

    
932
::
933

    
934
    get_comp_strand(strand)
935

    
936
Arguments
937
~~~~~~~~~
938

    
939
``strand``
940

    
941
The original strand.
942

    
943
Value
944
~~~~~
945

    
946
Returns the complementatry strand.
947

    
948
Author(s)
949
~~~~~~~~~
950

    
951
Florent Chuffart
952

    
953
R: Build the design for deseq
954

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

    
958
Description
959
~~~~~~~~~~~
960

    
961
This function build the design according sample properties.
962

    
963
Usage
964
~~~~~
965

    
966
::
967

    
968
    get_design(marker, combi, all_samples)
969

    
970
Arguments
971
~~~~~~~~~
972

    
973
``marker``
974

    
975
The marker to considere.
976

    
977
``combi``
978

    
979
The starin combination to considere.
980

    
981
``all_samples``
982

    
983
Global list of samples.
984

    
985
Author(s)
986
~~~~~~~~~
987

    
988
Florent Chuffart
989

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

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

    
995
Description
996
~~~~~~~~~~~
997

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

    
1001
Usage
1002
~~~~~
1003

    
1004
::
1005

    
1006
    get_intra_strain_fuzzy(wp_map, roi, strain, config = NULL)
1007

    
1008
Arguments
1009
~~~~~~~~~
1010

    
1011
``wp_map``
1012

    
1013
Well positionned nucleosomes map.
1014

    
1015
``roi``
1016

    
1017
The region of interest.
1018

    
1019
``strain``
1020

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

    
1023
``config``
1024

    
1025
GLOBAL config variable.
1026

    
1027
Author(s)
1028
~~~~~~~~~
1029

    
1030
Florent Chuffart
1031

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

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

    
1037
Description
1038
~~~~~~~~~~~
1039

    
1040
This function uses
1041

    
1042
Usage
1043
~~~~~
1044

    
1045
::
1046

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

    
1049
Arguments
1050
~~~~~~~~~
1051

    
1052
``marker``
1053

    
1054
The marker involved.
1055

    
1056
``combi``
1057

    
1058
The strain combination involved.
1059

    
1060
``form``
1061

    
1062
the nuc form involved.
1063

    
1064
``all_samples``
1065

    
1066
Global list of samples.
1067

    
1068
``config``
1069

    
1070
GLOBAL config variable
1071

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

    
1075
Florent Chuffart
1076

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

    
1080
::
1081

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

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

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

    
1093
Description
1094
~~~~~~~~~~~
1095

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

    
1101
Usage
1102
~~~~~
1103

    
1104
::
1105

    
1106
    get_unrs(combi, roi, cur_index, wp_maps, fuzzy_maps, common_nuc_results, 
1107
        config = NULL)
1108

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

    
1112
``combi``
1113

    
1114
The strain combination to consider.
1115

    
1116
``roi``
1117

    
1118
The region of interest.
1119

    
1120
``cur_index``
1121

    
1122
The region of interest index.
1123

    
1124
``wp_maps``
1125

    
1126
Well positionned nucleosomes maps.
1127

    
1128
``fuzzy_maps``
1129

    
1130
Fuzzy nucleosomes maps.
1131

    
1132
``common_nuc_results``
1133

    
1134
Common wp nuc maps
1135

    
1136
``config``
1137

    
1138
GLOBAL config variable
1139

    
1140
Author(s)
1141
~~~~~~~~~
1142

    
1143
Florent Chuffart
1144

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

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

    
1150
Description
1151
~~~~~~~~~~~
1152

    
1153
This function...
1154

    
1155
Usage
1156
~~~~~
1157

    
1158
::
1159

    
1160
    intersect_region(region1, region2)
1161

    
1162
Arguments
1163
~~~~~~~~~
1164

    
1165
``region1``
1166

    
1167
Original regions.
1168

    
1169
``region2``
1170

    
1171
Regions to intersect.
1172

    
1173
Author(s)
1174
~~~~~~~~~
1175

    
1176
Florent Chuffart
1177

    
1178
R: Likelihood ratio
1179

    
1180
Likelihood ratio
1181
----------------
1182

    
1183
Description
1184
~~~~~~~~~~~
1185

    
1186
Compute the log likelihood ratio of two or more set of value.
1187

    
1188
Usage
1189
~~~~~
1190

    
1191
::
1192

    
1193
    llr_score_nvecs(xs)
1194

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

    
1198
``xs``
1199

    
1200
list of vectors.
1201

    
1202
Value
1203
~~~~~
1204

    
1205
Returns the log likelihood ratio.
1206

    
1207
Author(s)
1208
~~~~~~~~~
1209

    
1210
Florent Chuffart
1211

    
1212
Examples
1213
~~~~~~~~
1214

    
1215
::
1216

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

    
1230
R: nm
1231

    
1232
nm
1233
--
1234

    
1235
Description
1236
~~~~~~~~~~~
1237

    
1238
It provides a set of useful functions allowing to perform quantitative
1239
analysis of nucleosomal epigenome.
1240

    
1241
Details
1242
~~~~~~~
1243

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

    
1260
Author(s)
1261
~~~~~~~~~
1262

    
1263
Florent Chuffart
1264

    
1265
R: Plot the distribution of reads.
1266

    
1267
Plot the distribution of reads.
1268
-------------------------------
1269

    
1270
Description
1271
~~~~~~~~~~~
1272

    
1273
This fuxntion use the deseq nomalization feature to compare
1274
qualitatively the distribution.
1275

    
1276
Usage
1277
~~~~~
1278

    
1279
::
1280

    
1281
    plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE)
1282

    
1283
Arguments
1284
~~~~~~~~~
1285

    
1286
``strain``
1287

    
1288
The strain to considere.
1289

    
1290
``marker``
1291

    
1292
The marker to considere.
1293

    
1294
``res``
1295

    
1296
Data
1297

    
1298
``all_samples``
1299

    
1300
Global list of samples.
1301

    
1302
``NEWPLOT``
1303

    
1304
If FALSE the curve will be add to the current plot.
1305

    
1306
Author(s)
1307
~~~~~~~~~
1308

    
1309
Florent Chuffart
1310

    
1311
R: sign from strand
1312

    
1313
sign from strand
1314
----------------
1315

    
1316
Description
1317
~~~~~~~~~~~
1318

    
1319
Get the sign of strand
1320

    
1321
Usage
1322
~~~~~
1323

    
1324
::
1325

    
1326
    sign_from_strand(strands)
1327

    
1328
Arguments
1329
~~~~~~~~~
1330

    
1331
+---------------+----+
1332
| ``strands``   |    |
1333
+---------------+----+
1334

    
1335
Value
1336
~~~~~
1337

    
1338
If strand in forward then returns 1 else returns -1
1339

    
1340
Author(s)
1341
~~~~~~~~~
1342

    
1343
Florent Chuffart
1344

    
1345
R: Substract to a list of regions an other list of regions that...
1346

    
1347
Substract to a list of regions an other list of regions that intersect it.
1348
--------------------------------------------------------------------------
1349

    
1350
Description
1351
~~~~~~~~~~~
1352

    
1353
This fucntion embed a recursive part. It occurs when a substracted
1354
region split an original region on two.
1355

    
1356
Usage
1357
~~~~~
1358

    
1359
::
1360

    
1361
    substract_region(region1, region2)
1362

    
1363
Arguments
1364
~~~~~~~~~
1365

    
1366
``region1``
1367

    
1368
Original regions.
1369

    
1370
``region2``
1371

    
1372
Regions to substract.
1373

    
1374
Author(s)
1375
~~~~~~~~~
1376

    
1377
Florent Chuffart
1378

    
1379
R: Switch a pairlist
1380

    
1381
Switch a pairlist
1382
-----------------
1383

    
1384
Description
1385
~~~~~~~~~~~
1386

    
1387
Take a pairlist key:value and return the switched pairlist value:key.
1388

    
1389
Usage
1390
~~~~~
1391

    
1392
::
1393

    
1394
    switch_pairlist(l)
1395

    
1396
Arguments
1397
~~~~~~~~~
1398

    
1399
``l``
1400

    
1401
The pairlist to switch.
1402

    
1403
Value
1404
~~~~~
1405

    
1406
The switched pairlist.
1407

    
1408
Author(s)
1409
~~~~~~~~~
1410

    
1411
Florent Chuffart
1412

    
1413
Examples
1414
~~~~~~~~
1415

    
1416
::
1417

    
1418
    l = list(key1 = "value1", key2 = "value2")
1419
    print(switch_pairlist(l))
1420

    
1421
R: Translate coords of a genome region.
1422

    
1423
Translate coords of a genome region.
1424
------------------------------------
1425

    
1426
Description
1427
~~~~~~~~~~~
1428

    
1429
This function is used in the examples, usualy you have to define your
1430
own translation function and overwrite this one using *unlockBinding*
1431
features. Please, refer to the example.
1432

    
1433
Usage
1434
~~~~~
1435

    
1436
::
1437

    
1438
    translate_cur(roi, strain2, config = NULL, big_cur = NULL)
1439

    
1440
Arguments
1441
~~~~~~~~~
1442

    
1443
``roi``
1444

    
1445
Original genome region of interest.
1446

    
1447
``strain2``
1448

    
1449
The strain in wich you want the genome region of interest.
1450

    
1451
``config``
1452

    
1453
GLOBAL config variable
1454

    
1455
``big_cur``
1456

    
1457
A largest region than roi use to filter c2c if it is needed.
1458

    
1459
Author(s)
1460
~~~~~~~~~
1461

    
1462
Florent Chuffart
1463

    
1464
Examples
1465
~~~~~~~~
1466

    
1467
::
1468

    
1469
    # Define new translate_cur function...
1470
    translate_cur = function(roi, strain2, config) {
1471
        strain1 = roi$strain_ref
1472
        if (strain1 == strain2) {
1473
            return(roi)
1474
        } else {
1475
          stop("Here is my new translate_cur function...")
1476
        }
1477
    }
1478
    # Binding it by uncomment follwing lines.
1479
    # unlockBinding("translate_cur", as.environment("package:nm"))
1480
    # unlockBinding("translate_cur", getNamespace("nm"))
1481
    # assign("translate_cur", translate_cur, "package:nm")
1482
    # assign("translate_cur", translate_cur, getNamespace("nm"))
1483
    # lockBinding("translate_cur", getNamespace("nm"))
1484
    # lockBinding("translate_cur", as.environment("package:nm"))
1485

    
1486
R: Translate a list of regions from a strain ref to another.
1487

    
1488
Translate a list of regions from a strain ref to another.
1489
---------------------------------------------------------
1490

    
1491
Description
1492
~~~~~~~~~~~
1493

    
1494
This function is an eloborated call to translate\_cur.
1495

    
1496
Usage
1497
~~~~~
1498

    
1499
::
1500

    
1501
    translate_regions(regions, combi, cur_index, config = NULL, roi)
1502

    
1503
Arguments
1504
~~~~~~~~~
1505

    
1506
``regions``
1507

    
1508
Regions to be translated.
1509

    
1510
``combi``
1511

    
1512
Combination of strains.
1513

    
1514
``cur_index``
1515

    
1516
The region of interest index.
1517

    
1518
``config``
1519

    
1520
GLOBAL config variable
1521

    
1522
``roi``
1523

    
1524
The region of interest.
1525

    
1526
Author(s)
1527
~~~~~~~~~
1528

    
1529
Florent Chuffart
1530

    
1531
R: Aggregate regions that intersect themnselves.
1532

    
1533
Aggregate regions that intersect themnselves.
1534
---------------------------------------------
1535

    
1536
Description
1537
~~~~~~~~~~~
1538

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

    
1544
Usage
1545
~~~~~
1546

    
1547
::
1548

    
1549
    union_regions(regions)
1550

    
1551
Arguments
1552
~~~~~~~~~
1553

    
1554
``regions``
1555

    
1556
The Regions to be aggregated
1557

    
1558
Author(s)
1559
~~~~~~~~~
1560

    
1561
Florent Chuffart
1562

    
1563
R: Watching analysis of samples
1564

    
1565
Watching analysis of samples
1566
----------------------------
1567

    
1568
Description
1569
~~~~~~~~~~~
1570

    
1571
This function allows to view analysis for a particuler region of the
1572
genome.
1573

    
1574
Usage
1575
~~~~~
1576

    
1577
::
1578

    
1579
    watch_samples(replicates, read_length, plot_ref_genome = TRUE, 
1580
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1581
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1582
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1583
        change_col = TRUE, plot_wp_nucs = TRUE, plot_fuzzy_nucs = TRUE, 
1584
        plot_wp_nuc_model = TRUE, plot_common_nucs = FALSE, plot_common_unrs = FALSE, 
1585
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, plot_sample_id = FALSE, 
1586
        aggregated_intra_strain_nucs = NULL, aligned_inter_strain_nucs = NULL, 
1587
        height = 10, main = NULL, xlab = NULL, ylab = "#reads (per million reads)", 
1588
        config = NULL)
1589

    
1590
Arguments
1591
~~~~~~~~~
1592

    
1593
``replicates``
1594

    
1595
replicates under the form...
1596

    
1597
``read_length``
1598

    
1599
length of the reads
1600

    
1601
``plot_ref_genome``
1602

    
1603
Plot (or not) reference genome.
1604

    
1605
``plot_arrow_raw_reads``
1606

    
1607
Plot (or not) arrows for raw reads.
1608

    
1609
``plot_arrow_nuc_reads``
1610

    
1611
Plot (or not) arrows for reads aasiocied to a nucleosome.
1612

    
1613
``plot_squared_reads``
1614

    
1615
Plot (or not) reads in the square fashion.
1616

    
1617
``plot_coverage``
1618

    
1619
Plot (or not) reads in the covergae fashion. fashion.
1620

    
1621
``plot_gaussian_reads``
1622

    
1623
Plot (or not) gaussian model of a F anf R reads.
1624

    
1625
``plot_gaussian_unified_reads``
1626

    
1627
Plot (or not) gaussian model of a nuc.
1628

    
1629
``plot_ellipse_nucs``
1630

    
1631
Plot (or not) ellipse for a nuc.
1632

    
1633
``change_col``
1634

    
1635
Change the color of each nucleosome.
1636

    
1637
``plot_wp_nucs``
1638

    
1639
Plot (or not) cluster of nucs
1640

    
1641
``plot_fuzzy_nucs``
1642

    
1643
Plot (or not) cluster of fuzzy
1644

    
1645
``plot_wp_nuc_model``
1646

    
1647
Plot (or not) gaussian model for a cluster of nucs
1648

    
1649
``plot_common_nucs``
1650

    
1651
Plot (or not) aligned reads.
1652

    
1653
``plot_common_unrs``
1654

    
1655
Plot (or not) unaligned nucleosomal refgions (UNRs).
1656

    
1657
``plot_wp_nucs_4_nonmnase``
1658

    
1659
Plot (or not) clusters for non inputs samples.
1660

    
1661
``plot_chain``
1662

    
1663
Plot (or not) clusterised nuceosomes between mnase samples.
1664

    
1665
``plot_sample_id``
1666

    
1667
Plot (or not) the sample id for each sample.
1668

    
1669
``aggregated_intra_strain_nucs``
1670

    
1671
list of aggregated intra strain nucs. If NULL, it will be computed.
1672

    
1673
``aligned_inter_strain_nucs``
1674

    
1675
list of aligned inter strain nucs. If NULL, it will be computed.
1676

    
1677
``height``
1678

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

    
1682
``main``
1683

    
1684
main title of the produced plot
1685

    
1686
``xlab``
1687

    
1688
xlab of the produced plot
1689

    
1690
``ylab``
1691

    
1692
ylab of the produced plot
1693

    
1694
``config``
1695

    
1696
GLOBAL config variable
1697

    
1698
Author(s)
1699
~~~~~~~~~
1700

    
1701
Florent Chuffart