root / doc / sphinx_doc / rref.rst @ 1d833b97
Historique | Voir | Annoter | Télécharger (25,03 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: Compute Common Uninterrupted Regions (CUR) |
317 |
|
318 |
Compute Common Uninterrupted Regions (CUR) |
319 |
------------------------------------------ |
320 |
|
321 |
Description |
322 |
~~~~~~~~~~~ |
323 |
|
324 |
CURs are regions that can be aligned between the genomes |
325 |
|
326 |
Usage |
327 |
~~~~~ |
328 |
|
329 |
:: |
330 |
|
331 |
compute_inter_all_strain_curs(diff_allowed = 10, min_cur_width = 200, |
332 |
config = NULL, plot = FALSE) |
333 |
|
334 |
Arguments |
335 |
~~~~~~~~~ |
336 |
|
337 |
``diff_allowed`` |
338 |
|
339 |
the maximum indel width allowe din a CUR |
340 |
|
341 |
``min_cur_width`` |
342 |
|
343 |
The minimum width of a CUR |
344 |
|
345 |
``config`` |
346 |
|
347 |
GLOBAL config variable |
348 |
|
349 |
``plot`` |
350 |
|
351 |
Plot CURs or not |
352 |
|
353 |
Author(s) |
354 |
~~~~~~~~~ |
355 |
|
356 |
Florent Chuffart |
357 |
|
358 |
R: Crop bound of regions according to region of interest bound |
359 |
|
360 |
Crop bound of regions according to region of interest bound |
361 |
----------------------------------------------------------- |
362 |
|
363 |
Description |
364 |
~~~~~~~~~~~ |
365 |
|
366 |
The fucntion is no more necessary since we remove "big\_roi" bug in |
367 |
translate\_roi function. |
368 |
|
369 |
Usage |
370 |
~~~~~ |
371 |
|
372 |
:: |
373 |
|
374 |
crop_fuzzy(tmp_fuzzy_nucs, roi, strain, config = NULL) |
375 |
|
376 |
Arguments |
377 |
~~~~~~~~~ |
378 |
|
379 |
``tmp_fuzzy_nucs`` |
380 |
|
381 |
the regiuons to be croped. |
382 |
|
383 |
``roi`` |
384 |
|
385 |
The region of interest. |
386 |
|
387 |
``strain`` |
388 |
|
389 |
The strain to consider. |
390 |
|
391 |
``config`` |
392 |
|
393 |
GLOBAL config variable |
394 |
|
395 |
Author(s) |
396 |
~~~~~~~~~ |
397 |
|
398 |
Florent Chuffart |
399 |
|
400 |
R: Adding list to a dataframe. |
401 |
|
402 |
Adding list to a dataframe. |
403 |
--------------------------- |
404 |
|
405 |
Description |
406 |
~~~~~~~~~~~ |
407 |
|
408 |
Add a list *l* to a dataframe *df*. Create it if *df* is *NULL*. Return |
409 |
the dataframe *df*. |
410 |
|
411 |
Usage |
412 |
~~~~~ |
413 |
|
414 |
:: |
415 |
|
416 |
dfadd(df, l) |
417 |
|
418 |
Arguments |
419 |
~~~~~~~~~ |
420 |
|
421 |
``df`` |
422 |
|
423 |
A dataframe |
424 |
|
425 |
``l`` |
426 |
|
427 |
A list |
428 |
|
429 |
Value |
430 |
~~~~~ |
431 |
|
432 |
Return the dataframe *df*. |
433 |
|
434 |
Author(s) |
435 |
~~~~~~~~~ |
436 |
|
437 |
Florent Chuffart |
438 |
|
439 |
Examples |
440 |
~~~~~~~~ |
441 |
|
442 |
:: |
443 |
|
444 |
## Here dataframe is NULL |
445 |
print(df) |
446 |
df = NULL |
447 |
|
448 |
# Initialize df |
449 |
df = dfadd(df, list(key1 = "value1", key2 = "value2")) |
450 |
print(df) |
451 |
|
452 |
# Adding elements to df |
453 |
df = dfadd(df, list(key1 = "value1'", key2 = "value2'")) |
454 |
print(df) |
455 |
|
456 |
R: Extract wp nucs from nuc map. |
457 |
|
458 |
Extract wp nucs from nuc map. |
459 |
----------------------------- |
460 |
|
461 |
Description |
462 |
~~~~~~~~~~~ |
463 |
|
464 |
Function based on common wp nuc index and roi\_index. |
465 |
|
466 |
Usage |
467 |
~~~~~ |
468 |
|
469 |
:: |
470 |
|
471 |
extract_wp(strain_maps, roi_index, strain, tmp_common_nucs) |
472 |
|
473 |
Arguments |
474 |
~~~~~~~~~ |
475 |
|
476 |
``strain_maps`` |
477 |
|
478 |
Nuc maps. |
479 |
|
480 |
``roi_index`` |
481 |
|
482 |
The region of interest index. |
483 |
|
484 |
``strain`` |
485 |
|
486 |
The strain to consider. |
487 |
|
488 |
``tmp_common_nucs`` |
489 |
|
490 |
the list of wp nucs. |
491 |
|
492 |
Author(s) |
493 |
~~~~~~~~~ |
494 |
|
495 |
Florent Chuffart |
496 |
|
497 |
R: Prefetch data |
498 |
|
499 |
Prefetch data |
500 |
------------- |
501 |
|
502 |
Description |
503 |
~~~~~~~~~~~ |
504 |
|
505 |
Fetch and filter inputs and outpouts per region of interest. Organize it |
506 |
per replicates. |
507 |
|
508 |
Usage |
509 |
~~~~~ |
510 |
|
511 |
:: |
512 |
|
513 |
fetch_mnase_replicates(strain, roi, all_samples, config = NULL, |
514 |
only_fetch = FALSE, get_genome = FALSE, get_ouputs = TRUE) |
515 |
|
516 |
Arguments |
517 |
~~~~~~~~~ |
518 |
|
519 |
``strain`` |
520 |
|
521 |
The strain we want mnase replicatesList of replicates. Each replicates |
522 |
is a vector of sample ids. |
523 |
|
524 |
``roi`` |
525 |
|
526 |
Region of interest. |
527 |
|
528 |
``all_samples`` |
529 |
|
530 |
Global list of samples. |
531 |
|
532 |
``config`` |
533 |
|
534 |
GLOBAL config variable |
535 |
|
536 |
``only_fetch`` |
537 |
|
538 |
If TRUE, only fetch and not filtering. It is used tio load sample files |
539 |
into memory before forking. |
540 |
|
541 |
``get_genome`` |
542 |
|
543 |
If TRUE, load corresponding genome sequence. |
544 |
|
545 |
``get_ouputs`` |
546 |
|
547 |
If TRUE, get also ouput corresponding TF output files. |
548 |
|
549 |
Author(s) |
550 |
~~~~~~~~~ |
551 |
|
552 |
Florent Chuffart |
553 |
|
554 |
R: Filter TemplateFilter inputs |
555 |
|
556 |
Filter TemplateFilter inputs |
557 |
---------------------------- |
558 |
|
559 |
Description |
560 |
~~~~~~~~~~~ |
561 |
|
562 |
This function filters TemplateFilter inputs according genome area |
563 |
observed properties. It takes into account reads that are at the |
564 |
frontier of this area and the strand of these reads. |
565 |
|
566 |
Usage |
567 |
~~~~~ |
568 |
|
569 |
:: |
570 |
|
571 |
filter_tf_inputs(inputs, chr, x_min, x_max, nuc_width = 160, |
572 |
only_f = FALSE, only_r = FALSE) |
573 |
|
574 |
Arguments |
575 |
~~~~~~~~~ |
576 |
|
577 |
``inputs`` |
578 |
|
579 |
TF inputs to be filtered. |
580 |
|
581 |
``chr`` |
582 |
|
583 |
Chromosome observed, here chr is an integer. |
584 |
|
585 |
``x_min`` |
586 |
|
587 |
Coordinate of the first bp observed. |
588 |
|
589 |
``x_max`` |
590 |
|
591 |
Coordinate of the last bp observed. |
592 |
|
593 |
``nuc_width`` |
594 |
|
595 |
Nucleosome width. |
596 |
|
597 |
``only_f`` |
598 |
|
599 |
Filter only F reads. |
600 |
|
601 |
``only_r`` |
602 |
|
603 |
Filter only R reads. |
604 |
|
605 |
Value |
606 |
~~~~~ |
607 |
|
608 |
Returns filtred inputs. |
609 |
|
610 |
Author(s) |
611 |
~~~~~~~~~ |
612 |
|
613 |
Florent Chuffart |
614 |
|
615 |
R: Filter TemplateFilter outputs |
616 |
|
617 |
Filter TemplateFilter outputs |
618 |
----------------------------- |
619 |
|
620 |
Description |
621 |
~~~~~~~~~~~ |
622 |
|
623 |
This function filters TemplateFilter outputs according, not only genome |
624 |
area observerved properties, but also correlation and overlap threshold. |
625 |
|
626 |
Usage |
627 |
~~~~~ |
628 |
|
629 |
:: |
630 |
|
631 |
filter_tf_outputs(tf_outputs, chr, x_min, x_max, nuc_width = 160, |
632 |
ol_bp = 59, corr_thres = 0.5) |
633 |
|
634 |
Arguments |
635 |
~~~~~~~~~ |
636 |
|
637 |
``tf_outputs`` |
638 |
|
639 |
TemplateFilter outputs. |
640 |
|
641 |
``chr`` |
642 |
|
643 |
Chromosome observed, here chr is an integer. |
644 |
|
645 |
``x_min`` |
646 |
|
647 |
Coordinate of the first bp observed. |
648 |
|
649 |
``x_max`` |
650 |
|
651 |
Coordinate of the last bp observed. |
652 |
|
653 |
``nuc_width`` |
654 |
|
655 |
Nucleosome width. |
656 |
|
657 |
``ol_bp`` |
658 |
|
659 |
Overlap Threshold. |
660 |
|
661 |
``corr_thres`` |
662 |
|
663 |
Correlation threshold. |
664 |
|
665 |
Value |
666 |
~~~~~ |
667 |
|
668 |
Returns filtered TemplateFilter Outputs |
669 |
|
670 |
Author(s) |
671 |
~~~~~~~~~ |
672 |
|
673 |
Florent Chuffart |
674 |
|
675 |
R: flat reads |
676 |
|
677 |
flat reads |
678 |
---------- |
679 |
|
680 |
Description |
681 |
~~~~~~~~~~~ |
682 |
|
683 |
Extract reads coordinates from TempleteFilter input sequence |
684 |
|
685 |
Usage |
686 |
~~~~~ |
687 |
|
688 |
:: |
689 |
|
690 |
flat_reads(reads, nuc_width) |
691 |
|
692 |
Arguments |
693 |
~~~~~~~~~ |
694 |
|
695 |
``reads`` |
696 |
|
697 |
TemplateFilter input reads |
698 |
|
699 |
``nuc_width`` |
700 |
|
701 |
Width used to shift F and R reads. |
702 |
|
703 |
Value |
704 |
~~~~~ |
705 |
|
706 |
Returns a list of F reads, R reads and joint/shifted F and R reads. |
707 |
|
708 |
Author(s) |
709 |
~~~~~~~~~ |
710 |
|
711 |
Florent Chuffart |
712 |
|
713 |
R: Retrieve Reads |
714 |
|
715 |
Retrieve Reads |
716 |
-------------- |
717 |
|
718 |
Description |
719 |
~~~~~~~~~~~ |
720 |
|
721 |
Retrieve reads for a given marker, combi, form. |
722 |
|
723 |
Usage |
724 |
~~~~~ |
725 |
|
726 |
:: |
727 |
|
728 |
get_all_reads(marker, combi, form = "wp") |
729 |
|
730 |
Arguments |
731 |
~~~~~~~~~ |
732 |
|
733 |
``marker`` |
734 |
|
735 |
The marker to considere. |
736 |
|
737 |
``combi`` |
738 |
|
739 |
The starin combination to considere. |
740 |
|
741 |
``form`` |
742 |
|
743 |
The nuc form to considere. |
744 |
|
745 |
Author(s) |
746 |
~~~~~~~~~ |
747 |
|
748 |
Florent Chuffart |
749 |
|
750 |
R: get comp strand |
751 |
|
752 |
get comp strand |
753 |
--------------- |
754 |
|
755 |
Description |
756 |
~~~~~~~~~~~ |
757 |
|
758 |
Compute the complementatry strand. |
759 |
|
760 |
Usage |
761 |
~~~~~ |
762 |
|
763 |
:: |
764 |
|
765 |
get_comp_strand(strand) |
766 |
|
767 |
Arguments |
768 |
~~~~~~~~~ |
769 |
|
770 |
``strand`` |
771 |
|
772 |
The original strand. |
773 |
|
774 |
Value |
775 |
~~~~~ |
776 |
|
777 |
Returns the complementatry strand. |
778 |
|
779 |
Author(s) |
780 |
~~~~~~~~~ |
781 |
|
782 |
Florent Chuffart |
783 |
|
784 |
R: Build the design for deseq |
785 |
|
786 |
Build the design for deseq |
787 |
-------------------------- |
788 |
|
789 |
Description |
790 |
~~~~~~~~~~~ |
791 |
|
792 |
This function build the design according sample properties. |
793 |
|
794 |
Usage |
795 |
~~~~~ |
796 |
|
797 |
:: |
798 |
|
799 |
get_design(marker, combi, all_samples) |
800 |
|
801 |
Arguments |
802 |
~~~~~~~~~ |
803 |
|
804 |
``marker`` |
805 |
|
806 |
The marker to considere. |
807 |
|
808 |
``combi`` |
809 |
|
810 |
The starin combination to considere. |
811 |
|
812 |
``all_samples`` |
813 |
|
814 |
Global list of samples. |
815 |
|
816 |
Author(s) |
817 |
~~~~~~~~~ |
818 |
|
819 |
Florent Chuffart |
820 |
|
821 |
R: Compute the fuzzy nucs. |
822 |
|
823 |
Compute the fuzzy nucs. |
824 |
----------------------- |
825 |
|
826 |
Description |
827 |
~~~~~~~~~~~ |
828 |
|
829 |
This function aggregate non common wp nucs for each strain and substract |
830 |
common wp nucs. It does not take care about the size of the resulting |
831 |
fuzzy regions. It will be take into account in the count read part og |
832 |
the pipeline. |
833 |
|
834 |
Usage |
835 |
~~~~~ |
836 |
|
837 |
:: |
838 |
|
839 |
get_fuzzy(combi, roi, roi_index, strain_maps, common_nuc_results, |
840 |
config = NULL) |
841 |
|
842 |
Arguments |
843 |
~~~~~~~~~ |
844 |
|
845 |
``combi`` |
846 |
|
847 |
The strain combination to consider. |
848 |
|
849 |
``roi`` |
850 |
|
851 |
The region of interest. |
852 |
|
853 |
``roi_index`` |
854 |
|
855 |
The region of interest index. |
856 |
|
857 |
``strain_maps`` |
858 |
|
859 |
Nuc maps. |
860 |
|
861 |
``common_nuc_results`` |
862 |
|
863 |
Common wp nuc maps |
864 |
|
865 |
``config`` |
866 |
|
867 |
GLOBAL config variable |
868 |
|
869 |
Author(s) |
870 |
~~~~~~~~~ |
871 |
|
872 |
Florent Chuffart |
873 |
|
874 |
R: Compute the list of SNEPs for a given set of marker, strain... |
875 |
|
876 |
Compute the list of SNEPs for a given set of marker, strain combination and nuc form. |
877 |
------------------------------------------------------------------------------------- |
878 |
|
879 |
Description |
880 |
~~~~~~~~~~~ |
881 |
|
882 |
This function uses |
883 |
|
884 |
Usage |
885 |
~~~~~ |
886 |
|
887 |
:: |
888 |
|
889 |
get_sneps(marker, combi, form, all_samples) |
890 |
|
891 |
Arguments |
892 |
~~~~~~~~~ |
893 |
|
894 |
``marker`` |
895 |
|
896 |
The marker involved. |
897 |
|
898 |
``combi`` |
899 |
|
900 |
The strain combination involved. |
901 |
|
902 |
``form`` |
903 |
|
904 |
the nuc form involved. |
905 |
|
906 |
``all_samples`` |
907 |
|
908 |
Global list of samples. |
909 |
|
910 |
Author(s) |
911 |
~~~~~~~~~ |
912 |
|
913 |
Florent Chuffart |
914 |
|
915 |
Examples |
916 |
~~~~~~~~ |
917 |
|
918 |
:: |
919 |
|
920 |
marker = "H3K4me1" |
921 |
combi = c("BY", "YJM") |
922 |
form = "wpfuzzy" # "wp" | "fuzzy" | "wpfuzzy" |
923 |
# foo = get_sneps(marker, combi, form) |
924 |
# foo = get_sneps("H4K12ac", c("BY", "RM"), "wp") |
925 |
|
926 |
R: Likelihood ratio |
927 |
|
928 |
Likelihood ratio |
929 |
---------------- |
930 |
|
931 |
Description |
932 |
~~~~~~~~~~~ |
933 |
|
934 |
Compute the likelihood log of two set of value from two models Vs. a |
935 |
unique model. |
936 |
|
937 |
Usage |
938 |
~~~~~ |
939 |
|
940 |
:: |
941 |
|
942 |
lod_score_vecs(x, y) |
943 |
|
944 |
Arguments |
945 |
~~~~~~~~~ |
946 |
|
947 |
``x`` |
948 |
|
949 |
First vector. |
950 |
|
951 |
``y`` |
952 |
|
953 |
Second vector. |
954 |
|
955 |
Value |
956 |
~~~~~ |
957 |
|
958 |
Returns the likelihood ratio. |
959 |
|
960 |
Author(s) |
961 |
~~~~~~~~~ |
962 |
|
963 |
Florent Chuffart |
964 |
|
965 |
Examples |
966 |
~~~~~~~~ |
967 |
|
968 |
:: |
969 |
|
970 |
# LOD score for 2 set of values |
971 |
mean1=5; sd1=2; card2 = 250 |
972 |
mean2=6; sd2=3; card1 = 200 |
973 |
x1 = rnorm(card1, mean1, sd1) |
974 |
x2 = rnorm(card2, mean2, sd2) |
975 |
min = floor(min(c(x1,x2))) |
976 |
max = ceiling(max(c(x1,x2))) |
977 |
hist(c(x1,x2), xlim=c(min, max), breaks=min:max) |
978 |
lines(min:max,dnorm(min:max,mean1,sd1)*card1,col=2) |
979 |
lines(min:max,dnorm(min:max,mean2,sd2)*card2,col=3) |
980 |
lines(min:max,dnorm(min:max,mean(c(x1,x2)),sd(c(x1,x2)))*card2,col=4) |
981 |
lod_score_vecs(x1,x2) |
982 |
|
983 |
R: nm |
984 |
|
985 |
nm |
986 |
-- |
987 |
|
988 |
Description |
989 |
~~~~~~~~~~~ |
990 |
|
991 |
It provides a set of useful functions allowing to perform quantitative |
992 |
analysis of nucleosomal epigenome. |
993 |
|
994 |
Details |
995 |
~~~~~~~ |
996 |
|
997 |
+---------------+---------------------------------------------------+ |
998 |
| Package: | nucleominer | |
999 |
+---------------+---------------------------------------------------+ |
1000 |
| Maintainer: | Florent Chuffart <florent.chuffart@ens-lyon.fr> | |
1001 |
+---------------+---------------------------------------------------+ |
1002 |
| Author: | Florent Chuffart | |
1003 |
+---------------+---------------------------------------------------+ |
1004 |
| Version: | 2.3.1 | |
1005 |
+---------------+---------------------------------------------------+ |
1006 |
| License: | CeCILL | |
1007 |
+---------------+---------------------------------------------------+ |
1008 |
| Title: | nm | |
1009 |
+---------------+---------------------------------------------------+ |
1010 |
| Depends: | seqinr, plotrix, DESeq, cachecache | |
1011 |
+---------------+---------------------------------------------------+ |
1012 |
|
1013 |
Author(s) |
1014 |
~~~~~~~~~ |
1015 |
|
1016 |
Florent Chuffart |
1017 |
|
1018 |
R: Performaing ANOVAs |
1019 |
|
1020 |
Performaing ANOVAs |
1021 |
------------------ |
1022 |
|
1023 |
Description |
1024 |
~~~~~~~~~~~ |
1025 |
|
1026 |
Counts reads and Performs ANOVAS for each common nucleosomes involved. |
1027 |
|
1028 |
Usage |
1029 |
~~~~~ |
1030 |
|
1031 |
:: |
1032 |
|
1033 |
perform_anovas(replicates, aligned_inter_strain_nucs, inputs_name = "Mnase_Seq", |
1034 |
plot_anova_boxes = FALSE) |
1035 |
|
1036 |
Arguments |
1037 |
~~~~~~~~~ |
1038 |
|
1039 |
``replicates`` |
1040 |
|
1041 |
Set of replicates, each replicate is a list of samples (ideally 3). Each |
1042 |
sample is a list like *sample = list(id=..., marker=..., strain=..., |
1043 |
roi=..., inputs=..., outputs=...)* with *roi = list(name=..., begin=..., |
1044 |
end=..., chr=..., genome=...)*. In the *perform\_anovas* contexte, we |
1045 |
need 4 replicates (4 \* (3 samples)): 2 strains \* (1 marker + 1 input |
1046 |
(Mnase\_Seq)). |
1047 |
|
1048 |
``aligned_inter_strain_nucs`` |
1049 |
|
1050 |
List of common nucleosomes. |
1051 |
|
1052 |
``inputs_name`` |
1053 |
|
1054 |
Name of the input. |
1055 |
|
1056 |
``plot_anova_boxes`` |
1057 |
|
1058 |
Plot (or not) boxplot for each nuc. |
1059 |
|
1060 |
Value |
1061 |
~~~~~ |
1062 |
|
1063 |
Returns ANOVA results and comunted reads. |
1064 |
|
1065 |
Author(s) |
1066 |
~~~~~~~~~ |
1067 |
|
1068 |
Florent Chuffart |
1069 |
|
1070 |
R: Plot the distribution of reads. |
1071 |
|
1072 |
Plot the distribution of reads. |
1073 |
------------------------------- |
1074 |
|
1075 |
Description |
1076 |
~~~~~~~~~~~ |
1077 |
|
1078 |
This fuxntion use the deseq nomalization feature to compare |
1079 |
qualitatively the distribution. |
1080 |
|
1081 |
Usage |
1082 |
~~~~~ |
1083 |
|
1084 |
:: |
1085 |
|
1086 |
plot_dist_samples(strain, marker, res, all_samples, NEWPLOT = TRUE) |
1087 |
|
1088 |
Arguments |
1089 |
~~~~~~~~~ |
1090 |
|
1091 |
``strain`` |
1092 |
|
1093 |
The strain to considere. |
1094 |
|
1095 |
``marker`` |
1096 |
|
1097 |
The marker to considere. |
1098 |
|
1099 |
``res`` |
1100 |
|
1101 |
Data |
1102 |
|
1103 |
``all_samples`` |
1104 |
|
1105 |
Global list of samples. |
1106 |
|
1107 |
``NEWPLOT`` |
1108 |
|
1109 |
If FALSE the curve will be add to the current plot. |
1110 |
|
1111 |
Author(s) |
1112 |
~~~~~~~~~ |
1113 |
|
1114 |
Florent Chuffart |
1115 |
|
1116 |
R: Remove wp nucs from common nucs list. |
1117 |
|
1118 |
Remove wp nucs from common nucs list. |
1119 |
------------------------------------- |
1120 |
|
1121 |
Description |
1122 |
~~~~~~~~~~~ |
1123 |
|
1124 |
It is based on common wp nucs index on nucs and region. |
1125 |
|
1126 |
Usage |
1127 |
~~~~~ |
1128 |
|
1129 |
:: |
1130 |
|
1131 |
remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, strain) |
1132 |
|
1133 |
Arguments |
1134 |
~~~~~~~~~ |
1135 |
|
1136 |
``strain_maps`` |
1137 |
|
1138 |
Nuc maps. |
1139 |
|
1140 |
``roi_index`` |
1141 |
|
1142 |
The region of interest index. |
1143 |
|
1144 |
``tmp_common_nucs`` |
1145 |
|
1146 |
the list of wp nucs. |
1147 |
|
1148 |
``strain`` |
1149 |
|
1150 |
The strain to consider. |
1151 |
|
1152 |
Author(s) |
1153 |
~~~~~~~~~ |
1154 |
|
1155 |
Florent Chuffart |
1156 |
|
1157 |
R: sign from strand |
1158 |
|
1159 |
sign from strand |
1160 |
---------------- |
1161 |
|
1162 |
Description |
1163 |
~~~~~~~~~~~ |
1164 |
|
1165 |
Get the sign of strand |
1166 |
|
1167 |
Usage |
1168 |
~~~~~ |
1169 |
|
1170 |
:: |
1171 |
|
1172 |
sign_from_strand(strands) |
1173 |
|
1174 |
Arguments |
1175 |
~~~~~~~~~ |
1176 |
|
1177 |
+---------------+----+ |
1178 |
| ``strands`` | | |
1179 |
+---------------+----+ |
1180 |
|
1181 |
Value |
1182 |
~~~~~ |
1183 |
|
1184 |
If strand in forward then returns 1 else returns -1 |
1185 |
|
1186 |
Author(s) |
1187 |
~~~~~~~~~ |
1188 |
|
1189 |
Florent Chuffart |
1190 |
|
1191 |
R: Substract to a list of regions an other list of regions that... |
1192 |
|
1193 |
Substract to a list of regions an other list of regions that intersect it. |
1194 |
-------------------------------------------------------------------------- |
1195 |
|
1196 |
Description |
1197 |
~~~~~~~~~~~ |
1198 |
|
1199 |
This fucntion embed a recursive part. It occurs when a substracted |
1200 |
region split an original region on two. |
1201 |
|
1202 |
Usage |
1203 |
~~~~~ |
1204 |
|
1205 |
:: |
1206 |
|
1207 |
substract_region(region1, region2) |
1208 |
|
1209 |
Arguments |
1210 |
~~~~~~~~~ |
1211 |
|
1212 |
``region1`` |
1213 |
|
1214 |
Original regions. |
1215 |
|
1216 |
``region2`` |
1217 |
|
1218 |
Regions to substract. |
1219 |
|
1220 |
Author(s) |
1221 |
~~~~~~~~~ |
1222 |
|
1223 |
Florent Chuffart |
1224 |
|
1225 |
R: Switch a pairlist |
1226 |
|
1227 |
Switch a pairlist |
1228 |
----------------- |
1229 |
|
1230 |
Description |
1231 |
~~~~~~~~~~~ |
1232 |
|
1233 |
Take a pairlist key:value and return the switched pairlist value:key. |
1234 |
|
1235 |
Usage |
1236 |
~~~~~ |
1237 |
|
1238 |
:: |
1239 |
|
1240 |
switch_pairlist(l) |
1241 |
|
1242 |
Arguments |
1243 |
~~~~~~~~~ |
1244 |
|
1245 |
``l`` |
1246 |
|
1247 |
The pairlist to switch. |
1248 |
|
1249 |
Value |
1250 |
~~~~~ |
1251 |
|
1252 |
The switched pairlist. |
1253 |
|
1254 |
Author(s) |
1255 |
~~~~~~~~~ |
1256 |
|
1257 |
Florent Chuffart |
1258 |
|
1259 |
Examples |
1260 |
~~~~~~~~ |
1261 |
|
1262 |
:: |
1263 |
|
1264 |
l = list(key1 = "value1", key2 = "value2") |
1265 |
print(switch_pairlist(l)) |
1266 |
|
1267 |
R: Translate a list of regions from a strain ref to another. |
1268 |
|
1269 |
Translate a list of regions from a strain ref to another. |
1270 |
--------------------------------------------------------- |
1271 |
|
1272 |
Description |
1273 |
~~~~~~~~~~~ |
1274 |
|
1275 |
This function is an eloborated call to translate\_roi. |
1276 |
|
1277 |
Usage |
1278 |
~~~~~ |
1279 |
|
1280 |
:: |
1281 |
|
1282 |
translate_regions(regions, combi, roi_index, config = NULL, roi) |
1283 |
|
1284 |
Arguments |
1285 |
~~~~~~~~~ |
1286 |
|
1287 |
``regions`` |
1288 |
|
1289 |
Regions to be translated. |
1290 |
|
1291 |
``combi`` |
1292 |
|
1293 |
Combination of strains. |
1294 |
|
1295 |
``roi_index`` |
1296 |
|
1297 |
The region of interest index. |
1298 |
|
1299 |
``config`` |
1300 |
|
1301 |
GLOBAL config variable |
1302 |
|
1303 |
``roi`` |
1304 |
|
1305 |
The region of interest. |
1306 |
|
1307 |
Author(s) |
1308 |
~~~~~~~~~ |
1309 |
|
1310 |
Florent Chuffart |
1311 |
|
1312 |
R: Translate coords of a genome region. |
1313 |
|
1314 |
Translate coords of a genome region. |
1315 |
------------------------------------ |
1316 |
|
1317 |
Description |
1318 |
~~~~~~~~~~~ |
1319 |
|
1320 |
This function is used in the examples, usualy you have to define your |
1321 |
own translation function and overwrite this one using *unlockBinding* |
1322 |
features. Please, refer to the example. |
1323 |
|
1324 |
Usage |
1325 |
~~~~~ |
1326 |
|
1327 |
:: |
1328 |
|
1329 |
translate_roi(roi, strain2, config = NULL, big_roi = NULL) |
1330 |
|
1331 |
Arguments |
1332 |
~~~~~~~~~ |
1333 |
|
1334 |
``roi`` |
1335 |
|
1336 |
Original genome region of interest. |
1337 |
|
1338 |
``strain2`` |
1339 |
|
1340 |
The strain in wich you want the genome region of interest. |
1341 |
|
1342 |
``config`` |
1343 |
|
1344 |
GLOBAL config variable |
1345 |
|
1346 |
``big_roi`` |
1347 |
|
1348 |
A largest region than roi use to filter c2c if it is needed. |
1349 |
|
1350 |
Author(s) |
1351 |
~~~~~~~~~ |
1352 |
|
1353 |
Florent Chuffart |
1354 |
|
1355 |
Examples |
1356 |
~~~~~~~~ |
1357 |
|
1358 |
:: |
1359 |
|
1360 |
# Define new translate_roi function... |
1361 |
translate_roi = function(roi, strain2, config) { |
1362 |
strain1 = roi$strain_ref |
1363 |
if (strain1 == strain2) { |
1364 |
return(roi) |
1365 |
} else { |
1366 |
stop("Here is my new translate_roi function...") |
1367 |
} |
1368 |
} |
1369 |
# Binding it by uncomment follwing lines. |
1370 |
# unlockBinding("translate_roi", as.environment("package:nm")) |
1371 |
# unlockBinding("translate_roi", getNamespace("nm")) |
1372 |
# assign("translate_roi", translate_roi, "package:nm") |
1373 |
# assign("translate_roi", translate_roi, getNamespace("nm")) |
1374 |
# lockBinding("translate_roi", getNamespace("nm")) |
1375 |
# lockBinding("translate_roi", as.environment("package:nm")) |
1376 |
|
1377 |
R: Aggregate regions that intersect themnselves. |
1378 |
|
1379 |
Aggregate regions that intersect themnselves. |
1380 |
--------------------------------------------- |
1381 |
|
1382 |
Description |
1383 |
~~~~~~~~~~~ |
1384 |
|
1385 |
This function is based on sort of lower bounds to detect regions that |
1386 |
intersect. We compare lower bound and upper bound of the porevious item. |
1387 |
This function embed a while loop and break break regions list become |
1388 |
stable. |
1389 |
|
1390 |
Usage |
1391 |
~~~~~ |
1392 |
|
1393 |
:: |
1394 |
|
1395 |
union_regions(regions) |
1396 |
|
1397 |
Arguments |
1398 |
~~~~~~~~~ |
1399 |
|
1400 |
``regions`` |
1401 |
|
1402 |
The Regions to be aggregated |
1403 |
|
1404 |
Author(s) |
1405 |
~~~~~~~~~ |
1406 |
|
1407 |
Florent Chuffart |
1408 |
|
1409 |
R: Watching analysis of samples |
1410 |
|
1411 |
Watching analysis of samples |
1412 |
---------------------------- |
1413 |
|
1414 |
Description |
1415 |
~~~~~~~~~~~ |
1416 |
|
1417 |
This function allows to view analysis for a particuler region of the |
1418 |
genome. |
1419 |
|
1420 |
Usage |
1421 |
~~~~~ |
1422 |
|
1423 |
:: |
1424 |
|
1425 |
watch_samples(replicates, read_length, plot_ref_genome = TRUE, |
1426 |
plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, |
1427 |
plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, |
1428 |
plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, |
1429 |
plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, plot_common_nucs = TRUE, |
1430 |
plot_anovas = FALSE, plot_anova_boxes = FALSE, plot_wp_nucs_4_nonmnase = FALSE, |
1431 |
aggregated_intra_strain_nucs = NULL, aligned_inter_strain_nucs = NULL, |
1432 |
height = 10, config = NULL) |
1433 |
|
1434 |
Arguments |
1435 |
~~~~~~~~~ |
1436 |
|
1437 |
``replicates`` |
1438 |
|
1439 |
replicates under the form... |
1440 |
|
1441 |
``read_length`` |
1442 |
|
1443 |
length of the reads |
1444 |
|
1445 |
``plot_ref_genome`` |
1446 |
|
1447 |
Plot (or not) reference genome. |
1448 |
|
1449 |
``plot_arrow_raw_reads`` |
1450 |
|
1451 |
Plot (or not) arrows for raw reads. |
1452 |
|
1453 |
``plot_arrow_nuc_reads`` |
1454 |
|
1455 |
Plot (or not) arrows for reads aasiocied to a nucleosome. |
1456 |
|
1457 |
``plot_squared_reads`` |
1458 |
|
1459 |
Plot (or not) reads in the square fashion. |
1460 |
|
1461 |
``plot_coverage`` |
1462 |
|
1463 |
Plot (or not) reads in the covergae fashion. fashion. |
1464 |
|
1465 |
``plot_gaussian_reads`` |
1466 |
|
1467 |
Plot (or not) gaussian model of a F anf R reads. |
1468 |
|
1469 |
``plot_gaussian_unified_reads`` |
1470 |
|
1471 |
Plot (or not) gaussian model of a nuc. |
1472 |
|
1473 |
``plot_ellipse_nucs`` |
1474 |
|
1475 |
Plot (or not) ellipse for a nuc. |
1476 |
|
1477 |
``plot_wp_nucs`` |
1478 |
|
1479 |
Plot (or not) cluster of nucs |
1480 |
|
1481 |
``plot_wp_nuc_model`` |
1482 |
|
1483 |
Plot (or not) gaussian model for a cluster of nucs |
1484 |
|
1485 |
``plot_common_nucs`` |
1486 |
|
1487 |
Plot (or not) aligned reads. |
1488 |
|
1489 |
``plot_anovas`` |
1490 |
|
1491 |
Plot (or not) scatter for each nuc. |
1492 |
|
1493 |
``plot_anova_boxes`` |
1494 |
|
1495 |
Plot (or not) boxplot for each nuc. |
1496 |
|
1497 |
``plot_wp_nucs_4_nonmnase`` |
1498 |
|
1499 |
Plot (or not) clusters for non inputs samples. |
1500 |
|
1501 |
``aggregated_intra_strain_nucs`` |
1502 |
|
1503 |
list of aggregated intra strain nucs. If NULL, it will be computed. |
1504 |
|
1505 |
``aligned_inter_strain_nucs`` |
1506 |
|
1507 |
list of aligned inter strain nucs. If NULL, it will be computed. |
1508 |
|
1509 |
``height`` |
1510 |
|
1511 |
Number of reads in per million read for each sample, graphical parametre |
1512 |
for the y axis. |
1513 |
|
1514 |
``config`` |
1515 |
|
1516 |
GLOBAL config variable |
1517 |
|
1518 |
Author(s) |
1519 |
~~~~~~~~~ |
1520 |
|
1521 |
Florent Chuffart |