예제 #1
0
 def test_correct(self):
     lin = rdp.FixrankLineage([['domain', 'D', 1.0], ['phylum', 'P', 1.0],
                               ['class', 'C', 0.75], ['order', 'O', 1.0],
                               ['family', 'F', 1.0], ['genus', 'G', 1.0]])
     lin.trim_at_rank('phylum')
     assert lin == rdp.FixrankLineage([['domain', 'D', 1.0],
                                       ['phylum', 'P', 1.0]])
예제 #2
0
 def test_correct(self):
     line = 'seq494517;size=2;\t\tBacteria\tdomain\t1.0\t"Proteobacteria"\tphylum\t1.0\tAlphaproteobacteria\tclass\t0.89\tCaulobacterales\torder\t0.42\tCaulobacteraceae\tfamily\t0.41\tBrevundimonas\tgenus\t0.38\n'
     sid, lin = rdp.FixrankParser.parse_line(line)
     assert sid == 'seq494517'
     assert lin == rdp.FixrankLineage(
         [['domain', 'Bacteria', 1.0], ['phylum', 'Proteobacteria', 1.0],
          ['class', 'Alphaproteobacteria', 0.89],
          ['order', 'Caulobacterales', 0.42],
          ['family', 'Caulobacteraceae', 0.41],
          ['genus', 'Brevundimonas', 0.38]])
예제 #3
0
class WithEntries:
    entries = [
        'seq1;size=272905;', '', 'Bacteria', 'domain', '1.0',
        '"Bacteroidetes"', 'phylum', '1.0', 'Flavobacteriia', 'class', '0.75',
        '"Flavobacteriales"', 'order', '1.0', 'Flavobacteriaceae', 'family',
        '1.0', 'Flavobacterium', 'genus', '1.0'
    ]
    sid = 'seq1'
    lin = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                              ['phylum', 'Bacteroidetes', 1.0],
                              ['class', 'Flavobacteriia', 0.75],
                              ['order', 'Flavobacteriales', 1.0],
                              ['family', 'Flavobacteriaceae', 1.0],
                              ['genus', 'Flavobacterium', 1.0]])
예제 #4
0
class WithLineage:
    lin = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                              ['phylum', 'P', 1.0]])
예제 #5
0
 def test_different_lengths(self):
     lin1 = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                                ['phylum', 'P', 1.0]])
     lin2 = rdp.FixrankLineage([['domain', 'Bacteria', 1.0]])
     assert lin1 != lin2
예제 #6
0
 def test_different_info(self):
     lin1 = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                                ['phylum', 'P', 1.0]])
     lin2 = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                                ['phylum', 'something_else', 1.0]])
     assert lin1 != lin2
예제 #7
0
 def test_correct(self):
     lin1 = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                                ['phylum', 'P', 1.0]])
     lin2 = rdp.FixrankLineage([['domain', 'Bacteria', 1.0],
                                ['phylum', 'P', 1.0]])
     assert lin1 == lin2
예제 #8
0
 def test_correct(self):
     assert self.lin.ranks_at_confidence(0.8) == rdp.FixrankLineage(
         [['domain', 'Bacteria', 1.0], ['phylum', 'Bacteroidetes',
                                        1.0]]).ranks