-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplasmidfinder.py
24 lines (20 loc) · 963 Bytes
/
plasmidfinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys, os
from pythonmods import runblastn,blastfilter
database=sys.argv[1] #either enterobacteriaceae or gram_positive
dbpath=sys.argv[2] #plasmidfinder database path, either enterobacteriaceae or gram_positive
threads=sys.argv[3]
outdir=sys.argv[4]
sequenceorigin=sys.argv[5]
sourcedir=sys.argv[6]
if sequenceorigin=='ncbi':
query='%s/accessions_filtered_deduplicated.fa'%outdir
else:
query=sys.argv[7]
#run database search
blastoutput='%s/plasmidfinder/BLASTtable_%s.tsv' %(outdir,database)
runblastn(query, dbpath, blastoutput, num_threads='%s'%threads) #running with default evalue and word size
print('runblastn finshed; database: %s'%database)
finalfile='%s/plasmidfinder/BLASTtablebesthits_%s.tsv'%(outdir,database)
sortedfile='%s/plasmidfinder/BLASTtablesorted_%s.tsv'%(outdir,database)
blastfilter(blastoutput, finalfile, sortedfile, sourcedir, pidthresh=80, coveragethresh=0.60)
print('blastfilter finished; database: %s'%database)