Back to index

python-biopython  1.60
Public Member Functions
test_NCBI_BLAST_tools.CheckCompleteArgList Class Reference

List of all members.

Public Member Functions

def check
def test_blastx
def test_blastp
def test_blastn
def test_tblastx
def test_tblastn
def test_psiblast
def test_rpsblast
def test_rpstblastn
def test_blast_formatter

Detailed Description

Definition at line 146 of file test_NCBI_BLAST_tools.py.


Member Function Documentation

def test_NCBI_BLAST_tools.CheckCompleteArgList.check (   self,
  exe_name,
  wrapper 
)

Definition at line 147 of file test_NCBI_BLAST_tools.py.

00147 
00148     def check(self, exe_name, wrapper) :
00149         global exe_names
00150         exe = exe_names[exe_name]
00151         cline = wrapper(exe, h=True)
00152 
00153         names = set(parameter.names[0] \
00154                     for parameter in cline.parameters)
00155         
00156         child = subprocess.Popen(str(cline),
00157                                  stdout=subprocess.PIPE,
00158                                  stderr=subprocess.PIPE,
00159                                  universal_newlines=True,
00160                                  shell=(sys.platform!="win32"))
00161         stdoutdata, stderrdata = child.communicate()
00162         self.assertEqual(stderrdata, "",
00163                          "%s\n%s" % (str(cline), stderrdata))
00164         names_in_tool = set()
00165         while stdoutdata :
00166             index = stdoutdata.find("[")
00167             if index == -1 : break
00168             stdoutdata = stdoutdata[index+1:]
00169             index = stdoutdata.find("]")
00170             assert index != -1
00171             name = stdoutdata[:index]
00172             if " " in name : name = name.split(None,1)[0]
00173             names_in_tool.add(name)
00174             stdoutdata = stdoutdata[index+1:]
00175                 
00176         extra = names.difference(names_in_tool)
00177         missing = names_in_tool.difference(names)
00178         if "-soft_masking" in missing :
00179             #Known issue, need to establish how this option works
00180             missing.remove("-soft_masking")
00181         if "-use_index" in missing :
00182             #Known issue, need to establish how this option works
00183             missing.remove("-use_index")
00184         if "-verbose" in missing :
00185             #Known issue, seems to be present in some builds (Bug 3043)
00186             missing.remove("-verbose")
00187         if "-remote_verbose" in missing :
00188             #Known issue, seems to be present in some builds (Bug 3043)
00189             missing.remove("-remote_verbose")
00190         if "-use_test_remote_service" in missing :
00191             #Known issue, seems to be present in some builds (Bug 3043)
00192             missing.remove("-use_test_remote_service")
00193         if exe_name == "blastn" and "-off_diagonal_range" in extra:
00194             #Added in BLAST 2.2.23+
00195             extra.remove("-off_diagonal_range")
00196         if exe_name == "tblastx":
00197             #These appear to have been removed in BLAST 2.2.23+
00198             #(which seems a bit odd - TODO - check with NCBI?)
00199             extra = extra.difference(["-gapextend","-gapopen",
00200                                       "-xdrop_gap","-xdrop_gap_final"])
00201         if exe_name in ["rpsblast", "rpstblastn"]:
00202             #These appear to have been removed in BLAST 2.2.24+
00203             #(which seems a bit odd - TODO - check with NCBI?)
00204             extra = extra.difference(["-num_threads"])
00205         if exe_name in ["tblastn", "tblastx"]:
00206             #These appear to have been removed in BLAST 2.2.24+
00207             extra = extra.difference(["-db_soft_mask"])
00208         #This was added in BLAST 2.2.24+ to most/all the tools, so
00209         #will be seen as an extra argument on older versions:
00210         if "-seqidlist" in extra:
00211             extra.remove("-seqidlist")
00212         if "-db_hard_mask" in extra \
00213         and exe_name in ["blastn", "blastp", "blastx", "tblastx", "tblastn"]:
00214             #New in BLAST 2.2.25+ so will look like an extra arg on old BLAST
00215             extra.remove("-db_hard_mask")
00216         if "-msa_master_idx" in extra and exe_name=="psiblast":
00217             #New in BLAST 2.2.25+ so will look like an extra arg on old BLAST
00218             extra.remove("-msa_master_idx")
00219         if exe_name=="rpsblast":
00220             #New in BLAST 2.2.25+ so will look like an extra arg on old BLAST
00221             extra = extra.difference(["-best_hit_overhang",
00222                                       "-best_hit_score_edge",
00223                                       "-culling_limit"])
00224         if "-max_hsps_per_subject" in extra:
00225             #New in BLAST 2.2.26+ so will look like an extra arg on old BLAST
00226             extra.remove("-max_hsps_per_subject")
00227 
00228         if extra or missing:
00229             import warnings
00230             warnings.warn("NCBI BLAST+ %s and Biopython out sync. Please "
00231                           "update Biopython, or report this issue if you are "
00232                           "already using the latest version. (Exta args: %s; "
00233                           "Missing: %s)" % (exe_name,
00234                           ",".join(sorted(extra)),
00235                           ",".join(sorted(missing))))
00236 
00237         #An almost trivial example to test any validation
00238         if "-query" in names:
00239             cline = wrapper(exe, query="dummy")
00240         elif "-archive" in names:
00241             cline = wrapper(exe, archive="dummy")
00242         str(cline)

