Codebase list ariba / e9b514a
Merge tag 'upstream/2.6.1+ds' Upstream version 2.6.1+ds Sascha Steinbiss 7 years ago
4 changed file(s) with 19 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
77 def __init__(self, infile, duplicate_warnings=True):
88 self.infile = infile
99 self.duplicate_warnings = duplicate_warnings
10 self.columns_to_ignore = ['clonal_complex', 'CC', 'Lineage', 'mlst_clade', 'species']
1011
1112 if not os.path.exists(self.infile):
1213 raise Error('Error! Input file "' + self.infile + '" not found.')
2122 if reader.fieldnames[0] != 'ST':
2223 raise Error('Error. Expected first column of profile file "' + self.infile + '" to be "ST"')
2324
24 self.genes_list = reader.fieldnames[1:]
25 if self.genes_list[-1] == 'clonal_complex':
26 self.genes_list.pop()
25 self.genes_list = [column_name for column_name in reader.fieldnames[1:] if column_name not in self.columns_to_ignore]
2726
2827 for row in reader:
2928 type_tuple = tuple(int(row[x]) for x in self.genes_list)
0 ST nusA rpoB eno gltB lepA nuoL nrdA clonal_complex CC Lineage mlst_clade species
1 1 1 26 2 2 59 8 1 1 CC10 II 123 Bacteria
2 2 1 26 2 4 59 2 5 2 CC10 II 123 Bacteria
99 def test_init(self):
1010 '''test init'''
1111 infile = os.path.join(data_dir, 'mlst_profile_test.init.profile.tsv')
12 profile = mlst_profile.MlstProfile(infile)
13 expected_genes = ['nusA', 'rpoB', 'eno', 'gltB', 'lepA', 'nuoL', 'nrdA']
14 self.assertEqual(expected_genes, profile.genes_list)
15 self.assertEqual(set(expected_genes), profile.genes_set)
16 expected_dict = {
17 (1, 26, 2, 2, 59, 8, 1): 1,
18 (1, 26, 2, 4, 59, 2, 5): 2
19 }
20 self.assertEqual(expected_dict, profile.profile_to_type)
21
22 def test_init_multiple_extra_columns(self):
23 '''test init'''
24 infile = os.path.join(data_dir, 'mlst_profile_test.init_multiple_extra_columns.profile.tsv')
1225 profile = mlst_profile.MlstProfile(infile)
1326 expected_genes = ['nusA', 'rpoB', 'eno', 'gltB', 'lepA', 'nuoL', 'nrdA']
1427 self.assertEqual(expected_genes, profile.genes_list)
5454 setup(
5555 ext_modules=[minimap_mod, fermilite_mod, vcfcall_mod],
5656 name='ariba',
57 version='2.6.0',
57 version='2.6.1',
5858 description='ARIBA: Antibiotic Resistance Identification By Assembly',
5959 packages = find_packages(),
6060 package_data={'ariba': ['test_run_data/*']},