def test_bwa_mapping(): '''It test that the gmap doesn't map anything''' reference = join(TEST_DATA_DIR, 'blast/arabidopsis_genes') work_dir = NamedTemporaryDir() reference_fpath = join(work_dir.name, 'arabidopsis_genes') os.symlink(reference, reference_fpath) reads_fhand = NamedTemporaryFile(suffix='.sfastq') reads_fhand.write(SOLEXA) reads_fhand.flush() out_bam_fhand = NamedTemporaryFile() out_bam_fpath = out_bam_fhand.name out_bam_fhand.close() parameters = {'colorspace': False, 'reads_length':'short', 'threads':None, 'java_conf':None} map_reads_with_bwa(reference_fpath, reads_fhand.name, out_bam_fpath, parameters) test_sam_fhand = NamedTemporaryFile(suffix='sam') bam2sam(out_bam_fpath, test_sam_fhand.name) result = open(test_sam_fhand.name).read() assert 'seq17' in result unmapped_fhand = StringIO.StringIO() parameters = {'colorspace': False, 'reads_length':'short', 'threads':None, 'java_conf':None, 'unmapped_fhand':unmapped_fhand} map_reads_with_bwa(reference_fpath, reads_fhand.name, out_bam_fpath, parameters) assert 'seq17' in unmapped_fhand.getvalue() test_sam_fhand = NamedTemporaryFile(suffix='sam') bam2sam(out_bam_fpath, test_sam_fhand.name) result = open(test_sam_fhand.name).read() assert 'seq17' not in result