I have the following function, which has been working great for months. I have not updated my version of Python (unless it happens behind the scenes?).
def Blast(type, protein_sequence, start, end, genomic_sequence):
result = []
M = re.search('M', protein_sequence)
if M:
query = protein_sequence[M.start():]
temp = open("temp.ORF", "w")
print >>temp, '>blasting'
print >>temp, query
temp.close()
cline = blastp(query="'temp.ORF'", db="DB.blast.txt",
evalue=0.01, outfmt=5, out=type + ".BLAST")
os.system(str(cline))
blast_out = open(type + ".BLAST")
string = str(blast_out.read())
DEF = re.search("<Hit_def>((E|L)\d)</Hit_def>", string)
I receive the error that blast_out=open(type+".BLAST")
cannot find the specified file. This file gets created as part of the output of the program called by the os.system
call. This usually takes ~30s or so to complete. However, When I try to run the program, it instantly gives the error I mention above.
I thought os.system()
was supposed to wait for completion?
Should I force the wait somehow? (I do not want to hard code the wait time).
EDIT: I have ran the cline output in the command line version of the BLAST program. Everything appears to be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With