Mercurial > repos > estrain > microrunqc
comparison microrunqc/mlstAddFields.py @ 25:4f457838f4c9 draft default tip
Fixed missing tab in MLST report
author | estrain |
---|---|
date | Wed, 28 Feb 2024 01:16:18 +0000 |
parents | dc12d6ac296d |
children |
comparison
equal
deleted
inserted
replaced
24:dc12d6ac296d | 25:4f457838f4c9 |
---|---|
19 | 19 |
20 # Return the output without appending if schema equals "-" | 20 # Return the output without appending if schema equals "-" |
21 if schema == "-": | 21 if schema == "-": |
22 print("\t".join(mlstout)) | 22 print("\t".join(mlstout)) |
23 return | 23 return |
24 | 24 |
25 if db_path is None: | 25 if db_path is None: |
26 # If no database path is provided, find it using an external command | 26 # If no database path is provided, find it using an external command |
27 # This requires the 'mlst' command to be installed and available in the path | 27 # This requires the 'mlst' command to be installed and available in the path |
28 import subprocess | 28 import subprocess |
29 mlstdesc = subprocess.check_output(['mlst', '-h']).decode() | 29 mlstdesc = subprocess.check_output(['mlst', '-h']).decode() |
60 schema_dict[line[0]] = ','.join(desc) | 60 schema_dict[line[0]] = ','.join(desc) |
61 | 61 |
62 output = mlstout[:3] | 62 output = mlstout[:3] |
63 if mlstST in schema_dict: | 63 if mlstST in schema_dict: |
64 output.append(schema_dict[mlstST]) | 64 output.append(schema_dict[mlstST]) |
65 else: | |
66 output.append("-") | |
65 output.extend(mlstout[3:]) | 67 output.extend(mlstout[3:]) |
66 | 68 |
67 print("\t".join(output)) | 69 print("\t".join(output)) |
68 | 70 |
69 if __name__ == "__main__": | 71 if __name__ == "__main__": |