Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class GTDBTkExit(Exception):
"""Raised when GTDB-Tk is to quietly exit."""
def __init__(self, message=''):
Exception.__init__(self, message)
class GenomeNameInvalid(GTDBTkException):
""" Thrown when a genome name contains characters which are not supported. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class GenomeBatchfileMalformed(GTDBTkException):
""" Thrown when the format of the genome batchfile is malformed. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class NoGenomesFound(GTDBTkException):
""" Thrown when no input genomes are found in a directory. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class ReferenceFileMalformed(GTDBTkException):
""" Thrown when a reference file is malformed. """
class ProdigalException(GTDBTkException):
""" Thrown when Prodigal returns a non-zero exit code. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class MSAMarkerLengthMismatch(GTDBTkException):
""" Thrown when an MSA length does not equal the length of the markers. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class MSAMaskLengthMismatch(GTDBTkException):
""" Thrown when an MSA length does not equal the length of the mask. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class PplacerException(GTDBTkException):
""" Thrown whenever an error is encountered while running pplacer. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class TogException(GTDBTkException):
""" Thrown whenever an error is encountered while running tog. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class MSAMaskLengthMismatch(GTDBTkException):
""" Thrown when an MSA length does not equal the length of the mask. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class PplacerException(GTDBTkException):
""" Thrown whenever an error is encountered while running pplacer. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class TogException(GTDBTkException):
""" Thrown whenever an error is encountered while running tog. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class FastANIException(GTDBTkException):
""" Thrown when an exception is encountered while running FastANI. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class FastTreeException(GTDBTkException):
""" Thrown when an exception is encountered while running FastTree. """
class ReferenceFileMalformed(GTDBTkException):
""" Thrown when a reference file is malformed. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class GenomeMarkerSetUnknown(GTDBTkException):
""" Thrown when the genome marker set is unknown (i.e. not ar122, or bac120). """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class InconsistentGenomeBatch(GTDBTkException):
""" Thrown when number of genomes in the identify directory is different than the number of genomes to process. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class FileNotFound(GTDBTkException):
""" Thrown when a file is not found. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class DirNotFound(GTDBTkException):
""" Thrown when a directory is not found. """
class NoGenomesFound(GTDBTkException):
""" Thrown when no input genomes are found in a directory. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class ReferenceFileMalformed(GTDBTkException):
""" Thrown when a reference file is malformed. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class GenomeMarkerSetUnknown(GTDBTkException):
""" Thrown when the genome marker set is unknown (i.e. not ar122, or bac120). """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class InconsistentGenomeBatch(GTDBTkException):
""" Thrown when number of genomes in the identify directory is different than the number of genomes to process. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class FileNotFound(GTDBTkException):
""" Thrown when a file is not found. """
class GenomeMarkerSetUnknown(GTDBTkException):
""" Thrown when the genome marker set is unknown (i.e. not ar122, or bac120). """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class InconsistentGenomeBatch(GTDBTkException):
""" Thrown when number of genomes in the identify directory is different than the number of genomes to process. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class FileNotFound(GTDBTkException):
""" Thrown when a file is not found. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class DirNotFound(GTDBTkException):
""" Thrown when a directory is not found. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class ProdigalException(GTDBTkException):
""" Thrown when Prodigal returns a non-zero exit code. """
class GenomeNameInvalid(GTDBTkException):
""" Thrown when a genome name contains characters which are not supported. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class GenomeBatchfileMalformed(GTDBTkException):
""" Thrown when the format of the genome batchfile is malformed. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class NoGenomesFound(GTDBTkException):
""" Thrown when no input genomes are found in a directory. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class ReferenceFileMalformed(GTDBTkException):
""" Thrown when a reference file is malformed. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class GenomeMarkerSetUnknown(GTDBTkException):
""" Thrown when the genome marker set is unknown (i.e. not ar122, or bac120). """
class FileNotFound(GTDBTkException):
""" Thrown when a file is not found. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class DirNotFound(GTDBTkException):
""" Thrown when a directory is not found. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class ProdigalException(GTDBTkException):
""" Thrown when Prodigal returns a non-zero exit code. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class MSAMarkerLengthMismatch(GTDBTkException):
""" Thrown when an MSA length does not equal the length of the markers. """
def __init__(self, message=''):
GTDBTkException.__init__(self, message)
class MSAMaskLengthMismatch(GTDBTkException):
""" Thrown when an MSA length does not equal the length of the mask. """
:param path: Path to the genomic fasta file for the genome
:param marker_set_id: Unique ID of marker set to use for alignment
"""
cur_marker_dir = os.path.dirname(os.path.dirname(path))
pfam_tophit_file = TopHitPfamFile(cur_marker_dir, db_genome_id)
tigr_tophit_file = TopHitTigrFile(cur_marker_dir, db_genome_id)
pfam_tophit_file.read()
tigr_tophit_file.read()
if marker_set_id == 'bac120':
copy_number_file = CopyNumberFileBAC120('/dev/null', None)
elif marker_set_id == 'ar122':
copy_number_file = CopyNumberFileAR122('/dev/null', None)
else:
raise GTDBTkException('Unknown marker set.')
copy_number_file.add_genome(db_genome_id, path, pfam_tophit_file, tigr_tophit_file)
single_copy_hits = copy_number_file.get_single_copy_hits(db_genome_id)
# gather information for all marker genes
marker_paths = {"PFAM": os.path.join(self.pfam_hmm_dir, 'individual_hmms'),
"TIGRFAM": os.path.join(os.path.dirname(self.tigrfam_hmm_dir), 'individual_hmms')}
marker_dict_original = {}
if marker_set_id == "bac120":
for db_marker in sorted(self.bac120_markers):
marker_dict_original.update({marker.replace(".HMM", "").replace(".hmm", ""):
os.path.join(
marker_paths[db_marker], marker)
for marker in self.bac120_markers[db_marker]})
elif marker_set_id == "ar122":