0

This is what I've been trying

def test():
    import sys
    import subprocess
    file1 = open(sys.argv[1],"r") #this is the input to fastacmd
    idx = file1.readlines()
    outname = idx[0].split("\r\n")[0]
    foutname = outname + "_f_output"
    astaseq = subprocess.call(["fastacmd","-i", file1, "-o",foutname])
    blastresult = subprocess.call(["blastp", "-db", "db1.faa", "-query", foutname, "-out", outname])

But I get caught with this, and I can't really make sense of it

File "test.py", line 16, in <module>
    fastacmd_blastp()
  File "test.py", line 11, in test
    fastaseq = subprocess.call(["fastacmd","-i", file1, "-o",fastaoutname])
  File "/usr/local/lib/python2.7/subprocess.py", line 486, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/local/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/usr/local/lib/python2.7/subprocess.py", line 1202, in _execute_child
    raise child_exception
TypeError: execv() arg 2 must contain only strings

Can anyone help? thanks

1
  • Change file1 to idx in that line (or perhaps sys.argv[1]?) Commented Jun 18, 2013 at 10:59

1 Answer 1

2

Guess the input file should be the filename sys.argv[1] and not the python handle to the file. (http://nebc.nerc.ac.uk/bioinformatics/documentation/blast/fastacmd.html)

In other words, change astaseq = subprocess.call(["fastacmd","-i", file1, "-o",foutname]) to astaseq = subprocess.call(["fastacmd","-i", sys.argv[1], "-o",foutname])

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.