Révision ec2936ea src/R/nucleominer.R
b/src/R/nucleominer.R | ||
---|---|---|
199 | 199 |
|
200 | 200 |
|
201 | 201 |
filter_tf_outputs = function(# Filter TemplateFilter outputs |
202 |
### This function filters TemplateFilter outputs according, not only genome area observerved properties, but also correlation and overlap threshold. |
|
202 |
### This function filters TemplateFilter outputs according, not only genome area observerved properties, but also correlation and overlapping threshold.
|
|
203 | 203 |
tf_outputs, ##<< TemplateFilter outputs. |
204 | 204 |
chr, ##<< Chromosome observed, here chr is an integer. |
205 | 205 |
x_min, ##<< Coordinate of the first bp observed. |
... | ... | |
324 | 324 |
tf_outs = list() |
325 | 325 |
i = 1 |
326 | 326 |
for (sample in samples) { |
327 |
# print(sample$roi$chr) |
|
328 |
# print(min_nuc_center) |
|
329 |
# print(max_nuc_center) |
|
330 |
# print(sample$outputs) |
|
331 |
# tf_outs[[i]] = filter_tf_outputs(sample$outputs, sample$roi$chr, min_nuc_center, max_nuc_center) |
|
332 |
# print(tf_outs[[i]]) |
|
333 | 327 |
tf_outs[[i]] = sample$outputs |
334 | 328 |
tf_outs[[i]] = tf_outs[[i]][order(tf_outs[[i]]$center),] |
335 | 329 |
indexes[i] = 1 |
... | ... | |
582 | 576 |
llr_score = llr_score_nvecs(list(reads_strain_ref1, reads_strain_ref2)) |
583 | 577 |
llr_scores = c(llr_scores, llr_score) |
584 | 578 |
# Filtering on LOD Score |
585 |
if (llr_score < llr_thres) { |
|
579 |
# if (llr_score < llr_thres) { |
|
580 |
if (TRUE) { |
|
586 | 581 |
tmp_nuc = list() |
587 | 582 |
# strain_ref1 |
588 | 583 |
tmp_nuc[[paste("chr_", strain_ref1, sep="")]] = chr |
... | ... | |
592 | 587 |
tmp_nuc[[paste("sd_", strain_ref1, sep="")]] = signif(sd(reads_strain_ref1),5) |
593 | 588 |
tmp_nuc[[paste("nb_reads_", strain_ref1, sep="")]] = length(reads_strain_ref1) |
594 | 589 |
tmp_nuc[[paste("index_nuc_", strain_ref1, sep="")]] = index_nuc_strain_ref1 |
595 |
# tmp_nuc[[paste("corr1_", strain_ref1, sep="")]] = signif(nuc_strain_ref1$nucs[[1]]$corr,5) |
|
596 |
# tmp_nuc[[paste("corr2_", strain_ref1, sep="")]] = signif(nuc_strain_ref1$nucs[[2]]$corr,5) |
|
597 |
# tmp_nuc[[paste("corr3_", strain_ref1, sep="")]] = signif(nuc_strain_ref1$nucs[[3]]$corr,5) |
|
598 | 590 |
# strain_ref2 |
599 | 591 |
tmp_nuc[[paste("chr_", strain_ref2, sep="")]] = roi_strain_ref2$chr |
600 | 592 |
tmp_nuc[[paste("lower_bound_", strain_ref2, sep="")]] = nuc_strain_ref2$lower_bound |
... | ... | |
603 | 595 |
tmp_nuc[[paste("sd_", strain_ref2, sep="")]] = signif(sd(reads_strain_ref2),5) |
604 | 596 |
tmp_nuc[[paste("nb_reads_", strain_ref2, sep="")]] = length(reads_strain_ref2) |
605 | 597 |
tmp_nuc[[paste("index_nuc_", strain_ref2, sep="")]] = index_nuc_strain_ref2 |
606 |
# tmp_nuc[[paste("corr1_", strain_ref2, sep="")]] = signif(nuc_strain_ref2$nucs[[1]]$corr,5) |
|
607 |
# tmp_nuc[[paste("corr2_", strain_ref2, sep="")]] = signif(nuc_strain_ref2$nucs[[2]]$corr,5) |
|
608 |
# tmp_nuc[[paste("corr3_", strain_ref2, sep="")]] = signif(nuc_strain_ref2$nucs[[3]]$corr,5) |
|
609 | 598 |
# common |
610 | 599 |
tmp_nuc[["llr_score"]] = signif(llr_score,5) |
611 |
# print(tmp_nuc) |
|
612 | 600 |
common_nuc = dfadd(common_nuc, tmp_nuc) |
613 |
}
|
|
601 |
}
|
|
614 | 602 |
} |
615 | 603 |
} |
616 | 604 |
} |
... | ... | |
2045 | 2033 |
new_tmp_y[index_odd] = tmp_y |
2046 | 2034 |
new_tmp_x[index_even] = tmp_x_inter |
2047 | 2035 |
new_tmp_y[index_even] = tmp_y_inter |
2048 |
lines(new_tmp_x , new_tmp_y, lw=2) |
|
2036 |
lines(new_tmp_x , new_tmp_y, lwd=2)
|
|
2049 | 2037 |
points(tmp_x, tmp_y, cex=4, pch=16, col="white") |
2050 |
points(tmp_x, tmp_y, cex=4, lw=2) |
|
2038 |
points(tmp_x, tmp_y, cex=4, lwd=2)
|
|
2051 | 2039 |
text(tmp_x, tmp_y, 1:nrow(tf_nucs)) |
2052 | 2040 |
if (is.null(config$LEGEND_LOD_POS)) { |
2053 | 2041 |
pos = 2 |
... | ... | |
2148 | 2136 |
common_nuc_results = list() |
2149 | 2137 |
common_nuc_results[[paste(combi[1], combi[2], sep="_")]] = aligned_inter_strain_nucs |
2150 | 2138 |
unrs = get_unrs(combi, roi, cur_index, wp_maps, fuzzy_maps, common_nuc_results, config = config) |
2151 |
rect(sign(x_min[[1]]) * unrs$lower_bound + shift[[1]], y_min[[1]], sign(x_min[[1]]) * unrs$upper_bound + shift[[1]], y_max[[2]], border=4, lw=10, col=adjustcolor(4, alpha.f = 0.05)) |
|
2139 |
rect(sign(x_min[[1]]) * unrs$lower_bound + shift[[1]], y_min[[1]], sign(x_min[[1]]) * unrs$upper_bound + shift[[1]], y_max[[2]], border=4, lwd=10, col=adjustcolor(4, alpha.f = 0.05))
|
|
2152 | 2140 |
} |
2153 | 2141 |
|
2154 | 2142 |
} |
Formats disponibles : Unified diff