def test_outputbasename(self): ''' Test that the outputfile parameter works with just a basename ''' os.mkdir('basename') os.symlink(self.sff, os.path.join('basename', 'sff1.sff')) outfile = bwa.compile_reads('basename', 'outputfile.fastq') eq_('outputfile.fastq', outfile) eq_(seqio.reads_in_file(self.sff), seqio.reads_in_file(outfile))
def test_outputabsrelpath(self): ''' Test that the outputfile parameter works with a relative or abs path ''' os.mkdir('absrel') os.symlink(self.sff, os.path.join('absrel', 'sff1.sff')) outfile = bwa.compile_reads('absrel', 'absrel/outputfile.fastq') eq_('absrel/outputfile.fastq', outfile) eq_(seqio.reads_in_file(self.sff), seqio.reads_in_file('absrel/outputfile.fastq'))
def test_paramdirfastqonly(self): ''' Directory of only fastq ''' os.mkdir('fastq') os.symlink(self.fastq, os.path.join('fastq', 'fq1.fastq')) os.symlink(self.fastq, os.path.join('fastq', 'fq2.fastq')) outfile = bwa.compile_reads('fastq') expected_readcount = seqio.reads_in_file(self.sff) * 2 self._isfastq(outfile) eq_(expected_readcount, seqio.reads_in_file(outfile))
def test_paramdirsffonly(self): ''' Directory of only sff files ''' os.mkdir('sffs') os.symlink(self.sff, os.path.join('sffs', 'sff1.sff')) os.symlink(self.sff, os.path.join('sffs', 'sff2.sff')) outfile = bwa.compile_reads('sffs') expected_readcount = seqio.reads_in_file(self.sff) * 2 self._isfastq(outfile) eq_(expected_readcount, seqio.reads_in_file(outfile))
def test_targetbug1_3(self): ''' Targets a bug where compile_reads would generate 2 identical fastq files(reads.fastq and sff.fastq) ''' os.mkdir('sffs3') sffpth = os.path.join('sffs3', 'sff1.sff') os.symlink(self.sff, sffpth) outfile = bwa.compile_reads(sffpth) fastqs = glob.glob('*.fastq') assert len(fastqs) == 1, fastqs
def test_paramdirmixed(self): ''' Directory of sff & fastq ''' os.mkdir('mixed') os.symlink(self.sff, os.path.join('mixed', 'sff1.sff')) os.symlink(self.fastq, os.path.join('mixed', 'fq1.fastq')) outfile = bwa.compile_reads('mixed') expected_readcount = seqio.reads_in_file( self.sff ) + \ seqio.reads_in_file( self.fastq ) self._isfastq(outfile) eq_(expected_readcount, seqio.reads_in_file(outfile))
def test_paramsinglefastq(self): ''' Input fastq should not be changed ''' stat = os.stat(self.fastq) outfile = bwa.compile_reads(self.fastq) eq_(stat.st_mtime, os.stat(self.fastq).st_mtime) eq_(stat.st_ino, os.stat(outfile).st_ino)
def test_paramsinglesff(self): ''' Make sure single sff works ''' outfile = bwa.compile_reads(self.sff) self._isfastq(outfile)
def test_noreads(self): ''' Directory empty ''' os.mkdir('emptydir') outfile = bwa.compile_reads('emptydir') eq_([], outfile)