示例#1
0
    def run_real(self):
        """Runs the application and returns the exit code"""
        if not self.args:
            self.args = ["-"]
        else:
            self.sequence_file, self.hmm_file = self.args

        # if the sequences file is empty (i.e. all the sequences are
        # covered by InterPro), then we return
        if os.stat(self.sequence_file).st_size == 0:
            return 0

        # Finds hmmsearch in the current path if needed, ensure that
        # the paths are absolute.
        for util in ["hmmsearch", "hmmpress"]:
            optkey = "%s_path" % util
            path = getattr(self.options, optkey)
            if not path:
                path = search_file(util, executable=True)
                if not path:
                    self.error("cannot find %s in system path" % util)
            setattr(self.options, optkey, os.path.abspath(path))

        # we create a temporal file to store the HMM output
        hmm_output = self.create_temp_file()
        if not self.press_hmm_library():
            return 1
        if not self.run_hmm_search(hmm_output):
            return 1

        table = self.process_hmm_output(hmm_output)
        self.write_table(table)
示例#2
0
    def run_real(self):
        """Runs the application and returns the exit code"""
        if not self.args:
            self.args = ["-"]
        else:
            self.sequence_file, self.hmm_file = self.args

        # if the sequences file is empty (i.e. all the sequences are
        # covered by InterPro), then we return
        if os.stat(self.sequence_file).st_size == 0:
            return 0

        # Finds hmmsearch in the current path if needed, ensure that
        # the paths are absolute.
        for util in ["hmmsearch", "hmmpress"]:
            optkey = "%s_path" % util
            path = getattr(self.options, optkey)
            if not path:
                path = search_file(util, executable=True)
                if not path:
                    self.error("cannot find %s in system path" % util)
            setattr(self.options, optkey, os.path.abspath(path))

        # we create a temporal file to store the HMM output
        hmm_output = self.create_temp_file()
        if not self.press_hmm_library():
            return 1
        if not self.run_hmm_search(hmm_output):
            return 1

        table = self.process_hmm_output(hmm_output)
        self.write_table(table)
        return 0
示例#3
0
文件: blast_all.py 项目: ntamas/gfam
    def run_real(self):
        """Runs the application and returns the exit code"""
        if not self.args:
            self.args = ["-"]

        # Find formatdb and blastall in the current path if needed, ensure that
        # the paths are absolute.
        for util in ["formatdb", "blastall"]:
            optkey = "%s_path" % util
            path = getattr(self.options, optkey)
            if not path:
                path = search_file(util, executable=True)
                if not path:
                    self.error("cannot find %s in system path" % util)
            setattr(self.options, optkey, os.path.abspath(path))

        for arg in self.args:
            if not self.process_file(arg):
                return 1
示例#4
0
    def run_real(self):
        """Runs the application and returns the exit code"""
        if not self.args:
            self.args = ["-"]

        # Find formatdb and blastall in the current path if needed, ensure that
        # the paths are absolute.
        for util in ["formatdb", "blastall"]:
            optkey = "%s_path" % util
            path = getattr(self.options, optkey)
            if not path:
                path = search_file(util, executable=True)
                if not path:
                    self.error("cannot find %s in system path" % util)
            setattr(self.options, optkey, os.path.abspath(path))

        for arg in self.args:
            if not self.process_file(arg):
                return 1