Question: The Biopython Needlecommandline Class Complains About Needle Returning Non-Zero
0
gravatar for jergosh
6.2 years ago by
jergosh50
United Kingdom
jergosh50 wrote:

I'm trying to run needle using Biopython's NeedleCommandline. The two input files are tempfile.NamedTemporaryFiles.

 cline = NeedleCommandline(asequence=gene_fasta.name, 
                           bsequence=chain_fasta.name,
                           gapopen=10,
                           gapextend=1,
                           stdout=True)
 stdout, stderr = cline()

This returns "Bio.Application.ApplicationError: Command 'needle -stdout -asequence=/var/folders/zm/jvdqjg5j3kg67_pxlsjc84c40000gn/T/tmpQXYVkP -bsequence=/var/folders/zm/jvdqjg5j3kg67_pxlsjc84c40000gn/T/tmpcVFncj -gapopen=10 -gapextend=1' returned non-zero exit status 1, 'Needleman-Wunsch global alignment of two sequences'"

I tried running the same command by hand (after setting the NamedTemporaryFile(delete=False) in both files) and it runs just fine. I also tried using an output file (with outfile="xxx.needle" in NeedleCommandline) but it still doesn't work.

I also verified the return code when running it manually by 'echo $#' and it is 0.

biopython • 2.4k views
ADD COMMENTlink modified 2.6 years ago by Medhat8.2k • written 6.2 years ago by jergosh50
1

Try to get the return code of the last command by '$?' and not '$#'. The latter is a string length on an empty string, which is always 0.

ADD REPLYlink written 6.2 years ago by Michael Schubert6.9k

Argh, thanks for pointing that out

ADD REPLYlink written 6.2 years ago by jergosh50
1

Could you double check the file handles for the A and B sequences have been closed before calling needle?

ADD REPLYlink written 6.2 years ago by Peter5.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1515 users visited in the last hour