Пример #1
0
 def testOneLineInOneFileTitle(self):
     """
     If a protein grouper is given one file with one line, its _title method
     must return the expected string.
     """
     fp = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327|X|I44.6 ubiquitin [Lausannevirus]\n')
     pg = ProteinGrouper()
     pg.addFile('sample-filename', fp)
     self.assertEqual('1 virus found in 1 sample', pg._title())
Пример #2
0
 def testOneLineInOneFileTitle(self):
     """
     If a protein grouper is given one file with one line, its _title method
     must return the expected string.
     """
     fp = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327|X|I44.6 ubiquitin [Lausannevirus]\n')
     pg = ProteinGrouper()
     pg.addFile('sample-filename', fp)
     self.assertEqual('1 virus found in 1 sample', pg._title())
Пример #3
0
 def testTwoLinesInOneFileTitle(self):
     """
     If a protein grouper is given one file with two protein lines, each
     from a different virus, its _title method must return the expected
     string.
     """
     fp = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327|X|I44.6 ubiquitin [Lausannevirus]\n'
         '0.77 46.6 48.1 5 6 74 gi|327|X|I44.6 ubiquitin [X Virus]\n')
     pg = ProteinGrouper()
     pg.addFile('sample-filename', fp)
     self.assertEqual('2 viruses found in 1 sample', pg._title())
Пример #4
0
 def testOneLineInEachOfTwoFilesDifferentVirusesTitle(self):
     """
     If a protein grouper is given two files, each with one line from
     different viruses, its _title method must return the expected string.
     """
     fp1 = StringIO(
         '0.63 41.3 44.2 9 9 12 gi|327410| protein 77 [Lausannevirus]\n')
     fp2 = StringIO('0.77 46.6 48.1 5 6 74 gi|327409| ubiquitin [HBV]\n')
     pg = ProteinGrouper()
     pg.addFile('sample-filename-1', fp1)
     pg.addFile('sample-filename-2', fp2)
     self.assertEqual('2 viruses found in 2 samples', pg._title())
Пример #5
0
 def testTwoLinesInOneFileTitle(self):
     """
     If a protein grouper is given one file with two protein lines, each
     from a different virus, its _title method must return the expected
     string.
     """
     fp = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327|X|I44.6 ubiquitin [Lausannevirus]\n'
         '0.77 46.6 48.1 5 6 74 gi|327|X|I44.6 ubiquitin [X Virus]\n'
         )
     pg = ProteinGrouper()
     pg.addFile('sample-filename', fp)
     self.assertEqual('2 viruses found in 1 sample', pg._title())
Пример #6
0
 def testOneLineInEachOfTwoFilesDifferentVirusesTitle(self):
     """
     If a protein grouper is given two files, each with one line from
     different viruses, its _title method must return the expected string.
     """
     fp1 = StringIO(
         '0.63 41.3 44.2 9 9 12 gi|327410| protein 77 [Lausannevirus]\n'
     )
     fp2 = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327409| ubiquitin [HBV]\n'
     )
     pg = ProteinGrouper()
     pg.addFile('sample-filename-1', fp1)
     pg.addFile('sample-filename-2', fp2)
     self.assertEqual('2 viruses found in 2 samples', pg._title())
Пример #7
0
 def testOneLineInEachOfTwoFilesSamePathogenTitle(self):
     """
     If a protein grouper is given two files, each with one line from the
     same pathogen, its _title method must return the expected string.
     """
     fp1 = StringIO(
         '0.63 41.3 44.2 9 9 12 gi|327410| protein 77 [Lausannevirus]\n')
     fp2 = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327409| ubiquitin [Lausannevirus]\n')
     pg = ProteinGrouper()
     pg.addFile('sample-filename-1', fp1)
     pg.addFile('sample-filename-2', fp2)
     self.assertEqual(
         'Overall, proteins from 1 pathogen were found in 2 samples.',
         pg._title())
Пример #8
0
 def testOneLineInEachOfTwoFilesSamePathogenTitle(self):
     """
     If a protein grouper is given two files, each with one line from the
     same pathogen, its _title method must return the expected string.
     """
     fp1 = StringIO(
         '0.63 41.3 44.2 9 9 12 gi|327410| protein 77 [Lausannevirus]\n'
     )
     fp2 = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|327409| ubiquitin [Lausannevirus]\n'
     )
     pg = ProteinGrouper()
     pg.addFile('sample-filename-1', fp1)
     pg.addFile('sample-filename-2', fp2)
     self.assertEqual(
         'Overall, proteins from 1 pathogen were found in 2 samples.',
         pg._title())