Permalink
Browse files

Everybody gets a docstring!

YOU get a docstring! YOU get a docstring! EVERYBODY GETS A DOCSTRING!!
  • Loading branch information...
1 parent c680b0d commit 42aaad1903f7d971266bb5dd73775794f886ffe2 polyatail committed Mar 26, 2012
Showing with 17 additions and 5 deletions.
  1. +17 −5 Bio/AlignIO/MafIO.py
View
@@ -19,16 +19,17 @@
import shlex
class MafWriter(SequentialAlignmentWriter):
- """Accepts a MultipleSeqAlignment object, writes a MAF file.
-
- More later.
- """
+ """Accepts a MultipleSeqAlignment object, writes a MAF file"""
def write_header(self):
+ """Writes the MAF header"""
+
self.handle.write ("##maf version=1 scoring=none\n")
self.handle.write ("# generated by Biopython\n\n")
def _write_record (self, record):
+ """Writes a single SeqRecord object to an 's' line in a MAF block"""
+
fields = ["s",
#In the MAF file format, spaces are not allowed in the id
"%-40s" % record.id.replace(" ","_"),
@@ -40,6 +41,11 @@ def _write_record (self, record):
self.handle.write(" ".join(fields) + "\n")
def write_alignment(self, alignment):
+ """
+ Writes every SeqRecord in a MultipleSeqAlignment object to its own
+ MAF block (beginning with an 'a' line, containing 's' lines)
+ """
+
if not isinstance(alignment, Alignment):
raise TypeError("Expected an alignment object")
@@ -72,6 +78,12 @@ def write_alignment(self, alignment):
return recs_out
def MafIterator(handle, seq_count = None, alphabet = single_letter_alphabet):
+ """
+ Iterates over lines in a MAF file-like object (handle), yielding
+ MultipleSeqAlignment objects. SeqRecord IDs generally correspond to
+ species names
+ """
+
in_a_bundle = False
annotations = []
@@ -158,7 +170,7 @@ def MafIterator(handle, seq_count = None, alphabet = single_letter_alphabet):
class MafIndex():
def __init__(self, sqlite_file, maf_file, target_seqname):
- """Indexes or loads the index of a MAF file."""
+ """Indexes or loads the index of a MAF file"""
self.target_seqname = target_seqname

1 comment on commit 42aaad1

This is my favorite commit.

Please sign in to comment.