From 5013b73eb6555cc084d34b740ea659f424566c5e Mon Sep 17 00:00:00 2001 From: Yang-Yang Feng Date: Wed, 9 Oct 2019 23:38:11 -0500 Subject: [PATCH 1/2] norm_scores_non=list(norm_score) --- scripts/compare_junctions_hist.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compare_junctions_hist.R b/scripts/compare_junctions_hist.R index c9e6f5d..7b54efa 100644 --- a/scripts/compare_junctions_hist.R +++ b/scripts/compare_junctions_hist.R @@ -139,7 +139,7 @@ a <- function(x, all_cse_identify_data){ # Aggregate data across junction-samples if (nrow(variant_junctions_data)[[1]] > 0){ - non_variant_junctions_aggr = non_variant_junctions_data[, list(mean_norm_score_non=mean(norm_score),sd_norm_score_non=sd(norm_score),norm_scores_non=sd(norm_score),total_score_non=sum(score)), + non_variant_junctions_aggr = non_variant_junctions_data[, list(mean_norm_score_non=mean(norm_score),sd_norm_score_non=sd(norm_score),norm_scores_non=list(norm_score),total_score_non=sum(score)), by=list(chrom,start,end,strand,anchor,variant_info,info)] } else { return(data.table()) From 701da4be144827d35ae0ddbfc76441ca05c40b42 Mon Sep 17 00:00:00 2001 From: Yang-Yang Feng Date: Thu, 10 Oct 2019 16:03:04 -0500 Subject: [PATCH 2/2] filter_and_BH --- scripts/filter_and_BH.R | 41 ++++++++++++++++++++++++++++++++++++++++ tests/.DS_Store | Bin 0 -> 6148 bytes 2 files changed, 41 insertions(+) create mode 100644 scripts/filter_and_BH.R create mode 100644 tests/.DS_Store diff --git a/scripts/filter_and_BH.R b/scripts/filter_and_BH.R new file mode 100644 index 0000000..a52680e --- /dev/null +++ b/scripts/filter_and_BH.R @@ -0,0 +1,41 @@ +# filter_and_BH.R +library(data.table) +library(stats) + +debug = F + +if (debug){ + tag = "_default" +} else { + # get options tag + argc = length(commandArgs()) + tag = paste("_", commandArgs(trailingOnly = F)[argc], sep="") + + if ( substr(tag, 2, 3) == "--"){ + stop("Please specify an option tag (e.g. \"default\", \"i20e5\")") + } +} + + +read_file=paste("compare_junctions/hist/", "junction_pvalues", tag, ".tsv", sep="") +regtools_data = unique(data.table::fread(file=read_file, sep = '\t', header = TRUE, stringsAsFactors = FALSE)) +regtools_data_filtered = regtools_data[(regtools_data$total_score_variant > 5 & + regtools_data$pvalue >= 0 & + (regtools_data$anchor == "D" | + regtools_data$anchor == "A" | + regtools_data$anchor == "NDA"))] + +p = regtools_data_filtered$pvalue +adjusted_p = p.adjust(p, method = "BH") +regtools_data_filtered$adjusted_p = adjusted_p +regtools_data_filtered_sorted = regtools_data_filtered[order(adjusted_p)] + +write_file = paste("compare_junctions/hist/", "junction_pvalues_filtered_BH", tag, ".tsv", sep="") +write.table(regtools_data_filtered_sorted, file=write_file, quote=FALSE, sep='\t', row.names = FALSE) + +threshold = 0.05 +is_significant = regtools_data_filtered_sorted$adjusted_p < 0.05 +regtools_data_significant_filtered_sorted = regtools_data_filtered_sorted[is_significant] + +write_file = paste("compare_junctions/hist/", "junction_pvalues_significant_",threshold,"_filtered_BH", tag, ".tsv", sep="") +write.table(regtools_data_significant_filtered_sorted, file=write_file, quote=FALSE, sep='\t', row.names = FALSE) \ No newline at end of file diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5bd4531d4e911f863b4b34e45bd177ec20355f4d GIT binary patch literal 6148 zcmeHKyGjH>5Ukb<4oo&QoF6do4~FCXg8Kmlhu)PhyHgAu&zyM%Pcf^N>rTKIBg%+M^U#H3n{7?yPATh;Z#DKY7=8a}LUwwh2ZZs++e z%3(cGQ3^