示例#1
0
 def test_seqs_to_filter_packets(self):
     'It converts seq packets into filter packets'
     seqpackets = [['ACT'], ['CTG', 'TTT']]
     filter_packets = list(seq_to_filterpackets(iter(seqpackets)))
     expected = [[('ACT',)], [('CTG',), ('TTT',)]]
     assert [p[SEQS_PASSED] for p in filter_packets] == expected
     assert [p[SEQS_FILTERED_OUT] for p in filter_packets] == [[], []]
示例#2
0
    def test_filter_by_bowtie2():
        index_fpath = os.path.join(TEST_DATA_DIR, 'arabidopsis_genes')
        fastq_fpath = os.path.join(TEST_DATA_DIR, 'arabidopsis_reads.fastq')
        fasta_fpath = os.path.join(TEST_DATA_DIR, 'arabidopsis_reads.fasta')

        passed = ['no_arabi']
        for preffered_classes in [[SEQITEM], [SEQRECORD]]:
            for reads_fpath in [fastq_fpath, fasta_fpath]:
                seq_packets = read_seq_packets([open(reads_fpath)],
                                               prefered_seq_classes=preffered_classes)
                filter_packets = seq_to_filterpackets(seq_packets)
                filter_ = FilterBowtie2Match(index_fpath)
                filter_packet = list(filter_packets)[0]
                filter_packets = filter_(filter_packet)
                assert _seqs_to_names(filter_packets[SEQS_PASSED]) == passed
                assert _seqs_to_names(filter_packets[SEQS_FILTERED_OUT]) == [
                                                    'read1', 'read2', 'read3']