コード例 #1
0
ファイル: test_fasta.py プロジェクト: TaliVeith/dark-matter
 def testFilterRandomSubsetOfOneFromTenReads(self):
     """
     It must be possible to select a random subset of one read from a set
     of ten reads, where the read count is provided to C{filter} via the
     C{trueLength} argument.
     """
     data = '\n'.join(['>id', 'ACGT'] * 10)
     with patch.object(builtins, 'open', mock_open(read_data=data)):
         reads = FastaReads('filename.fasta')
         result = list(reads.filter(randomSubset=1, trueLength=10))
         self.assertEqual(1, len(result))
コード例 #2
0
ファイル: test_fasta.py プロジェクト: TaliVeith/dark-matter
 def testFilterRandomSubsetOfZeroFromZeroReads(self):
     """
     It must be possible to select a random subset of zero reads from a set
     of zero reads, where the read count is provided to C{filter} via the
     C{trueLength} argument.
     """
     data = ''
     with patch.object(builtins, 'open', mock_open(read_data=data)):
         reads = FastaReads('filename.fasta')
         result = list(reads.filter(randomSubset=0, trueLength=0))
         self.assertEqual([], result)
コード例 #3
0
ファイル: test_fasta.py プロジェクト: bamueh/dark-matter
 def testFilterRandomSubsetOfOneFromTenReads(self):
     """
     It must be possible to select a random subset of one read from a set
     of ten reads, where the read count is provided to C{filter} via the
     C{trueLength} argument.
     """
     data = '\n'.join(['>id', 'ACGT'] * 10)
     mockOpener = mockOpen(read_data=data)
     with patch.object(builtins, 'open', mockOpener):
         reads = FastaReads('filename.fasta')
         result = list(reads.filter(randomSubset=1, trueLength=10))
         self.assertEqual(1, len(result))
コード例 #4
0
ファイル: test_fasta.py プロジェクト: bamueh/dark-matter
 def testFilterRandomSubsetOfZeroFromZeroReads(self):
     """
     It must be possible to select a random subset of zero reads from a set
     of zero reads, where the read count is provided to C{filter} via the
     C{trueLength} argument.
     """
     data = ''
     mockOpener = mockOpen(read_data=data)
     with patch.object(builtins, 'open', mockOpener):
         reads = FastaReads('filename.fasta')
         result = list(reads.filter(randomSubset=0, trueLength=0))
         self.assertEqual([], result)
コード例 #5
0
ファイル: test_fasta.py プロジェクト: TaliVeith/dark-matter
 def testFilterRandomSubsetOfTwoFromTwoReads(self):
     """
     It must be possible to select a random subset of two reads from a set
     of two reads, where the read count is provided to C{filter} via the
     C{trueLength} argument.
     """
     data = '\n'.join(['>id1', 'ACGT', '>id2', 'TGCA'])
     with patch.object(builtins, 'open', mock_open(read_data=data)):
         reads = FastaReads('filename.fasta')
         result = list(reads.filter(randomSubset=2, trueLength=2))
         self.assertEqual(
             [Read('id1', 'ACGT'), Read('id2', 'TGCA')], result)
コード例 #6
0
ファイル: test_fasta.py プロジェクト: bamueh/dark-matter
 def testFilterRandomSubsetOfTwoFromTwoReads(self):
     """
     It must be possible to select a random subset of two reads from a set
     of two reads, where the read count is provided to C{filter} via the
     C{trueLength} argument.
     """
     data = '\n'.join(['>id1', 'ACGT', '>id2', 'TGCA'])
     mockOpener = mockOpen(read_data=data)
     with patch.object(builtins, 'open', mockOpener):
         reads = FastaReads('filename.fasta')
         result = list(reads.filter(randomSubset=2, trueLength=2))
         self.assertEqual([Read('id1', 'ACGT'), Read('id2', 'TGCA')],
                          result)