[Biopython-dev] "Features" of Bio.Clustalw (fwd)

Davide Marchignoli davide at biodec.com
Mon Jul 30 19:45:40 EDT 2001


Ops, I forgot the patch.


Bye,
				Davide Marchignoli

-------------- next part --------------
diff -Nacr /usr/src/biopython-300701/Bio/Blast/Record.py Bio/Blast/Record.py
*** /usr/src/biopython-300701/Bio/Blast/Record.py	Mon Jul 30 23:14:13 2001
--- Bio/Blast/Record.py	Tue Jul 31 00:22:22 2001
***************
*** 291,294 ****
          DatabaseReport.__init__(self)
          Parameters.__init__(self)
          self.rounds = []
!         converged = 0
--- 291,294 ----
          DatabaseReport.__init__(self)
          Parameters.__init__(self)
          self.rounds = []
!         self.converged = 0
diff -Nacr /usr/src/biopython-300701/Bio/Clustalw/__init__.py Bio/Clustalw/__init__.py
*** /usr/src/biopython-300701/Bio/Clustalw/__init__.py	Mon Jul 30 23:14:13 2001
--- Bio/Clustalw/__init__.py	Tue Jul 31 00:14:24 2001
***************
*** 62,79 ****
  
      return align_handler.align
  
! def do_alignment(command_line):
      """Perform an alignment with the given command line.
  
      Arguments:
      o command_line - A command line object that can give out
      the command line we will input into clustalw.
      
      Returns:
      o A clustal alignment object corresponding to the created alignment.
      If the alignment type was not a clustal object, None is returned.
      """
-     print "executing %s..." % command_line
      run_clust = os.popen(str(command_line))
      value = run_clust.close()
  
--- 62,81 ----
  
      return align_handler.align
  
! def do_alignment(command_line, alphabet=None):
      """Perform an alignment with the given command line.
  
      Arguments:
      o command_line - A command line object that can give out
      the command line we will input into clustalw.
+     o alphabet - the alphabet to use in the created alignment. If not
+     specified IUPAC.unambiguous_dna and IUPAC.protein will be used for
+     dna and protein alignment respectively.
      
      Returns:
      o A clustal alignment object corresponding to the created alignment.
      If the alignment type was not a clustal object, None is returned.
      """
      run_clust = os.popen(str(command_line))
      value = run_clust.close()
  
***************
*** 107,113 ****
          return None
      # otherwise parse it into a ClustalAlignment object
      else:
!         return parse_file(out_file)
  
  
  class ClustalAlignment(Alignment):
--- 109,118 ----
          return None
      # otherwise parse it into a ClustalAlignment object
      else:
!         if not alphabet:
!             alphabet = (IUPAC.unambiguous_dna, IUPAC.protein)[
!                 command_line.type == 'PROTEIN']
!         return parse_file(out_file, alphabet)
  
  
  class ClustalAlignment(Alignment):
***************
*** 361,366 ****
--- 366,372 ----
  
          # 2. a guide tree to use
          self.guide_tree = None
+         self.new_tree = None
  
          # 3. matrices
          self.protein_matrix = None
***************
*** 369,375 ****
          # 4. type of residues
          self.type = None
  
!     def __repr__(self):
          """Write out the command line as a string."""
          cline = self.command + " " + self.sequence_file
  
--- 375,381 ----
          # 4. type of residues
          self.type = None
  
!     def __str__(self):
          """Write out the command line as a string."""
          cline = self.command + " " + self.sequence_file
  
***************
*** 392,397 ****
--- 398,406 ----
              cline = cline + " -CASE=" + self.change_case
          if self.add_seqnos:
              cline = cline + " -SEQNOS=" + self.add_seqnos
+         if self.new_tree:
+             # clustal does not work if -align is written -ALIGN
+             cline = cline + " -NEWTREE=" + self.new_tree + " -align"
  
          # multiple alignment options
          if self.guide_tree:
***************
*** 478,483 ****
--- 487,497 ----
          else:
              self.guide_tree = tree_file
  
+     def set_new_guide_tree(self, tree_file):
+         """Set the name of the guide tree file generated in the alignment.
+         """
+         self.new_tree = tree_file
+         
      def set_protein_matrix(self, protein_matrix):
          """Set the type of protein matrix to use.
  


More information about the Biopython-dev mailing list