Skip to content

Commit 701da4b

Browse files
committed
filter_and_BH
1 parent 5013b73 commit 701da4b

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

scripts/filter_and_BH.R

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# filter_and_BH.R
2+
library(data.table)
3+
library(stats)
4+
5+
debug = F
6+
7+
if (debug){
8+
tag = "_default"
9+
} else {
10+
# get options tag
11+
argc = length(commandArgs())
12+
tag = paste("_", commandArgs(trailingOnly = F)[argc], sep="")
13+
14+
if ( substr(tag, 2, 3) == "--"){
15+
stop("Please specify an option tag (e.g. \"default\", \"i20e5\")")
16+
}
17+
}
18+
19+
20+
read_file=paste("compare_junctions/hist/", "junction_pvalues", tag, ".tsv", sep="")
21+
regtools_data = unique(data.table::fread(file=read_file, sep = '\t', header = TRUE, stringsAsFactors = FALSE))
22+
regtools_data_filtered = regtools_data[(regtools_data$total_score_variant > 5 &
23+
regtools_data$pvalue >= 0 &
24+
(regtools_data$anchor == "D" |
25+
regtools_data$anchor == "A" |
26+
regtools_data$anchor == "NDA"))]
27+
28+
p = regtools_data_filtered$pvalue
29+
adjusted_p = p.adjust(p, method = "BH")
30+
regtools_data_filtered$adjusted_p = adjusted_p
31+
regtools_data_filtered_sorted = regtools_data_filtered[order(adjusted_p)]
32+
33+
write_file = paste("compare_junctions/hist/", "junction_pvalues_filtered_BH", tag, ".tsv", sep="")
34+
write.table(regtools_data_filtered_sorted, file=write_file, quote=FALSE, sep='\t', row.names = FALSE)
35+
36+
threshold = 0.05
37+
is_significant = regtools_data_filtered_sorted$adjusted_p < 0.05
38+
regtools_data_significant_filtered_sorted = regtools_data_filtered_sorted[is_significant]
39+
40+
write_file = paste("compare_junctions/hist/", "junction_pvalues_significant_",threshold,"_filtered_BH", tag, ".tsv", sep="")
41+
write.table(regtools_data_significant_filtered_sorted, file=write_file, quote=FALSE, sep='\t', row.names = FALSE)

tests/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)