Skip to content

Commit 9a97d97

Browse files
committed
update scripts
1 parent 1dd7b9c commit 9a97d97

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

scripts/compare_junctions_hist_v2.R

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
# load libraries
66
library(data.table)
77
library(plyr)
8+
library(tidyverse)
89

910
debug = F
1011

11-
system.time({
12-
if (debug){
13-
tag = paste("_", "default", sep="")
14-
} else {
15-
# get options tag
16-
args = commandArgs(trailingOnly = TRUE)
17-
tag = args[1]
18-
input_file = args[2]
19-
if ( substr(tag, 2, 3) == "--"){
20-
stop("Please specify an option tag (e.g. \"default\", \"i20e5\")")
21-
}
22-
}
23-
24-
# tag = 'I'
25-
# input_file = '~/Desktop/CHOL/all_splicing_variants_I.bed'
12+
# system.time({
13+
# if (debug){
14+
# tag = paste("_", "default", sep="")
15+
# } else {
16+
# # get options tag
17+
# args = commandArgs(trailingOnly = TRUE)
18+
# tag = args[1]
19+
# input_file = args[2]
20+
# if ( substr(tag, 2, 3) == "--"){
21+
# stop("Please specify an option tag (e.g. \"default\", \"i20e5\")")
22+
# }
23+
# }
24+
25+
tag = 'I'
26+
input_file = '~/Desktop/CHOL/all_splicing_variants_I.bed'
2627

2728
# All splicing relevant variants (union of rows from variants.bed files; add column with comma-separated list of sample names)
28-
input_file = args[2]
2929
all_splicing_variants = unique(data.table::fread(input_file), sep = '\t', header = T, stringsAsFactors = FALSE)
3030
colnames(all_splicing_variants) <- c("chrom", "start", "end", "samples")
3131

@@ -214,6 +214,6 @@ all_splicing_variants <- as.data.table(all_splicing_variants)
214214
regtools_data = regtools_data %>% distinct()
215215

216216

217-
write.table(regtools_data, file=paste(input_file, "_out.tsv", sep=""), quote=FALSE, sep='\t', row.names = F)
217+
write.table(regtools_data, file=paste(input_file, "_out_test.tsv", sep=""), quote=FALSE, sep='\t', row.names = F)
218218

219-
})
219+
# })

scripts/stats_wrapper.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,28 @@
1717
tag = args.tag
1818
cwd = os.getcwd()
1919

20-
lines_per_file = 50000
20+
lines_per_file = 1000
2121
smallfile = None
22+
num_small_file = 0
2223
with open(f'all_splicing_variants_{tag}.bed', 'r') as bigfile:
24+
num_small_file +=1
2325
for lineno, line in enumerate(bigfile):
2426
if lineno % lines_per_file == 0:
2527
if smallfile:
2628
smallfile.close()
2729
small_filename = 'small_file_{}.txt'.format(lineno + lines_per_file)
2830
smallfile = open(small_filename, "w")
31+
if num_small_file > 1:
32+
smallfile.write(f'chrom\tstart\tend\tsamples')
2933
smallfile.write(line)
3034
if smallfile:
35+
num_small_file += 1
3136
smallfile.close()
3237
#get chunks
3338
files = glob.glob('small_file_*')
39+
files.sort()
3440
for file in files:
35-
subprocess.run(f'Rscript --vanilla /home/ec2-user/workspace/regtools/scripts/compare_junctions_hist_v2.R {tag} ~{cwd}/{file}', shell=True, check=True)
41+
subprocess.run(f'Rscript --vanilla ~/Git/regtools/scripts/compare_junctions_hist_v2.R {tag} {file}', shell=True, check=False)
3642
output_files = glob.glob("*_out.tsv")
3743
output_files.sort() # glob lacks reliable ordering, so impose your own if output order matters
3844
with open(f'junction_pvalues_{tag}.tsv', 'wb') as outfile:

0 commit comments

Comments
 (0)