Check all blast_formatter arguments are supported

Definition at line 276 of file test_NCBI_BLAST_tools.py.

00276 
00277         def test_blast_formatter(self):
00278             """Check all blast_formatter arguments are supported"""
00279             self.check("blast_formatter", Applications.NcbiblastformatterCommandline)
00280 

Here is the call graph for this function:

Check all blastn arguments are supported

Definition at line 251 of file test_NCBI_BLAST_tools.py.

00251 
00252     def test_blastn(self):
00253         """Check all blastn arguments are supported"""
00254         self.check("blastn", Applications.NcbiblastnCommandline)

Here is the call graph for this function:

Check all blastp arguments are supported

Definition at line 247 of file test_NCBI_BLAST_tools.py.

00247 
00248     def test_blastp(self):
00249         """Check all blastp arguments are supported"""
00250         self.check("blastp", Applications.NcbiblastpCommandline)

Here is the call graph for this function:

Check all blastx arguments are supported

Definition at line 243 of file test_NCBI_BLAST_tools.py.

00243 
00244     def test_blastx(self):
00245         """Check all blastx arguments are supported"""
00246         self.check("blastx", Applications.NcbiblastxCommandline)
        

Here is the call graph for this function:

Check all psiblast arguments are supported

Definition at line 263 of file test_NCBI_BLAST_tools.py.

00263 
00264     def test_psiblast(self):
00265         """Check all psiblast arguments are supported"""
00266         self.check("psiblast", Applications.NcbipsiblastCommandline)

Here is the call graph for this function:

Check all rpsblast arguments are supported

Definition at line 267 of file test_NCBI_BLAST_tools.py.

00267 
00268     def test_rpsblast(self):
00269         """Check all rpsblast arguments are supported"""
00270         self.check("rpsblast", Applications.NcbirpsblastCommandline)

Here is the call graph for this function:

Check all rpstblastn arguments are supported

Definition at line 271 of file test_NCBI_BLAST_tools.py.

00271 
00272     def test_rpstblastn(self):
00273         """Check all rpstblastn arguments are supported"""
00274         self.check("rpstblastn", Applications.NcbirpstblastnCommandline)

Here is the call graph for this function:

Check all tblastn arguments are supported

Definition at line 259 of file test_NCBI_BLAST_tools.py.

00259 
00260     def test_tblastn(self):
00261         """Check all tblastn arguments are supported"""
00262         self.check("tblastn", Applications.NcbitblastnCommandline)
        

Here is the call graph for this function:

Check all tblastx arguments are supported

Definition at line 255 of file test_NCBI_BLAST_tools.py.

00255 
00256     def test_tblastx(self):
00257         """Check all tblastx arguments are supported"""
00258         self.check("tblastx", Applications.NcbitblastxCommandline)
        

Here is the call graph for this function:


The documentation for this class was generated from the following file: