Permalink
Browse files

Merge branch 'master' of github.com:biopython/biopython

  • Loading branch information...
2 parents 9d0ff19 + 6cb359a commit fb4d11505c4fc2b2dfc6845e9432160cb0864f66 mdehoon committed Dec 5, 2012
Showing with 865 additions and 23 deletions.
  1. +1 −0 Bio/Affy/CelFile.py
  2. +3 −0 Bio/Align/AlignInfo.py
  3. +2 −0 Bio/Align/Applications/_ClustalOmega.py
  4. +2 −0 Bio/Align/Applications/_Clustalw.py
  5. +2 −0 Bio/Align/Applications/_Dialign.py
  6. +2 −0 Bio/Align/Applications/_Mafft.py
  7. +2 −0 Bio/Align/Applications/_Muscle.py
  8. +2 −0 Bio/Align/Applications/_Prank.py
  9. +2 −0 Bio/Align/Applications/_Probcons.py
  10. +2 −0 Bio/Align/Applications/_TCoffee.py
  11. +2 −0 Bio/Align/Generic.py
  12. +2 −0 Bio/Align/__init__.py
  13. +2 −0 Bio/AlignIO/ClustalIO.py
  14. +2 −0 Bio/AlignIO/EmbossIO.py
  15. +1 −0 Bio/AlignIO/FastaIO.py
  16. +3 −0 Bio/AlignIO/Interfaces.py
  17. +2 −0 Bio/AlignIO/NexusIO.py
  18. +2 −0 Bio/AlignIO/PhylipIO.py
  19. +3 −0 Bio/AlignIO/StockholmIO.py
  20. +7 −0 Bio/AlignIO/__init__.py
  21. +8 −0 Bio/Alphabet/IUPAC.py
  22. +7 −0 Bio/Alphabet/Reduced.py
  23. +15 −0 Bio/Alphabet/__init__.py
  24. +5 −0 Bio/Application/__init__.py
  25. +4 −0 Bio/Blast/Applications.py
  26. +17 −3 Bio/Blast/NCBIStandalone.py
  27. +2 −0 Bio/Blast/NCBIWWW.py
  28. +4 −1 Bio/Blast/NCBIXML.py
  29. +4 −0 Bio/Blast/ParseBlastTable.py
  30. +10 −0 Bio/Blast/Record.py
  31. +3 −0 Bio/CAPS/__init__.py
  32. +1 −0 Bio/Cluster/__init__.py
  33. +11 −0 Bio/Compass/__init__.py
  34. +6 −0 Bio/Crystal/__init__.py
  35. +7 −0 Bio/Data/CodonTable.py
  36. +1 −0 Bio/Data/IUPACData.py
  37. +13 −0 Bio/DocSQL.py
  38. +5 −0 Bio/Emboss/Applications.py
  39. +2 −0 Bio/Emboss/Primer3.py
  40. +3 −0 Bio/Emboss/PrimerSearch.py
  41. +6 −0 Bio/Entrez/Parser.py
  42. +10 −0 Bio/Entrez/__init__.py
  43. +3 −0 Bio/ExPASy/Enzyme.py
  44. +8 −0 Bio/ExPASy/Prodoc.py
  45. +3 −0 Bio/ExPASy/Prosite.py
  46. +3 −0 Bio/ExPASy/ScanProsite.py
  47. +5 −0 Bio/ExPASy/__init__.py
  48. +4 −0 Bio/FSSP/FSSPTools.py
  49. +5 −0 Bio/FSSP/__init__.py
  50. +1 −0 Bio/FSSP/fssp_rec.py
  51. +2 −0 Bio/File.py
  52. +1 −0 Bio/GA/Crossover/General.py
  53. +2 −0 Bio/GA/Crossover/GeneralPoint.py
  54. +1 −0 Bio/GA/Crossover/Point.py
  55. +1 −0 Bio/GA/Crossover/TwoPoint.py
  56. +1 −0 Bio/GA/Crossover/Uniform.py
  57. +2 −0 Bio/GA/Evolver.py
  58. +1 −0 Bio/GA/Mutation/General.py
  59. +2 −0 Bio/GA/Mutation/Simple.py
  60. +3 −0 Bio/GA/Organism.py
  61. +1 −0 Bio/GA/Repair/Stabilizing.py
  62. +1 −0 Bio/GA/Selection/Abstract.py
  63. +1 −0 Bio/GA/Selection/Diversity.py
  64. +1 −0 Bio/GA/Selection/RouletteWheel.py
  65. +1 −0 Bio/GA/Selection/Tournament.py
  66. +5 −0 Bio/GenBank/Record.py
  67. +12 −0 Bio/GenBank/__init__.py
  68. +2 −0 Bio/GenBank/utils.py
  69. +2 −0 Bio/Geo/Record.py
  70. +7 −0 Bio/Graphics/BasicChromosome.py
  71. +3 −0 Bio/Graphics/ColorSpiral.py
  72. +1 −0 Bio/Graphics/Comparative.py
  73. +1 −0 Bio/Graphics/DisplayRepresentation.py
  74. +3 −0 Bio/Graphics/Distribution.py
  75. +7 −0 Bio/Graphics/GenomeDiagram/_AbstractDrawer.py
  76. +1 −0 Bio/Graphics/GenomeDiagram/_CircularDrawer.py
  77. +1 −0 Bio/Graphics/GenomeDiagram/_Colors.py
  78. +1 −0 Bio/Graphics/GenomeDiagram/_CrossLink.py
  79. +1 −0 Bio/Graphics/GenomeDiagram/_Diagram.py
  80. +1 −0 Bio/Graphics/GenomeDiagram/_Feature.py
  81. +1 −0 Bio/Graphics/GenomeDiagram/_FeatureSet.py
  82. +1 −0 Bio/Graphics/GenomeDiagram/_Graph.py
  83. +1 −0 Bio/Graphics/GenomeDiagram/_GraphSet.py
  84. +1 −0 Bio/Graphics/GenomeDiagram/_LinearDrawer.py
  85. +1 −0 Bio/Graphics/GenomeDiagram/_Track.py
  86. +1 −0 Bio/Graphics/__init__.py
  87. +3 −0 Bio/HMM/DynamicProgramming.py
  88. +6 −0 Bio/HMM/MarkovModel.py
  89. +4 −0 Bio/HMM/Trainer.py
  90. +1 −0 Bio/HMM/Utilities.py
  91. +2 −0 Bio/HotRand.py
  92. +2 −0 Bio/Index.py
  93. +4 −0 Bio/KDTree/KDTree.py
  94. +2 −0 Bio/KEGG/Compound/__init__.py
  95. +2 −0 Bio/KEGG/Enzyme/__init__.py
  96. +1 −0 Bio/KEGG/__init__.py
  97. +4 −0 Bio/LogisticRegression.py
  98. +23 −0 Bio/MarkovModel.py
  99. +10 −0 Bio/MaxEntropy.py
  100. +2 −0 Bio/Medline/__init__.py
  101. +1 −0 Bio/Motif/Applications/_XXmotif.py
  102. +1 −0 Bio/Motif/Jaspar.py
  103. +1 −0 Bio/Motif/MAST.py
  104. +1 −0 Bio/Motif/MEME.py
  105. +1 −0 Bio/Motif/Parsers/MAST.py
  106. +1 −0 Bio/Motif/Parsers/MEME.py
  107. +2 −0 Bio/Motif/TRANSFAC.py
  108. +1 −0 Bio/Motif/Thresholds.py
  109. +1 −0 Bio/Motif/_Motif.py
  110. +3 −0 Bio/Motif/__init__.py
  111. +2 −0 Bio/NMR/NOEtools.py
  112. +7 −0 Bio/NMR/xpktools.py
  113. +5 −0 Bio/NaiveBayes.py
  114. +5 −0 Bio/NeuralNetwork/BackPropagation/Layer.py
  115. +1 −0 Bio/NeuralNetwork/BackPropagation/Network.py
  116. +2 −0 Bio/NeuralNetwork/Gene/Motif.py
  117. +2 −0 Bio/NeuralNetwork/Gene/Pattern.py
  118. +11 −0 Bio/NeuralNetwork/Gene/Schema.py
  119. +2 −0 Bio/NeuralNetwork/Gene/Signature.py
  120. +1 −0 Bio/NeuralNetwork/StopTraining.py
  121. +2 −0 Bio/NeuralNetwork/Training.py
  122. +18 −0 Bio/Nexus/Nexus.py
  123. +4 −0 Bio/Nexus/Nodes.py
  124. +3 −0 Bio/Nexus/Trees.py
  125. +1 −0 Bio/PDB/Atom.py
  126. +1 −0 Bio/PDB/Entity.py
  127. +4 −0 Bio/PDB/NACCESS.py
  128. +3 −0 Bio/PDB/PDBExceptions.py
  129. +4 −0 Bio/PDB/PSEA.py
  130. +8 −0 Bio/PDB/Polypeptide.py
  131. +4 −0 Bio/PDB/ResidueDepth.py
  132. +5 −0 Bio/PDB/Vector.py
  133. +7 −0 Bio/PDB/parse_pdb_header.py
  134. +12 −0 Bio/ParserSupport.py
  135. +1 −0 Bio/Pathway/Rep/Graph.py
  136. +1 −0 Bio/Pathway/Rep/HashSet.py
  137. +3 −0 Bio/Pathway/Rep/MultiGraph.py
  138. +8 −0 Bio/Phylo/BaseTree.py
  139. +1 −0 Bio/Phylo/NewickIO.py
  140. +1 −0 Bio/Phylo/NexusIO.py
  141. +2 −0 Bio/Phylo/PAML/_paml.py
  142. +6 −0 Bio/Phylo/PAML/_parse_baseml.py
  143. +9 −0 Bio/Phylo/PAML/_parse_codeml.py
  144. +3 −0 Bio/Phylo/PAML/_parse_yn00.py
  145. +3 −0 Bio/Phylo/PAML/baseml.py
  146. +3 −0 Bio/Phylo/PAML/chi2.py
  147. +3 −0 Bio/Phylo/PAML/codeml.py
  148. +3 −0 Bio/Phylo/PAML/yn00.py
  149. +24 −9 Bio/Phylo/PhyloXMLIO.py
  150. +1 −0 Bio/PopGen/Async/Local.py
  151. +2 −0 Bio/PopGen/Async/__init__.py
  152. +2 −0 Bio/PopGen/FDist/Async.py
  153. +2 −0 Bio/PopGen/FDist/Controller.py
  154. +3 −0 Bio/PopGen/FDist/Utils.py
  155. +1 −0 Bio/PopGen/FDist/__init__.py
  156. +10 −0 Bio/PopGen/GenePop/Controller.py
  157. +1 −0 Bio/PopGen/GenePop/FileParser.py
  158. +2 −0 Bio/PopGen/GenePop/LargeFileParser.py
  159. +1 −0 Bio/PopGen/GenePop/__init__.py
  160. +1 −0 Bio/PopGen/SimCoal/Async.py
  161. +1 −0 Bio/PopGen/SimCoal/Cache.py
  162. +1 −0 Bio/PopGen/SimCoal/Controller.py
  163. +14 −0 Bio/PopGen/SimCoal/Template.py
  164. +1 −0 Bio/Restriction/PrintFormat.py
  165. +3 −0 Bio/Restriction/Restriction.py
  166. +6 −0 Bio/Restriction/_Update/RestrictionCompiler.py
  167. +1 −0 Bio/Restriction/_Update/Update.py
  168. +1 −1 Bio/SCOP/Dom.py
  169. +2 −0 Bio/SCOP/Raf.py
  170. +1 −0 Bio/SCOP/Residues.py
  171. +7 −0 Bio/SCOP/__init__.py
  172. +1 −0 Bio/SVDSuperimposer/SVDSuperimposer.py
  173. +6 −0 Bio/Search.py
  174. +2 −0 Bio/SearchIO/BlastIO/blast_tab.py
  175. +14 −3 Bio/SearchIO/BlastIO/blast_xml.py
  176. +1 −0 Bio/SearchIO/ExonerateIO/_base.py
  177. +1 −0 Bio/SearchIO/_index.py
  178. +10 −0 Bio/Seq.py
  179. +12 −0 Bio/SeqFeature.py
  180. +2 −0 Bio/SeqIO/FastaIO.py
  181. +6 −3 Bio/SeqIO/UniprotIO.py
  182. +1 −0 Bio/SeqIO/_index.py
  183. +2 −0 Bio/SeqRecord.py
  184. +4 −0 Bio/SeqUtils/CheckSum.py
  185. +1 −0 Bio/SeqUtils/IsoelectricPoint.py
  186. +2 −0 Bio/SeqUtils/MeltingTemp.py
  187. +6 −0 Bio/SeqUtils/__init__.py
  188. +2 −0 Bio/SeqUtils/lcc.py
  189. +12 −0 Bio/Sequencing/Ace.py
  190. +2 −0 Bio/Sequencing/Applications/_Novoalign.py
  191. +2 −0 Bio/Sequencing/Phd.py
  192. +2 −0 Bio/Statistics/lowess.py
  193. +4 −0 Bio/SubsMat/FreqTable.py
  194. +4 −0 Bio/SubsMat/MatrixInfo.py
  195. +14 −0 Bio/SubsMat/__init__.py
  196. +1 −0 Bio/SwissProt/KeyWList.py
  197. +2 −0 Bio/SwissProt/__init__.py
  198. +11 −0 Bio/TogoWS/__init__.py
  199. +1 −0 Bio/UniGene/__init__.py
  200. +4 −0 Bio/Wise/__init__.py
  201. +11 −0 Bio/Wise/dnal.py
  202. +10 −0 Bio/Wise/psw.py
  203. +6 −0 Bio/__init__.py
  204. +1 −0 Bio/_py3k/_ordereddict.py
  205. +3 −0 Bio/bgzf.py
  206. +5 −0 Bio/kNN.py
  207. +20 −0 Bio/pairwise2.py
  208. +4 −0 Bio/triefind.py
  209. +11 −0 BioSQL/BioSeq.py
  210. +4 −0 BioSQL/BioSeqDatabase.py
  211. +2 −0 BioSQL/DBUtils.py
  212. +2 −0 BioSQL/Loader.py
  213. +4 −3 Doc/Tutorial.tex
  214. +1 −0 Doc/examples/Proux_et_al_2002_Figure_6.py
  215. +2 −0 Doc/examples/fasta_dictionary.py
  216. +2 −0 Doc/examples/fasta_iterator.py
  217. +2 −0 Doc/examples/getgene.py
  218. +2 −0 Scripts/GenBank/check_output.py
  219. +4 −0 Scripts/debug/debug_blast_parser.py
  220. +1 −0 Scripts/query_pubmed.py
  221. +2 −0 Scripts/scop_pdb.py
  222. +3 −0 Scripts/xbbtools/nextorf.py
  223. +1 −0 Scripts/xbbtools/xbb_blast.py
  224. +1 −0 Scripts/xbbtools/xbb_blastbg.py
  225. +1 −0 Scripts/xbbtools/xbb_help.py
  226. +1 −0 Scripts/xbbtools/xbb_search.py
  227. +1 −0 Scripts/xbbtools/xbb_translations.py
  228. +1 −0 Scripts/xbbtools/xbb_utils.py
