-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis_main.py
More file actions
34 lines (27 loc) · 1.56 KB
/
Copy pathanalysis_main.py
File metadata and controls
34 lines (27 loc) · 1.56 KB
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
from fastqc import fastqc
from samfile import analysis
import argparse
import os
def main(indir, outdir, samfile, nthreads, batch=False):
_,_, out= fastqc.fastqc_runner(indir, outdir,batch=batch)
pairEnd = True
totalSeq = fastqc.summaryCollector(os.path.join(outdir,'QC'))
print('received Total Sequences:',str(totalSeq))
paironecount, pairtwocount, pairextracount = analysis.samanalysis(samfile)
sumall = paironecount+pairtwocount+pairextracount
totalSeq = float(totalSeq)
if pairEnd:
#print('asdfadsfad'+str(float(pairtwocount)/float(totalSeq)))
print('Uniquelty mapped '+ str(round(float((pairtwocount)/(totalSeq))*100.0,3))+'%%')
print('Broken '+ str(round(float((paironecount)/totalSeq)*100.0,3))+ '%%' )
print('Multimapped '+ str(round(float(pairextracount/totalSeq)*100.0,3))+ '%%' )
print('Samfile sequences count: ',str(sumall))
#print('paired end borken count',str(paironecount))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="options for running fastqc")
parser.add_argument('-o','--output_dir',dest='outdir',type=str,help='where to write fastqc output')
parser.add_argument('-i','--fastq_dir',dest='indir',type=str,help='directory where fastq files are locate')
parser.add_argument('-s','--samfile',dest='samfile',type=str,help="sam file location")
parser.add_argument('-t','--threads',dest='nthreads',type=int,default=1,help="num files to process simultaneously")
opts = parser.parse_args()
main(opts.indir, opts.outdir, opts.samfile, opts.nthreads)