Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_NNGene.MotifFinderTest Class Reference

List of all members.

Public Member Functions

def setUp
def test_find
def test_find_differences

Public Attributes

 test_records
 diff_records
 motif_finder

Detailed Description

Tests for finding motifs from sequences.

Definition at line 222 of file test_NNGene.py.


Member Function Documentation

Definition at line 225 of file test_NNGene.py.

00225 
00226     def setUp(self):
00227         test_file = os.path.join('NeuralNetwork', 'enolase.fasta')
00228         diff_file = os.path.join('NeuralNetwork', 'repeat.fasta')
00229 
00230         self.test_records = []
00231         self.diff_records = []
00232 
00233         # load the records
00234         for file, records in ((test_file, self.test_records),
00235                               (diff_file, self.diff_records)):
00236 
00237             handle = open(file, 'r')
00238 
00239             iterator = SeqIO.parse(handle, "fasta",
00240                                    alphabet=IUPAC.unambiguous_dna)
00241             while 1:
00242                 try:
00243                     seq_record = iterator.next()
00244                 except StopIteration:
00245                     break
00246                 if seq_record is None:
00247                     break
00248 
00249                 records.append(seq_record)
00250 
00251             handle.close()
00252 
00253         self.motif_finder = Motif.MotifFinder()

Find all motifs in a set of sequences.

Definition at line 254 of file test_NNGene.py.

00254 
00255     def test_find(self):
00256         """Find all motifs in a set of sequences.
00257         """
00258         motif_repository = self.motif_finder.find(self.test_records, 8)
00259         top_motif = motif_repository.get_top(1)
00260 
00261         assert top_motif[0] == 'TTGGAAAG', \
00262                "Got unexpected motif %s" % top_motif[0]

Find the difference in motif counts between two sets of sequences.

Definition at line 263 of file test_NNGene.py.

00263 
00264     def test_find_differences(self):
00265         """Find the difference in motif counts between two sets of sequences.
00266         """
00267         motif_repository = \
00268                self.motif_finder.find_differences(self.test_records,
00269                                                   self.diff_records, 8)
00270 
00271         top, bottom = motif_repository.get_differing(1, 1)
00272 
00273         assert top == "TTGGAAAG", "Got unexpected top motif %s" % top
00274         assert bottom == "AATGGCAT", "Got unexpected bottom motif %s" % bottom


Member Data Documentation

Definition at line 230 of file test_NNGene.py.

Definition at line 252 of file test_NNGene.py.

Definition at line 229 of file test_NNGene.py.


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