Question: Emboss & Python : Suppress Printing Messages To Standard Output
0
gravatar for Ncemami
7.1 years ago by
Ncemami10
CA
Ncemami10 wrote:

I have a Python script running EMBOSS "needle" alignments using the os.system() command, and I find it unnecessary for it to print out:

(a) all error messages e.g.

Error: Sequence is not nucleic

(b) the standard "needle" message e.g.

Needleman-Wunsch global alignment of two sequences

Does anybody have a clean solution suppress these? Thanks in advance for your help.

python biopython output • 3.6k views
ADD COMMENTlink modified 5.5 years ago by Biostar ♦♦ 20 • written 7.1 years ago by Ncemami10
5
gravatar for Neilfws
7.1 years ago by
Neilfws48k
Sydney, Australia
Neilfws48k wrote:

Have you read the documentation? There are some standard switches for all EMBOSS programs including:

General qualifiers:
-auto               boolean    Turn off prompts
-stdout             boolean    Write first file to standard output
-filter             boolean    Read first file from standard input, write
                              first file to standard output
-options            boolean    Prompt for standard and additional values
-debug              boolean    Write debug output to program.dbg
-verbose            boolean    Report some/full command line options
-help               boolean    Report command line options and exit. More
                              information on associated and general
                              qualifiers can be found with -help -verbose
-warning            boolean    Report warnings
-error              boolean    Report errors
-fatal              boolean    Report fatal errors
-die                boolean    Report dying program messages
-version            boolean    Report version number and exit

So in your case, -auto and -options will address issue (b) and some/all of -warning, -error, -fatal and -die will address issue (a).

ADD COMMENTlink written 7.1 years ago by Neilfws48k

Hi newilfws,

Thank you for your suggesstions. I think the error problems were solved, but I am not having luck suppressing the standard output messages described in (b), as they are not exactly prompts. If you have any additional insight into this I would greatly appreciate it.

ADD REPLYlink written 7.1 years ago by Ncemami10

Hi newilfws, Thank you for your suggestions. I think the error problems were solved, but I am not having luck suppressing the standard output messages described in (b), as they are not exactly prompts. If you have any additional insight into this I would greatly appreciate it

ADD REPLYlink written 7.1 years ago by Ncemami10

Have you tried the -auto switch? I just ran needle from the command line using it and the "needle message" is not printed.

ADD REPLYlink written 7.1 years ago by Neilfws48k

My bad, this totally works, I was confusing the invocation syntax with the NeedleCommandline biopython wrapper. Thanks!

ADD REPLYlink written 7.1 years ago by Ncemami10
1
gravatar for Michael Dondrup
7.1 years ago by
Bergen, Norway
Michael Dondrup46k wrote:

Maybe writing your system command like needle -params stuff > /dev/null? Dont't know if that python os.command handles it, but it works in shell.

ADD COMMENTlink written 7.1 years ago by Michael Dondrup46k

Hi Michael, thanks for the suggestion. I did try this initially, along with a couple other permutations ("&> /dev/null", "> nul", etc.) without any success. It seems that the "-auto" switch is successful in suppressing the standard output, though.

ADD REPLYlink written 7.1 years ago by Ncemami10
0
gravatar for Peter
7.1 years ago by
Peter5.8k
Scotland, UK
Peter5.8k wrote:

You could use the NeedleCommandline object in Biopython for building the command line and executing it (It's in the Bio.Emboss.Applications module - see the tutorial http://biopython.org/DIST/docs/tutorial/Tutorial.html for an example).

ADD COMMENTlink written 7.1 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: 1523 users visited in the last hour