-
Notifications
You must be signed in to change notification settings - Fork 0
/
cram_pipeline.py
executable file
·52 lines (37 loc) · 1.44 KB
/
cram_pipeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import argparse
from multiprocessing import Pool
import cram_utils
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--cores", type=str)
parser.add_argument("-i", "--indir", type=str)
parser.add_argument("-s", "--sample", type=str)
parser.add_argument("-l", "--limit", default=False, action="store_true")
args = parser.parse_args()
cores = args.cores
indir = args.indir
sample = args.sample
limit = args.limit
######################################################
cram_utils.cram_fastq_split_by_lines(indir, sample, cores, 4e7)
######################################################
parts = cram_utils.find_sub_fastq_parts(indir, sample)
args = [(indir, sample, part, limit) for part in parts]
pool = Pool(int(cores))
results = pool.starmap(cram_utils.extract_trimmed_fastq_pairs, args)
pool.close()
pool.join()
"""
######################################################
bc_umi_utils.aggregate_dicts(indir,sample,'anchors')
bc_umi_utils.aggregate_dicts(indir,sample,'targets')
bc_umi_utils.aggregate_stat_dicts(indir,sample,'adapter_edits')
######################################################
qc_pdf_file = f'{indir}/{sample}/{sample}_QC.pdf'
if os.path.isfile(qc_pdf_file):
print(qc_pdf_file,' exists, skip')
else:
qc_pdfs = PdfPages(qc_pdf_file)
bc_umi_utils.whitelist_rankplot(indir,sample,'anchors',qc_pdfs,max_anchors)
bc_umi_utils.whitelist_rankplot(indir,sample,'targets',qc_pdfs,max_targets)
qc_pdfs.close()
"""