View
1 Bio/Affy/CelFile.py
@@ -15,6 +15,7 @@
import numpy
+
class Record(object):
"""
Stores the information in a cel file
View
3 Bio/Align/AlignInfo.py
@@ -23,6 +23,8 @@
# for 4-letter nucleotide alphabets
Protein20Random = 0.05
Nucleotide4Random = 0.25
+
+
class SummaryInfo(object):
"""Calculate summary info about the alignment.
@@ -599,6 +601,7 @@ def _get_column_info_content(self, obs_freq, e_freq_table, log_base,
def get_column(self,col):
return self.alignment.get_column(col)
+
class PSSM(object):
"""Represent a position specific score matrix.
View
2 Bio/Align/Applications/_ClustalOmega.py
@@ -13,6 +13,7 @@
from Bio.Application import _Option, _Switch, AbstractCommandline
+
class ClustalOmegaCommandline(AbstractCommandline):
"""Command line wrapper for clustal omega
@@ -173,6 +174,7 @@ def __init__(self, cmd="clustalo", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running ClustalOmega doctests..."
View
2 Bio/Align/Applications/_Clustalw.py
@@ -10,6 +10,7 @@
import os
from Bio.Application import _Option, _Switch, AbstractCommandline
+
class ClustalwCommandline(AbstractCommandline):
"""Command line wrapper for clustalw (version one or two).
@@ -324,6 +325,7 @@ def __init__(self, cmd="clustalw", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running ClustalW doctests..."
View
2 Bio/Align/Applications/_Dialign.py
@@ -9,6 +9,7 @@
from Bio.Application import _Option, _Argument, _Switch, AbstractCommandline
+
class DialignCommandline(AbstractCommandline):
"""Command line wrapper for the multiple alignment program DIALIGN2-2.
@@ -178,6 +179,7 @@ def __init__(self, cmd="dialign2-2", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running modules doctests..."
View
2 Bio/Align/Applications/_Mafft.py
@@ -10,6 +10,7 @@
import os
from Bio.Application import _Option, _Switch, _Argument, AbstractCommandline
+
class MafftCommandline(AbstractCommandline):
"""Command line wrapper for the multiple alignment program MAFFT.
@@ -346,6 +347,7 @@ def __init__(self, cmd="mafft", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE).
View
2 Bio/Align/Applications/_Muscle.py
@@ -9,6 +9,7 @@
from Bio.Application import _Option, _Switch, AbstractCommandline
+
class MuscleCommandline(AbstractCommandline):
r"""Command line wrapper for the multiple alignment program MUSCLE.
@@ -463,6 +464,7 @@ def __init__(self, cmd="muscle", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running MUSCLE doctests..."
View
2 Bio/Align/Applications/_Prank.py
@@ -9,6 +9,7 @@
from Bio.Application import _Option, _Switch, AbstractCommandline
+
class PrankCommandline(AbstractCommandline):
"""Command line wrapper for the multiple alignment program PRANK.
@@ -195,6 +196,7 @@ def __init__(self, cmd="prank", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running modules doctests..."
View
2 Bio/Align/Applications/_Probcons.py
@@ -9,6 +9,7 @@
from Bio.Application import _Option, _Switch, _Argument, AbstractCommandline
+
class ProbconsCommandline(AbstractCommandline):
"""Command line wrapper for the multiple alignment program PROBCONS.
@@ -107,6 +108,7 @@ def __init__(self, cmd="probcons", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running modules doctests..."
View
2 Bio/Align/Applications/_TCoffee.py
@@ -9,6 +9,7 @@
from Bio.Application import _Option, _Switch, AbstractCommandline
+
class TCoffeeCommandline(AbstractCommandline):
"""Commandline object for the TCoffee alignment program.
@@ -98,6 +99,7 @@ def __init__(self, cmd="t_coffee", **kwargs):
]
AbstractCommandline.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the module's doctests (PRIVATE)."""
print "Running modules doctests..."
View
2 Bio/Align/Generic.py
@@ -19,6 +19,7 @@
from Bio.SeqRecord import SeqRecord
from Bio import Alphabet
+
class Alignment(object):
"""Represent a set of alignments (DEPRECATED).
@@ -426,6 +427,7 @@ def __getitem__(self, index):
else:
raise TypeError("Invalid index type.")
+
def _test():
"""Run the Bio.Align.Generic module's doctests."""
print "Running doctests..."
View
2 Bio/Align/__init__.py
@@ -17,6 +17,8 @@
#We only import this and subclass it for some limited backward compatibilty.
from Bio.Align.Generic import Alignment as _Alignment
+
+
class MultipleSeqAlignment(_Alignment):
"""Represents a classical multiple sequence alignment (MSA).
View
2 Bio/AlignIO/ClustalIO.py
@@ -15,6 +15,7 @@
from Bio.Align import MultipleSeqAlignment
from Interfaces import AlignmentIterator, SequentialAlignmentWriter
+
class ClustalWriter(SequentialAlignmentWriter):
"""Clustalw alignment writer."""
def write_alignment(self, alignment):
@@ -78,6 +79,7 @@ def write_alignment(self, alignment):
# Want a trailing blank new line in case the output is concatenated
self.handle.write(output + "\n")
+
class ClustalIterator(AlignmentIterator):
"""Clustalw alignment iterator."""
View
2 Bio/AlignIO/EmbossIO.py
@@ -18,6 +18,7 @@
from Bio.Align import MultipleSeqAlignment
from Interfaces import AlignmentIterator, SequentialAlignmentWriter
+
class EmbossWriter(SequentialAlignmentWriter):
"""Emboss alignment writer (WORK IN PROGRESS).
@@ -57,6 +58,7 @@ def write_alignment(self, alignment):
#...
assert False
+
class EmbossIterator(AlignmentIterator):
"""Emboss alignment iterator.
View
1 Bio/AlignIO/FastaIO.py
@@ -59,6 +59,7 @@ def _extract_alignment_region(alignment_seq_with_flanking, annotation):
% (alignment_seq_with_flanking, start, end, annotation)
return align_stripped[start:end]
+
def FastaM10Iterator(handle, alphabet = single_letter_alphabet):
"""Alignment iterator for the FASTA tool's pairwise alignment output.
View
3 Bio/AlignIO/Interfaces.py
@@ -11,6 +11,7 @@
from Bio.Alphabet import single_letter_alphabet
+
class AlignmentIterator(object):
"""Base class for building MultipleSeqAlignment iterators.
@@ -68,6 +69,7 @@ def __iter__(self):
myFile.close()"""
return iter(self.next, None)
+
class AlignmentWriter(object):
"""Base class for building MultipleSeqAlignment writers.
@@ -96,6 +98,7 @@ def clean(self, text):
"""Use this to avoid getting newlines in the output."""
return text.replace("\n", " ").replace("\r", " ").replace(" ", " ")
+
class SequentialAlignmentWriter(AlignmentWriter):
"""Base class for building MultipleSeqAlignment writers.
View
2 Bio/AlignIO/NexusIO.py
@@ -23,6 +23,7 @@
#You can get a couple of example files here:
#http://www.molecularevolution.org/resources/fileformats/
+
#This is a generator function!
def NexusIterator(handle, seq_count=None):
"""Returns SeqRecord objects from a Nexus file.
@@ -56,6 +57,7 @@ def NexusIterator(handle, seq_count=None):
#All done
yield MultipleSeqAlignment(records, n.alphabet)
+
class NexusWriter(AlignmentWriter):
"""Nexus alignment writer.
View
2 Bio/AlignIO/PhylipIO.py
@@ -139,6 +139,7 @@ def write_alignment(self, alignment, id_width=_PHYLIP_ID_WIDTH):
break
handle.write("\n")
+
class PhylipIterator(AlignmentIterator):
"""Reads a Phylip alignment file returning a MultipleSeqAlignment iterator.
@@ -257,6 +258,7 @@ def next(self):
for (i,s) in zip(ids, seqs))
return MultipleSeqAlignment(records, self.alphabet)
+
# Relaxed Phylip
class RelaxedPhylipWriter(PhylipWriter):
"""
View
3 Bio/AlignIO/StockholmIO.py
@@ -135,6 +135,7 @@
from Bio.Align import MultipleSeqAlignment
from Interfaces import AlignmentIterator, SequentialAlignmentWriter
+
class StockholmWriter(SequentialAlignmentWriter):
"""Stockholm/PFAM alignment writer."""
@@ -264,6 +265,7 @@ def _write_record(self, record):
#this data anyway?
pass
+
class StockholmIterator(AlignmentIterator):
"""Loads a Stockholm file from PFAM into MultipleSeqAlignment objects.
@@ -531,6 +533,7 @@ def _populate_meta_data(self, identifier, record):
#Ignore it?
record.letter_annotations["GR:" + feature] = seq_col_data[feature]
+
def _test():
"""Run the Bio.SeqIO module's doctests.
View
7 Bio/AlignIO/__init__.py
@@ -175,6 +175,7 @@
"clustal" : ClustalIO.ClustalWriter,
}
+
def write(alignments, handle, format):
"""Write complete set of alignments to a file.
@@ -231,6 +232,7 @@ def write(alignments, handle, format):
return count
+
#This is a generator function!
def _SeqIO_to_alignment_iterator(handle, format, alphabet=None, seq_count=None):
"""Uses Bio.SeqIO to create an MultipleSeqAlignment iterator (PRIVATE).
@@ -270,6 +272,7 @@ def _SeqIO_to_alignment_iterator(handle, format, alphabet=None, seq_count=None):
yield MultipleSeqAlignment(records, alphabet)
raise StopIteration
+
def _force_alphabet(alignment_iterator, alphabet):
"""Iterate over alignments, over-riding the alphabet (PRIVATE)."""
#Assume the alphabet argument has been pre-validated
@@ -290,6 +293,7 @@ def _force_alphabet(alignment_iterator, alphabet):
align._alphabet = alphabet
yield align
+
def parse(handle, format, seq_count=None, alphabet=None):
"""Iterate over an alignment file as MultipleSeqAlignment objects.
@@ -366,6 +370,7 @@ def parse(handle, format, seq_count=None, alphabet=None):
for a in i:
yield a
+
def read(handle, format, seq_count=None, alphabet=None):
"""Turns an alignment file into a single MultipleSeqAlignment object.
@@ -430,6 +435,7 @@ def read(handle, format, seq_count=None, alphabet=None):
assert len(first)==seq_count
return first
+
def convert(in_file, in_format, out_file, out_format, alphabet=None):
"""Convert between two alignment files, returns number of alignments.
@@ -456,6 +462,7 @@ def convert(in_file, in_format, out_file, out_format, alphabet=None):
return count
+
def _test():
"""Run the Bio.AlignIO module's doctests.
View
8 Bio/Alphabet/IUPAC.py
@@ -16,6 +16,8 @@
# http://www.chem.qmw.ac.uk/iupac/AminoAcid/A2021.html#AA21
assert IUPACData.extended_protein_letters == IUPACData.extended_protein_letters.upper()
+
+
class ExtendedIUPACProtein(Alphabet.ProteinAlphabet):
"""Extended uppercase IUPAC protein single letter alphabet including X etc.
@@ -36,6 +38,8 @@ class ExtendedIUPACProtein(Alphabet.ProteinAlphabet):
extended_protein = ExtendedIUPACProtein()
assert IUPACData.protein_letters == IUPACData.protein_letters.upper()
+
+
class IUPACProtein(ExtendedIUPACProtein):
"""Uppercase IUPAC protein single letter alphabet of the 20 standard amino acids."""
letters = IUPACData.protein_letters
@@ -44,6 +48,7 @@ class IUPACProtein(ExtendedIUPACProtein):
##################### DNA
+
# The next two are the IUPAC definitions, from:
# http://www.chem.qmw.ac.uk/iubmb/misc/naseq.html
class IUPACAmbiguousDNA(Alphabet.DNAAlphabet):
@@ -52,6 +57,7 @@ class IUPACAmbiguousDNA(Alphabet.DNAAlphabet):
ambiguous_dna = IUPACAmbiguousDNA()
+
class IUPACUnambiguousDNA(IUPACAmbiguousDNA):
"""Uppercase IUPAC unambiguous DNA (letters GATC only)."""
letters = IUPACData.unambiguous_dna_letters
@@ -76,12 +82,14 @@ class ExtendedIUPACDNA(Alphabet.DNAAlphabet):
##################### RNA
+
class IUPACAmbiguousRNA(Alphabet.RNAAlphabet):
"""Uppercase IUPAC ambiguous RNA."""
letters = IUPACData.ambiguous_rna_letters
ambiguous_rna = IUPACAmbiguousRNA()
+
class IUPACUnambiguousRNA(IUPACAmbiguousRNA):
"""Uppercase IUPAC unambiguous RNA (letters GAUC only)."""
letters = IUPACData.unambiguous_rna_letters
View
7 Bio/Alphabet/Reduced.py
@@ -49,6 +49,7 @@
"R": "K",
"H": "H"}
+
class Murphy15(Alphabet.ProteinAlphabet):
letters = "LCAGSTPFWEDNQKH"
size = 15
@@ -74,6 +75,8 @@ class Murphy15(Alphabet.ProteinAlphabet):
"K": "K",
"R": "K",
"H": "H"}
+
+
class Murphy10(Alphabet.ProteinAlphabet):
letters = "LCAGSPFEKH"
size = 10
@@ -100,6 +103,7 @@ class Murphy10(Alphabet.ProteinAlphabet):
"R": "K",
"H": "H"}
+
class Murphy8(Alphabet.ProteinAlphabet):
letters = "LASPFEKH"
size = 8
@@ -126,6 +130,7 @@ class Murphy8(Alphabet.ProteinAlphabet):
"R": "E",
"H": "E"}
+
class Murphy4(Alphabet.ProteinAlphabet):
letters = "LAFE"
size = 4
@@ -152,6 +157,7 @@ class Murphy4(Alphabet.ProteinAlphabet):
"W": "H",
"Y": "H"}
+
class HPModel(Alphabet.ProteinAlphabet):
letters = "HP"
size = 2
@@ -178,6 +184,7 @@ class HPModel(Alphabet.ProteinAlphabet):
"N": "D",
"P": "D"}
+
class PC5(Alphabet.ProteinAlphabet):
letters = "ARCTD"
size = 5
View
15 Bio/Alphabet/__init__.py
@@ -10,6 +10,7 @@
This is used by sequences which contain a finite number of similar words.
"""
+
class Alphabet(object):
size = None # default to no fixed size for words
letters = None # default to no fixed alphabet
@@ -66,6 +67,7 @@ def _lower(self):
generic_alphabet = Alphabet()
+
class SingleLetterAlphabet(Alphabet):
size = 1
letters = None # string of all letters in the alphabet
@@ -74,17 +76,21 @@ class SingleLetterAlphabet(Alphabet):
########### Protein
+
class ProteinAlphabet(SingleLetterAlphabet):
pass
generic_protein = ProteinAlphabet()
########### DNA
+
+
class NucleotideAlphabet(SingleLetterAlphabet):
pass
generic_nucleotide = NucleotideAlphabet()
+
class DNAAlphabet(NucleotideAlphabet):
pass
@@ -93,16 +99,19 @@ class DNAAlphabet(NucleotideAlphabet):
########### RNA
+
class RNAAlphabet(NucleotideAlphabet):
pass
generic_rna = RNAAlphabet()
########### Other per-sequence encodings
+
class SecondaryStructure(SingleLetterAlphabet):
letters = "HSTC"
+
class ThreeLetterProtein(Alphabet):
size = 3
letters = [
@@ -115,6 +124,7 @@ class ThreeLetterProtein(Alphabet):
# (These are Decorator classes)
+
class AlphabetEncoder(object):
def __init__(self, alphabet, new_letters):
self.alphabet = alphabet
@@ -212,6 +222,7 @@ def _get_base_alphabet(alphabet):
"Invalid alphabet found, %s" % repr(a)
return a
+
def _ungap(alphabet):
"""Returns the alphabet without any gap encoder (PRIVATE)."""
#TODO - Handle via method of the objects?
@@ -226,6 +237,7 @@ def _ungap(alphabet):
else:
raise NotImplementedError
+
def _consensus_base_alphabet(alphabets):
"""Returns a common but often generic base alphabet object (PRIVATE).
@@ -260,6 +272,7 @@ def _consensus_base_alphabet(alphabets):
return generic_alphabet
return common
+
def _consensus_alphabet(alphabets):
"""Returns a common but often generic alphabet object (PRIVATE).
@@ -336,6 +349,7 @@ def _consensus_alphabet(alphabets):
alpha = HasStopCodon(alpha, stop_symbol=stop)
return alpha
+
def _check_type_compatible(alphabets):
"""Returns True except for DNA+RNA or Nucleotide+Protein (PRIVATE).
@@ -373,6 +387,7 @@ def _check_type_compatible(alphabets):
return False
return True
+
def _verify_alphabet(sequence):
"""Check all letters in sequence are in the alphabet (PRIVATE).
View
5 Bio/Application/__init__.py
@@ -456,6 +456,7 @@ def __init__(self):
def __str__(self):
raise NotImplementedError
+
class _Option(_AbstractParameter):
"""Represent an option that can be set for a program.
@@ -527,6 +528,7 @@ def __str__(self):
else:
return "%s %s " % (self.names[0], v)
+
class _Switch(_AbstractParameter):
"""Represent an optional argument switch for a program.
@@ -564,6 +566,7 @@ def __str__(self):
else:
return ""
+
class _Argument(_AbstractParameter):
"""Represent an argument on a commandline.
"""
@@ -587,6 +590,7 @@ def __str__(self):
else:
return "%s " % self.value
+
def _escape_filename(filename):
"""Escape filenames with spaces by adding quotes (PRIVATE).
@@ -619,6 +623,7 @@ def _escape_filename(filename):
else:
return '"%s"' % filename
+
def _test():
"""Run the Bio.Application module's doctests."""
import doctest
View
4 Bio/Blast/Applications.py
@@ -34,6 +34,7 @@
"""
from Bio.Application import _Option, AbstractCommandline, _Switch
+
class FastacmdCommandline(AbstractCommandline):
"""Create a commandline for the fasta program from NCBI (OBSOLETE).
@@ -422,6 +423,7 @@ def __init__(self, cmd="rpsblast",**kwargs):
# Legacy BLAST wrappers above, (new) BLAST+ wrappers below
##############################################################################
+
class _NcbibaseblastCommandline(AbstractCommandline):
"""Base Commandline object for (new) NCBI BLAST+ wrappers (PRIVATE).
@@ -740,6 +742,7 @@ def _validate(self):
self._validate_incompatibilities(incompatibles)
_Ncbiblast2SeqCommandline._validate(self)
+
class NcbiblastpCommandline(_NcbiblastMain2SeqCommandline):
"""Create a commandline for the NCBI BLAST+ program blastp (for proteins).
@@ -1399,6 +1402,7 @@ def _validate(self):
self._validate_incompatibilities(incompatibles)
_NcbibaseblastCommandline._validate(self)
+
def _test():
"""Run the Bio.Blast.Applications module's doctests."""
import doctest
View
20 Bio/Blast/NCBIStandalone.py
@@ -61,6 +61,7 @@
from Bio.Blast import Record
from Bio.Application import _escape_filename
+
class LowQualityBlastError(Exception):
"""Error caused by running a low quality sequence through BLAST.
@@ -72,6 +73,7 @@ class LowQualityBlastError(Exception):
"""
pass
+
class ShortQueryBlastError(Exception):
"""Error caused by running a short query sequence through BLAST.
@@ -231,9 +233,7 @@ def _scan_header(self, uhandle, consumer):
read_and_call_until(uhandle, consumer.query_info, start='Length=')
while True:
line = uhandle.peekline()
- if not line.strip():
- break
- if "Score E" in line:
+ if not line.strip() or "Score E" in line:
break
#It is more of the query (and its length)
read_and_call(uhandle, consumer.query_info)
@@ -817,6 +817,7 @@ def _scan_parameters(self, uhandle, consumer):
consumer.end_parameters()
+
class BlastParser(AbstractParser):
"""Parses BLAST data into a Record.Blast object.
@@ -831,6 +832,7 @@ def parse(self, handle):
self._scanner.feed(handle, self._consumer)
return self._consumer.data
+
class PSIBlastParser(AbstractParser):
"""Parses BLAST data into a Record.PSIBlast object.
@@ -845,6 +847,7 @@ def parse(self, handle):
self._scanner.feed(handle, self._consumer)
return self._consumer.data
+
class _HeaderConsumer(object):
def start_header(self):
self._header = Record.Header()
@@ -901,6 +904,7 @@ def end_header(self):
self._header.reference = self._header.reference.rstrip()
self._header.query = self._header.query.rstrip()
+
class _DescriptionConsumer(object):
def start_descriptions(self):
self._descriptions = []
@@ -980,6 +984,7 @@ def _parse(self, description_line):
dh.e = _safe_float(dh.e)
return dh
+
class _AlignmentConsumer(object):
# This is a little bit tricky. An alignment can either be a
# pairwise alignment or a multiple alignment. Since it's difficult
@@ -1144,6 +1149,7 @@ def end_alignment(self):
except AttributeError:
pass
+
class _HSPConsumer(object):
def start_hsp(self):
self._hsp = Record.HSP()
@@ -1271,6 +1277,7 @@ def sbjct(self, line):
def end_hsp(self):
pass
+
class _DatabaseReportConsumer(object):
def start_database_report(self):
@@ -1314,6 +1321,7 @@ def ka_params_gap(self, line):
def end_database_report(self):
pass
+
class _ParametersConsumer(object):
def start_parameters(self):
self._params = Record.Parameters()
@@ -1544,6 +1552,7 @@ def end_parameters(self):
_ParametersConsumer.end_parameters(self)
self.data.__dict__.update(self._params.__dict__)
+
class _PSIBlastConsumer(AbstractConsumer,
_HeaderConsumer,
_DescriptionConsumer,
@@ -1600,6 +1609,7 @@ def end_parameters(self):
_ParametersConsumer.end_parameters(self)
self.data.__dict__.update(self._params.__dict__)
+
class Iterator(object):
"""Iterates over a file of multiple BLAST results.
@@ -1676,6 +1686,7 @@ def next(self):
def __iter__(self):
return iter(self.next, None)
+
def blastall(blastcmd, program, database, infile, align_view='7', **keywds):
"""Execute and retrieve data from standalone BLASTPALL as handles (OBSOLETE).
@@ -2026,6 +2037,7 @@ def _re_search(regex, line, error_msg):
raise ValueError(error_msg)
return m.groups()
+
def _get_cols(line, cols_to_get, ncols=None, expected={}):
cols = line.split()
@@ -2124,6 +2136,7 @@ def _security_check_parameters(param_dict):
if bad_str in str_value:
raise ValueError("Rejecting suspicious argument for %s" % key)
+
class _BlastErrorConsumer(_BlastConsumer):
def __init__(self):
_BlastConsumer.__init__(self)
@@ -2136,6 +2149,7 @@ def noevent(self, line):
_BlastConsumer.__getattr__(self, 'noevent'))
method(line)
+
class BlastErrorParser(AbstractParser):
"""Attempt to catch and diagnose BLAST errors while parsing.
View
2 Bio/Blast/NCBIWWW.py
@@ -22,6 +22,7 @@
from Bio._py3k import _as_string, _as_bytes
+
def qblast(program, database, sequence,
auto_format=None,composition_based_statistics=None,
db_genetic_code=None,endpoints=None,entrez_query='(none)',
@@ -177,6 +178,7 @@ def qblast(program, database, sequence,
return StringIO(results)
+
def _parse_qblast_ref_page(handle):
"""Extract a tuple of RID, RTOE from the 'please wait' page (PRIVATE).
View
5 Bio/Blast/NCBIXML.py
@@ -25,6 +25,7 @@
import xml.sax
from xml.sax.handler import ContentHandler
+
class _XMLparser(ContentHandler):
"""Generic SAX Parser
@@ -114,6 +115,7 @@ def endElement(self, name):
# Reset character buffer
self._value = ''
+
class BlastParser(_XMLparser):
"""Parse XML BLAST data into a Record.Blast object
@@ -207,7 +209,7 @@ def _end_Iteration(self):
self._blast = None
if self._debug:
- "NCBIXML: Added Blast record to results"
+ print "NCBIXML: Added Blast record to results"
# Header
def _end_BlastOutput_program(self):
@@ -560,6 +562,7 @@ def _end_Statistics_entropy(self):
"""
self._blast.ka_params = self._blast.ka_params + (float(self._value),)
+
def read(handle, debug=0):
"""Returns a single Blast record (assumes just one query).
View
4 Bio/Blast/ParseBlastTable.py
@@ -8,6 +8,7 @@
Returns a BlastTableRec instance
"""
+
class BlastTableEntry(object):
def __init__(self,in_rec):
bt_fields = in_rec.split()
@@ -22,6 +23,7 @@ def __init__(self,in_rec):
self.e_value = float(bt_fields[10])
self.bit_score = float(bt_fields[11])
+
class BlastTableRec(object):
def __init__(self):
self.program = None
@@ -40,6 +42,8 @@ def add_entry(self, entry):
'Query': 'query',
'Database': 'database',
'Fields': 'fields'}
+
+
class BlastTableReader(object):
def __init__(self, handle):
self.handle = handle
View
10 Bio/Blast/Record.py
@@ -22,6 +22,7 @@
from Bio.Align import Generic
+
class Header(object):
"""Saves information from a blast header.
@@ -52,6 +53,7 @@ def __init__(self):
self.database_sequences = None
self.database_letters = None
+
class Description(object):
"""Stores information about one hit in the descriptions section.
@@ -72,6 +74,7 @@ def __init__(self):
def __str__(self):
return "%-66s %5s %s" % (self.title, self.score, self.e)
+
class Alignment(object):
"""Stores information about one hit in the alignments section.
@@ -95,6 +98,7 @@ def __str__(self):
lines.append("Length = %s\n" % self.length)
return '\n '.join(lines)
+
class HSP(object):
"""Stores information about one hsp in an alignment hit.
@@ -190,6 +194,7 @@ def __str__(self):
str(self.sbjct_end)))
return "\n".join(lines)
+
class MultipleAlignment(object):
"""Holds information about a multiple alignment.
@@ -238,6 +243,7 @@ def to_generic(self, alphabet):
return generic
+
class Round(object):
"""Holds information from a PSI-BLAST round.
@@ -255,6 +261,7 @@ def __init__(self):
self.alignments = []
self.multiple_alignment = None
+
class DatabaseReport(object):
"""Holds information about a database report.
@@ -277,6 +284,7 @@ def __init__(self):
self.gapped = 0
self.ka_params_gap = (None, None, None)
+
class Parameters(object):
"""Holds information about the parameters.
@@ -340,6 +348,7 @@ def __init__(self):
self.gap_trigger = (None, None)
self.blast_cutoff = (None, None)
+
#TODO - Add a friendly __str__ method to BLAST results
class Blast(Header, DatabaseReport, Parameters):
"""Saves the results from a blast search.
@@ -359,6 +368,7 @@ def __init__(self):
self.alignments = []
self.multiple_alignment = None
+
class PSIBlast(Header, DatabaseReport, Parameters):
"""Saves the results from a blastpgp search.
View
3 Bio/CAPS/__init__.py
@@ -14,6 +14,7 @@
Copyright Jonathan Taylor 2005
"""
+
class DifferentialCutsite(object):
"""A differential cutsite is a location in an alignment where an enzyme cuts
at least one sequence and also cannot cut at least one other sequence.
@@ -40,9 +41,11 @@ def __init__(self, **kwds):
self.cuts_in = kwds["cuts_in"]
self.blocked_in = kwds["blocked_in"]
+
class AlignmentHasDifferentLengthsError(Exception):
pass
+
class CAPSMap(object):
"""A map of an alignment showing all possible dcuts.
View
1 Bio/Cluster/__init__.py
@@ -2,6 +2,7 @@
from Bio.Cluster.cluster import *
+
def _treesort(order, nodeorder, nodecounts, tree):
# Find the order of the nodes consistent with the hierarchical clustering
# tree, taking into account the preferred order of nodes.
View
11 Bio/Compass/__init__.py
@@ -23,6 +23,7 @@
"""
import re
+
def read(handle):
record = None
try:
@@ -55,6 +56,7 @@ def read(handle):
raise ValueError("Unexpected end of stream.")
return record
+
def parse(handle):
record = None
try:
@@ -93,6 +95,7 @@ def parse(handle):
yield record
break
+
class Record(object):
"""
Hold information from one compass hit.
@@ -141,6 +144,7 @@ def hit_coverage(self):
"positive_alignment": re.compile("^.{15}(.+)"),
}
+
def __read_names(record, line):
"""
Ali1: 60456.blo.gz.aln Ali2: allscop//14984.blo.gz.aln
@@ -152,12 +156,14 @@ def __read_names(record, line):
record.query = m.group(1)
record.hit = m.group(2)
+
def __read_threshold(record,line):
if not line.startswith("Threshold"):
raise ValueError("Line does not start with 'Threshold':\n%s" % line)
m = __regex["threshold"].search(line)
record.gap_threshold = float(m.group(1))
+
def __read_lengths(record, line):
if not line.startswith("length1="):
raise ValueError("Line does not start with 'length1=':\n%s" % line)
@@ -167,6 +173,7 @@ def __read_lengths(record, line):
record.hit_length = int(m.group(3))
record.hit_filtered_length = float(m.group(4))
+
def __read_profilewidth(record, line):
if not "Nseqs1" in line:
raise ValueError("Line does not contain 'Nseqs1':\n%s" % line)
@@ -176,6 +183,7 @@ def __read_profilewidth(record, line):
record.hit_nseqs = int(m.group(3))
record.hit_neffseqs = float(m.group(4))
+
def __read_scores(record, line):
if not line.startswith("Smith-Waterman"):
raise ValueError("Line does not start with 'Smith-Waterman':\n%s" % line)
@@ -187,6 +195,7 @@ def __read_scores(record, line):
record.sw_score = 0
record.evalue = -1.0
+
def __read_query_alignment(record, line):
m = __regex["start"].search(line)
if m:
@@ -195,11 +204,13 @@ def __read_query_alignment(record, line):
assert m is not None, "invalid match"
record.query_aln += m.group(1)
+
def __read_positive_alignment(record, line):
m = __regex["positive_alignment"].match(line)
assert m is not None, "invalid match"
record.positives += m.group(1)
+
def __read_hit_alignment(record, line):
m = __regex["start"].search(line)
if m:
View
6 Bio/Crystal/__init__.py
@@ -13,21 +13,25 @@
import copy
+
class CrystalError(Exception):
pass
+
def wrap_line(line):
output = ''
for i in range(0, len(line), 80):
output = output + '%s\n' % line[ i: i + 80 ]
return output
+
def validate_key(key):
if not isinstance(key, str):
raise CrystalError('chain requires a string label')
if len(key) != 1:
raise CrystalError('chain label should contain one letter')
+
class Hetero(object):
"""
This class exists to support the PDB hetero codes.
@@ -64,6 +68,7 @@ def __str__(self):
def __len__(self):
return len(self.data)
+
class Chain(object):
def __init__(self, residues = ''):
self.data = []
@@ -208,6 +213,7 @@ def __iadd__(self, other):
raise TypeError
return self
+
class Crystal(object):
def __init__(self, data = {}):
# Enforcestorage
View
7 Bio/Data/CodonTable.py
@@ -35,9 +35,11 @@
# appropriate distribution of codons, so do not cache the results of
# back_table lookups!
+
class TranslationError(Exception):
pass
+
class CodonTable(object):
nucleotide_alphabet = Alphabet.generic_nucleotide
protein_alphabet = Alphabet.generic_protein
@@ -117,6 +119,7 @@ def __str__(self):
+ "+".join(["---------" for c2 in letters]) + "+--"
return answer
+
def make_back_table(table, default_stop_codon):
# ONLY RETURNS A SINGLE CODON
# Do the sort so changes in the hash implementation won't affect
@@ -144,6 +147,7 @@ def __init__(self, id, names, table, start_codons, stop_codons):
class NCBICodonTableDNA(NCBICodonTable):
nucleotide_alphabet = IUPAC.unambiguous_dna
+
class NCBICodonTableRNA(NCBICodonTable):
nucleotide_alphabet = IUPAC.unambiguous_rna
@@ -178,6 +182,7 @@ def __init__(self, codon_table,
def __getattr__(self, name):
return getattr(self._codon_table, name)
+
def list_possible_proteins(codon, forward_table, ambiguous_nucleotide_values):
c1, c2, c3 = codon
x1 = ambiguous_nucleotide_values[c1]
@@ -201,6 +206,7 @@ def list_possible_proteins(codon, forward_table, ambiguous_nucleotide_values):
raise KeyError(codon)
return possible.keys()
+
def list_ambiguous_codons(codons, ambiguous_nucleotide_values):
"""Extends a codon list to include all possible ambigous codons.
@@ -275,6 +281,7 @@ def list_ambiguous_codons(codons, ambiguous_nucleotide_values):
# >>> t.forward_table["YTA"]
# 'L'
+
class AmbiguousForwardTable(object):
def __init__(self, forward_table, ambiguous_nucleotide, ambiguous_protein):
self.forward_table = forward_table
View
1 Bio/Data/IUPACData.py
@@ -136,6 +136,7 @@ def _make_ranges(mydict):
}
unambiguous_rna_weight_ranges = _make_ranges(unambiguous_rna_weights)
+
def _make_ambiguous_ranges(mydict, weight_table):
range_d = {}
avg_d = {}
View
13 Bio/DocSQL.py
@@ -39,13 +39,16 @@
connection = None
+
class NoInsertionError(Exception):
pass
+
def _check_is_public(name):
if name[:6] == "_names":
raise AttributeError
+
class QueryRow(list):
def __init__(self, cursor):
try:
@@ -81,6 +84,7 @@ def __setattr__(self, name, value):
except KeyError:
return object.__setattr__(self, name, value)
+
class Query(object):
"""
SHOW TABLES
@@ -119,11 +123,13 @@ def dump(self):
for item in self:
print item
+
class QueryGeneric(Query):
def __init__(self, statement, *args, **keywds):
Query.__init__(self, *args, **keywds)
self.statement = statement,
+
class IterationCursor(object):
def __init__(self, query, connection=connection):
if connection is None:
@@ -138,6 +144,7 @@ def __init__(self, query, connection=connection):
def next(self):
return self.row_class(self.cursor)
+
class QuerySingle(Query, QueryRow):
ignore_warnings = 0
@@ -155,6 +162,7 @@ def __init__(self, *args, **keywds):
def cursor(self):
return self.single_cursor
+
class QueryAll(list, Query):
def __init__(self, *args, **keywds):
Query.__init__(self, *args, **keywds)
@@ -163,20 +171,24 @@ def __init__(self, *args, **keywds):
def process_row(self, row):
return row
+
class QueryAllFirstItem(QueryAll):
def process_row(self, row):
return row[0]
+
class Create(QuerySingle):
def __init__(self, *args, **keywds):
try:
QuerySingle.__init__(self, *args, **keywds)
except StopIteration:
self.message = self.MSG_SUCCESS
+
class Update(Create):
pass
+
class Insert(Create):
MSG_INTEGRITY_ERROR = "Couldn't insert: %s. "
@@ -201,6 +213,7 @@ def __init__(self, *args, **keywds):
if self.cursor().rowcount == 0:
raise NoInsertionError
+
def _test(*args, **keywds):
import doctest
doctest.testmod(sys.modules[__name__], *args, **keywds)
View
5 Bio/Emboss/Applications.py
@@ -14,6 +14,7 @@
from Bio.Application import _Option, _Switch, AbstractCommandline
+
class _EmbossMinimalCommandLine(AbstractCommandline):
"""Base Commandline object for EMBOSS wrappers (PRIVATE).
@@ -80,6 +81,7 @@ def __init__(self, cmd=None, **kwargs):
self.parameters = extra_parameters
AbstractCommandline.__init__(self, cmd, **kwargs)
+
class _EmbossCommandLine(_EmbossMinimalCommandLine):
"""Base Commandline object for EMBOSS wrappers (PRIVATE).
@@ -114,6 +116,7 @@ def _validate(self):
"or enable filter or stdout (output to stdout).")
return _EmbossMinimalCommandLine._validate(self)
+
class Primer3Commandline(_EmbossCommandLine):
"""Commandline object for the Primer3 interface from EMBOSS.
@@ -1214,6 +1217,7 @@ def _validate(self):
"or enable filter or stdin (input from stdin).")
return _EmbossMinimalCommandLine._validate(self)
+
class SeqmatchallCommandline(_EmbossCommandLine):
""" Commandline object for the seqmatchall program from EMBOSS
@@ -1239,6 +1243,7 @@ def __init__(self, cmd="seqmatchall", **kwargs):
]
_EmbossCommandLine.__init__(self, cmd, **kwargs)
+
def _test():
"""Run the Bio.Emboss.Applications module doctests."""
import doctest
View
2 Bio/Emboss/Primer3.py
@@ -19,6 +19,7 @@
# --- primer3
+
class Record(object):
"""Represent information from a primer3 run finding primers.
@@ -32,6 +33,7 @@ def __init__(self):
self.comments = ""
self.primers = []
+
class Primers(object):
"""A primer set designed by Primer3.
View
3 Bio/Emboss/PrimerSearch.py
@@ -24,6 +24,7 @@ def add_primer_set(self, primer_name, first_primer_seq,