Ejemplo n.º 1
0
    def check_version(self):
        """checks the installed version of eggnog-mapper, sets the parser"""

        if self.annotation and not self.use_version:
            raise ConfigError("You must provide a version number to use if you have your own annotations.")
        elif not self.annotation and self.use_version:
            raise ConfigError("If you are not providing any annotations, you must let anvi'o figure out what\
                               version of emapper to use.")


        if self.annotation:
            version_to_use = self.use_version
            pass
        else:
            utils.is_program_exists(self.executable)
            output, ret_code = utils.get_command_output_from_shell('%s --version' % self.executable)
            version_to_use = output.split('\n')[0].split('-')[1]

        if version_to_use not in self.available_parsers:
            if self.annotation:
                raise ConfigError("Anvi'o does not know about the version you requested. Here are the ones available: %s" % \
                                                        (', '.join(list(self.available_parsers.keys()))))
            else:
                raise ConfigError("Bad news :( This version of anvi'o does not have a parser for the eggnog-mapper installed\
                                    on your system. This is the version you have on your system (if this looks totally alien\
                                    to you it may indicate another problem, in which case consider writing to anvi'o developers):\
                                    %s. For your reference, these are the versions anvi'o knows what to do with: %s" % \
                                                        (version_to_use, ', '.join(list(self.available_parsers.keys()))))

        self.version_to_use = version_to_use 
        self.parser = self.available_parsers[version_to_use]
Ejemplo n.º 2
0
    def check_programs(self, quiet=False):
        utils.is_program_exists(self.program_name)

        output, ret_code = utils.get_command_output_from_shell(
            '%s -h' % self.program_name)
        try:
            version_found = output.split(b'\n')[1].split()[1].split(
                b':')[0].lower().decode("utf-8")
            if not quiet:
                self.run.info('%s version found' % self.program_name,
                              version_found,
                              mc="green",
                              nl_after=1)
        except:
            version_found = 'Unknown'
            self.run.warning(
                "Anvi'o failed to learn the version of %s installed on this system :/"
                % self.program_name)

        if version_found not in self.tested_versions:
            self.run.warning("The version of %s installed on your system ('%s') is not one of those that we tested its anvi'o driver "
                             "with. Anvi'o will continue to try to run everything as if this didn't happen. If you see this warning "
                             "but everything works fine, let us know so we can include this version number into the list of 'tested' "
                             "version numbers. If you see an unexpected error, please consider installing one of these versions "
                             "of tRNAScan-SE (and again please let us know anyway so we can address it for later): '%s'" % \
                                           (self.program_name, version_found, ', '.join(list(self.tested_versions))))

        self.installed_version = version_found
Ejemplo n.º 3
0
    def blastp_stdout(self):

        cmd_line = [
            'diamond', 'blastp', '-q', self.query_fasta, '-d',
            self.target_fasta, '-p', self.num_threads
        ]

        cmd_line.append('--sensitive') if self.sensitive else None

        if self.max_target_seqs:
            cmd_line.extend(['--max-target-seqs', self.max_target_seqs])

        if self.min_pct_id:
            cmd_line.extend(['--id', self.min_pct_id])

        if self.evalue:
            cmd_line.extend(['--evalue', self.evalue])

        self.run.info('DIAMOND blastp cmd',
                      ' '.join([str(p) for p in cmd_line]),
                      quiet=(not anvio.DEBUG))

        shell_cmd_line = ' '.join(str(x) for x in cmd_line)
        out_bytes, ret_code = utils.get_command_output_from_shell(
            shell_cmd_line)

        try:
            decode_out = out_bytes.decode("utf-8")
        except:
            decode_out = out_bytes

        return (decode_out)
Ejemplo n.º 4
0
    def check_version(self, use_version=None):
        """checks the installed version of eggnog-mapper, sets the parser"""

        utils.is_program_exists(self.executable)

        if not use_version:
            output, ret_code = utils.get_command_output_from_shell(
                '%s --version' % self.executable)
            version_found = output.split('\n')[0].split('-')[1]
        else:
            version_found = use_version

        if version_found not in self.available_parsers:
            if use_version:
                raise ConfigError, "Anvi'o does not know about the version you requested. Here are the ones available: %s" % \
                                                        (', '.join(self.available_parsers.keys()))
            else:
                raise ConfigError, "Bad news :( This version of anvi'o does not have a parser for the eggnog-mapper installed\
                                    on your system. This is the version you have on your system (if this looks totally alien\
                                    to you it may indicate another problem, in which case consider writing to anvi'o developers):\
                                    %s. For your reference, these are the versions anvi'o knows what to do with: %s"                                                                                                                     % \
                                                        (version_found, ', '.join(self.available_parsers.keys()))

        self.installed_version = version_found
        self.parser = self.available_parsers[version_found]
Ejemplo n.º 5
0
    def check_version(self):
        """checks the installed version of eggnog-mapper, sets the parser"""

        if self.annotation and not self.use_version:
            raise ConfigError("You must provide a version number to use if you have your own annotations.")
        elif not self.annotation and self.use_version:
            raise ConfigError("If you are not providing any annotations, you must let anvi'o figure out what "
                              "version of emapper to use.")


        if self.annotation:
            version_to_use = self.use_version
            pass
        else:
            utils.is_program_exists(self.executable)
            output, ret_code = utils.get_command_output_from_shell('%s --version' % self.executable)
            version_to_use = output.split('\n')[0].split('-')[1]

        if version_to_use not in self.available_parsers:
            if self.annotation:
                raise ConfigError("Anvi'o does not know about the version you requested. Here are the ones available: %s" % \
                                                        (', '.join(list(self.available_parsers.keys()))))
            else:
                raise ConfigError("Bad news :( This version of anvi'o does not have a parser for the eggnog-mapper installed "
                                   "on your system. This is the version you have on your system (if this looks totally alien "
                                   "to you it may indicate another problem, in which case consider writing to anvi'o developers): "
                                   "%s. For your reference, these are the versions anvi'o knows what to do with: %s" % \
                                                        (version_to_use, ', '.join(list(self.available_parsers.keys()))))

        self.version_to_use = version_to_use 
        self.parser = self.available_parsers[version_to_use]
Ejemplo n.º 6
0
    def check_version(self):
        """checks the installed version of prodigal, sets the parser"""

        utils.is_program_exists('prodigal')
        output, ret_code = utils.get_command_output_from_shell('prodigal -v')

        prodigal_version_found = output.split('\n')[1].split()[1].split(':')[0].lower()

        if prodigal_version_found not in self.ok_prodigal_versions:
            raise ConfigError, "The prodigal version installed on your system is not compatible\
                                with any of the versions anvi'o can work with. Please install\
                                any of the following versions: %s" % (', '.join(self.ok_prodigal_versions.keys()))

        self.installed_prodigal_version = prodigal_version_found
        self.parser = self.ok_prodigal_versions[prodigal_version_found]
Ejemplo n.º 7
0
    def check_version(self):
        """checks the installed version of prodigal, sets the parser"""

        utils.is_program_exists('prodigal')
        output, ret_code = utils.get_command_output_from_shell('prodigal -v')

        version_found = output.split('\n')[1].split()[1].split(':')[0].lower()

        if version_found not in self.available_parsers:
            raise ConfigError, "The prodigal version installed on your system is not compatible\
                                with any of the versions anvi'o can work with. Please install\
                                any of the following versions: %s" % (', '.join(self.available_parsers.keys()))

        self.installed_version = version_found
        self.parser = self.available_parsers[version_found]