[Biopython-dev] [Bug 2508] NCBIStandalone.blastall: provide support for '-F F' and make it safe

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Jul 9 18:33:42 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2508


mmokrejs at ribosome.natur.cuni.cz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




------- Comment #10 from mmokrejs at ribosome.natur.cuni.cz  2008-07-09 14:33 EST -------
OK, so my old code not yet converted to biopython-1.47 gives me:

    _textframe = blast.blast_and_htmlize(_query_sequence, _usermode,
upload_temp_path, blast_path, uri, _align_view, _matrix)

  File "/home/mmokrejs/public_html/IRES2/blast.py", line 548, in
blast_and_htmlize
    _blast_out, _error_info, _blast_file = blastall(blast_path + targetdb,
query_sequence, upload_temp_path, mode='sequence', align_view=align_view,
matrix=matrix)

  File "/home/mmokrejs/public_html/IRES2/blast.py", line 506, in blastall
    _blast_out, _error_info = NCBIStandalone.blastall('/usr/bin/blastall',
'blastn', blast_db, _blast_file, matrix=matrix + ' -F 0', wordsize=_wordsize,
gap_open=_gap_open, gap_extend=_gap_extend, strands=_strands,
alignments=_alignments, descriptions=_descriptions, expectation=_expectation,
align_view=align_view)

  File "/usr/lib/python2.5/site-packages/Bio/Blast/NCBIStandalone.py", line
1620, in blastall
    _security_check_parameters(keywds)

  File "/usr/lib/python2.5/site-packages/Bio/Blast/NCBIStandalone.py", line
1986, in _security_check_parameters
    if ";" in value or "&&" in value :

TypeError: argument of type 'int' is not iterable

It turns out I am passing in:

{'matrix': 'NUC.4.4 -F 0', 'strands': 3, 'expectation': 100, 'wordsize': 4,
'gap_extend': 1, 'gap_open': 1, 'alignments': 99999, 'descriptions': 9999}


I don't think it makes sense to require users to pass strings instead of
numbers to the function.


While looking into the _security_check_parameters() I think you should also
check for "||" - the logical OR as interpreted by shell and redirections ">"
and "<".



FIX:
-if ";" in value or "&&" in value:
+if ";" in str(value) or "&&" in str(value) or "||" in str(value) or ">" in
str(value) or "<" in str(value):


My apologies that I did not test earlier.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list