def test_invalid_chromosome(self): message = r"Could not find chromosome .*" with self.assertRaisesRegex(ValueError, message): genomes.genome('homo_sapiens', 84, chromosomes=['ZZZ'], source='ensembl')
def test_absolute_path(self): message = r'Directory ".*" does not exist.' with self.assertRaisesRegex(ValueError, message): genomes.genome('homo_sapiens', 84, genome='/invalid/path/genome.fa.gz', out_dir='/invalid/path/will/raise/error', source='ensembl')
def test_invalid_out_dir(self): message = r'Directory ".*" does not exist.' with self.assertRaisesRegex(ValueError, message): genomes.genome('homo_sapiens', 84, genome='genome.fa.gz', out_dir='/does/not/exist', source='ensembl')
def test_genome(self): genomes.genome( 'homo_sapiens', release=84, out_dir=self.tempdir, chromosomes=['MT'], source='ensembl') self.assertTrue(os.path.isfile( os.path.join(self.tempdir, 'homo_sapiens.84.chrMT.fa.gz'))) # Confirm that chrom_length file was created! self.assertTrue(os.path.isfile( os.path.join(self.tempdir, 'homo_sapiens.84.chrMT.fa.gz.fai')))
def test_genome(self): genomes.genome('human', release='26', out_dir=self.tempdir, source='gencode') self.assertTrue( os.path.isfile(os.path.join(self.tempdir, 'human.26.fa.gz'))) # Confirm that chrom_length file was created! self.assertTrue( os.path.isfile(os.path.join(self.tempdir, 'human.26.fa.gz.fai')))
def test_genome_invalid_release(self): message = r'Invalid release number.' with self.assertRaisesRegex(ValueError, message): genomes.genome('human', release='1000', source='gencode')
def test_genome_invalid_species(self): message = r'Invalid species name.' with self.assertRaisesRegex(ValueError, message): genomes.genome(species='invalid_species_name', release='26', source='gencode')
def test_bad_source(self): message = r'Source .* is not supported.' with self.assertRaisesRegex(ValueError, message): genomes.genome('human', '27', source='invalid_source')
def test_genome_invalid_release(self): message = r"Release should be a number between \d+ and \d+" with self.assertRaisesRegex(ValueError, message): genomes.genome('homo_sapiens', release=1, source='ensembl')
def test_genome_invalid_species(self): message = r'Invalid species name.' with self.assertRaisesRegex(ValueError, message): genomes.genome('invalid_species_name', 84, source='ensembl')