コード例 #1
0
ファイル: test_subcommands.py プロジェクト: nhoffman/seqlabd
def test_blast(tmpdir):
    a = asm.Assembly([('aardvark',
                       asm.aflist(
                           0,
                           ''.join([
                               'tcatatctggcgttaatggagttcagtggtaatacaatgaccag',
                               'agatgcatccagagcagttctgcgttttgtcactgtcacagcag',
                               'aagccttacgcttcaggcagat'
                           ]),
                           '-',
                           trackclass='nucleotide')),
                      ('b',
                       asm.aflist(
                           2, 'GGATCCATC', '-', trackclass='nucleotide')),
                      ('c', asm.aflist(0, 'AAA', '-',
                                       trackclass='nucleotide'))])
    a.serialize(str(tmpdir.join('asm.json.bz2')))

    class Args:
        assembly = str(tmpdir.join('asm.json.bz2'))
        label = 'aardvark'
        json = 'data/blast_subcommand.json'
        xml = 'data/blast_subcommand.xml'
        n = 10

    assert seqlab.subcommands.blast.action(Args()) == 0
    assert os.path.exists('data/blast_subcommand.json')
    assert os.path.exists('data/blast_subcommand.xml')
    with open('data/blast_subcommand.json') as h:
        j = json.load(h)
        assert len(j) <= 10
コード例 #2
0
ファイル: test_subcommands.py プロジェクト: madhadron/seqlabd
def test_render(tmpdir):
    a = asm.Assembly([('a', asm.aflist(0, 'ATGGNTGG-TC', '-', trackclass='nucleotide')),
                      ('b', asm.aflist(2,   'GGATCCATC', '-', trackclass='nucleotide')),
                      ('c', asm.aflist(0, 'AAA', '-', trackclass='nucleotide'))])
    a.serialize(str(tmpdir.join('asm.json.bz2')))
    class Args:
        assembly = str(tmpdir.join('asm.json.bz2'))
        output = 'data/render_subcommand_test.html'
    assert seqlab.subcommands.render.action(Args()) == 0
    assert os.path.exists('data/render_subcommand_test.html')
コード例 #3
0
ファイル: test_subcommands.py プロジェクト: madhadron/seqlabd
def test_statistics(tmpdir):
    a = asm.Assembly([('a', asm.aflist(0, 'ATGGNTGG-TC', '-')),
                      ('b', asm.aflist(2,   'GGATCCATC', '-')),
                      ('c', asm.aflist(0, 'AAA', '-'))])
    a.serialize(str(tmpdir.join('asm.json.bz2')))
    class Args:
        assembly = str(tmpdir.join('asm.json.bz2'))
        label1 = 'a'
        label2 = 'b'
        fields = ','.join(['identities','mismatches','fracoverlap'])
        output = str(tmpdir.join('test.csv'))
    assert seqlab.subcommands.statistics.action(Args()) == 0
    with open(str(tmpdir.join('test.csv'))) as h:
        cr = csv.reader(h)
        assert cr.next() == ['5','3','0.9']
コード例 #4
0
ファイル: test_subcommands.py プロジェクト: madhadron/seqlabd
def test_addsequences(tmpdir):
    a = asm.Assembly([('a', asm.aflist(0, 'ATGATGGA', '-'))])
    a.serialize(str(tmpdir.join('asm.json.bz2')))
    with open(str(tmpdir.join('a.fasta')), 'w') as h:
        print >>h, '>alpha omega\nTGATGGA\n'
    class Args:
        assembly=str(tmpdir.join('asm.json.bz2'))
        output=str(tmpdir.join('output.json.bz2'))
        align_to='a'
        fastas=[str(tmpdir.join('a.fasta'))]
        no_alignment=False
    assert seqlab.subcommands.addsequence.action(Args()) == 0
    assert os.path.exists(str(tmpdir.join('output.json.bz2')))
    asm2 = asm.deserialize(str(tmpdir.join('output.json.bz2')))
    assert asm2 == asm.Assembly([('a', asm.aflist(0, 'ATGATGGA', '-')),
                                 ('alpha omega', asm.aflist(1, 'TGATGGA', '-'))])
コード例 #5
0
ファイル: test_subcommands.py プロジェクト: madhadron/seqlabd
def test_blast(tmpdir):
    a = asm.Assembly([('aardvark', 
                       asm.aflist(0,
                                  ''.join(['tcatatctggcgttaatggagttcagtggtaatacaatgaccag',
                                           'agatgcatccagagcagttctgcgttttgtcactgtcacagcag',
                                           'aagccttacgcttcaggcagat']),
                                  '-',
                                  trackclass='nucleotide')),
                      ('b', asm.aflist(2,   'GGATCCATC', '-', trackclass='nucleotide')),
                      ('c', asm.aflist(0, 'AAA', '-', trackclass='nucleotide'))])
    a.serialize(str(tmpdir.join('asm.json.bz2')))
    class Args:
        assembly = str(tmpdir.join('asm.json.bz2'))
        label = 'aardvark'
        json = 'data/blast_subcommand.json'
        xml = 'data/blast_subcommand.xml'
        n = 10
    assert seqlab.subcommands.blast.action(Args()) == 0
    assert os.path.exists('data/blast_subcommand.json')
    assert os.path.exists('data/blast_subcommand.xml')
    with open('data/blast_subcommand.json') as h:
        j = json.load(h)
        assert len(j) <= 10