We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/prog4biol/evop2019/blob/master/EVOP_Python_2019.md/#use-error-code-to-control-pipeline
Use Error Code to Control Pipeline If the error code is good (0) then we can proceed, if the error code is bad (!=0) stop.
#!/usr/bin/env python3 import subprocess import sys blastcmd = "blastx -query test.query -db ~/dbs/uniprot_sprot.fasta -outfmt 7 -out test.blastout.tab -evalue 1e-5" countcmd = 'grep \'hits found\' test.blastout.tab | perl -ne \'m/(\d+)/; $count=$1; print $count,"\n"\'' blastcmd_run = subprocess.run(blastcmd, shell=True , stdout = subprocess.PIPE, stderr=subprocess.PIPE) if blastcmd_run.returncode == 0: # run count cmd if blast exit code is 0 countcmd_run = subprocess.run(countcmd, shell=True , stdout = subprocess.PIPE, stderr=subprocess.PIPE) else: sys.exit("BLAST had issues " + blastcmd_run.stderr.decode('utf-8')) if countcmd_run.returncode == 0: if int(countcmd_run.stdout.decode('utf-8')) > 0: # parse results print("We will put parsing code here") else: sys.exit("no hits") else: sys.exit("count had issues " + countcmd_run.stderr.decode('utf-8'))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/prog4biol/evop2019/blob/master/EVOP_Python_2019.md/#use-error-code-to-control-pipeline
Use Error Code to Control Pipeline
If the error code is good (0) then we can proceed, if the error code is bad (!=0) stop.
The text was updated successfully, but these errors were encountered: