Entering edit mode
7.2 years ago
Sethzard
▴
20
I'm running blast via biopython and when I run it I get the error:
Error: Too many positional arguments (1), the offending value: alecto[Organism]
The script which seems to be running into trouble is:
command = "blastn -entrez_query Pteropus alecto[Organism] OR Hendra virus[Organism] -db nr -outfmt '6 qseqid sseqid pident' -query sequence.fasta -out sequence.out " + remote_arg
Anyone know where I'm going wrong?
It's complaining about your entrez query ids. What is the rest of your code to run the blast command-line in biopython? Also, I would let everyone know that youre running a remote blast. Could you do this locally? Ideally, you could then run blastn separately, and then parse with biopython, and continue with the rest of your script.
In an ideal world I would be doing this very differently, however this is part of a software development project so I have to run it in biopython. I know that it doesn't like my queries, I just have no idea what's wrong with them.
This is the code we're using. for fasta in glob.glob(os.path.join(data_directory, "*_fixed.fasta")): print "Blast file %s ..." % fasta
I've now fixed it and run into a different problem. It was fixed by adding quotation marks around the organisms. -entrez_query 'Pteropus alecto[Organism] OR Hendra virus[Organism]'
what is your other problem? (1) you can use Biopython to run blastn (2) when removing temporary files at the end, you can
import os
and useos.remove('sequence.fasta')
instead of calling subprocess. (3) and out of curiosity, i'm wondering why you're using csv writer. if the point is to open in excel later, you could write your results tab-delimited (just my preference).writer.write(accession_number, '\t', gene_name, '\t', fpkm_value)