The Biopython Needlecommandline Class Complains About Needle Returning Non-Zero
0
0
Entering edit mode
11.2 years ago
jergosh ▴ 70

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 • 3.8k views
ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

Argh, thanks for pointing that out

ADD REPLY
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2406 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6