pipelines/genome_search_utils.py
def run(self):
        """
        Call load_upid_gca_file to export all upid_gca accession pairs in
        json format.
        """
        id_pairs = None

        upids = []
        if self.genome_list is None:
            upid_gca_file_loc = os.path.join(self.project_dir, "upid_gca_dict.json")
            upid_gca_fp = open(upid_gca_file_loc, 'r')
            accessions = json.load(upid_gca_fp)
            upid_gca_fp.close()

            upids = accessions.keys()

        else:
            upid_list_fp = open(self.genome_list, 'r')
            upids = [x.strip() for x in upid_list_fp]
            upid_list_fp.close()

        cmd = ''
        for upid in upids:
            subdir = os.path.join(self.project_dir, upid[-3:])
            updir = os.path.join(subdir, upid)

            if os.path.exists(updir):
                # Merge Genomes
                if self.tool.lower() == 'famerge':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s MergeGenomeFasta --updir %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                          os.path.join(updir, "merge.out"),
                                                                          os.path.join(updir, "merge.err"),
                                                                          gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                          os.path.realpath(__file__), updir)
                    else:
                        cmd = "python \"{this_file}\" MergeGenomeFasta --updir {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir)

                elif self.tool.lower() == 'fasplit':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s SplitGenomeFasta --updir %s --upid %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                      os.path.join(updir, "split.out"),
                                                                      os.path.join(updir, "split.err"),
                                                                      gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                      os.path.realpath(__file__), updir, upid)

                    else:
                        cmd = "python \"{this_file}\" SplitGenomeFasta --updir {upid} --upid {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir,
                            upid=upid)

                elif self.tool.lower() == 'faclean':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s RewriteCleanFasta --updir %s --upid %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                                         os.path.join(updir,
                                                                                                      "clean.out"),
                                                                                         os.path.join(updir,
                                                                                                      "clean.err"),
                                                                                         gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                                         os.path.realpath(__file__),
                                                                                         updir, upid)

                    else:
                        cmd = "python \"{this_file}\" RewriteCleanFasta --updir {upid} --upid {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir,
                            upid=upid)

                elif self.tool.lower() == 'tblmerge':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s MergeGenomeTBLOUT --updir %s --upid %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                               os.path.join(updir, "tbl_merge.out"),
                                                                               os.path.join(updir, "tbl_merge.err"),
                                                                               gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                               os.path.realpath(__file__),
                                                                                          updir, upid)
                    else:
                        cmd = "python \"{this_file}\" MergeGenomeTBLOUT --updir {upid} --upid {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir,
                            upid=upid)

            subprocess.call(cmd, shell=True)

            cmd = ''

        Call load_upid_gca_file to export all upid_gca accession pairs in
        json format.
        
Call load_upid_gca_file to export all upid_gca accession pairs in
json format.
Call load_upid_gca_file to export all upid_gca accession pairs in json format .
def run(self):
        id_pairs = None
        upids = []
        if self.genome_list is None:
            upid_gca_file_loc = os.path.join(self.project_dir, "upid_gca_dict.json")
            upid_gca_fp = open(upid_gca_file_loc, 'r')
            accessions = json.load(upid_gca_fp)
            upid_gca_fp.close()
            upids = accessions.keys()
        else:
            upid_list_fp = open(self.genome_list, 'r')
            upids = [x.strip() for x in upid_list_fp]
            upid_list_fp.close()
        cmd = ''
        for upid in upids:
            subdir = os.path.join(self.project_dir, upid[-3:])
            updir = os.path.join(subdir, upid)
            if os.path.exists(updir):
                if self.tool.lower() == 'famerge':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s MergeGenomeFasta --updir %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                          os.path.join(updir, "merge.out"),
                                                                          os.path.join(updir, "merge.err"),
                                                                          gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                          os.path.realpath(__file__), updir)
                    else:
                        cmd = "python \"{this_file}\" MergeGenomeFasta --updir {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir)
                elif self.tool.lower() == 'fasplit':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s SplitGenomeFasta --updir %s --upid %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                      os.path.join(updir, "split.out"),
                                                                      os.path.join(updir, "split.err"),
                                                                      gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                      os.path.realpath(__file__), updir, upid)
                    else:
                        cmd = "python \"{this_file}\" SplitGenomeFasta --updir {upid} --upid {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir,
                            upid=upid)
                elif self.tool.lower() == 'faclean':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s RewriteCleanFasta --updir %s --upid %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                                         os.path.join(updir,
                                                                                                      "clean.out"),
                                                                                         os.path.join(updir,
                                                                                                      "clean.err"),
                                                                                         gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                                         os.path.realpath(__file__),
                                                                                         updir, upid)
                    else:
                        cmd = "python \"{this_file}\" RewriteCleanFasta --updir {upid} --upid {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir,
                            upid=upid)
                elif self.tool.lower() == 'tblmerge':
                    if self.lsf is True:
                        cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " \
                              "-g %s python %s MergeGenomeTBLOUT --updir %s --upid %s" % (gc.MEM, gc.MEM, gc.TMP_MEM,
                                                                               os.path.join(updir, "tbl_merge.out"),
                                                                               os.path.join(updir, "tbl_merge.err"),
                                                                               gc.USER_EMAIL, gc.SRCH_GROUP,
                                                                               os.path.realpath(__file__),
                                                                                          updir, upid)
                    else:
                        cmd = "python \"{this_file}\" MergeGenomeTBLOUT --updir {upid} --upid {upid}".format(
                            this_file=os.path.realpath(__file__),
                            updir=updir,
                            upid=upid)
            subprocess.call(cmd, shell=True)
            cmd = ''
def run ( self ) : id_pairs = None upids = [ ] if self . genome_list is None : upid_gca_file_loc = os . path . join ( self . project_dir , "upid_gca_dict.json" ) upid_gca_fp = open ( upid_gca_file_loc , 'r' ) accessions = json . load ( upid_gca_fp ) upid_gca_fp . close ( ) upids = accessions . keys ( ) else : upid_list_fp = open ( self . genome_list , 'r' ) upids = [ x . strip ( ) for x in upid_list_fp ] upid_list_fp . close ( ) cmd = '' for upid in upids : subdir = os . path . join ( self . project_dir , upid [ - 3 : ] ) updir = os . path . join ( subdir , upid ) if os . path . exists ( updir ) : if self . tool . lower ( ) == 'famerge' : if self . lsf is True : cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " "-g %s python %s MergeGenomeFasta --updir %s" % ( gc . MEM , gc . MEM , gc . TMP_MEM , os . path . join ( updir , "merge.out" ) , os . path . join ( updir , "merge.err" ) , gc . USER_EMAIL , gc . SRCH_GROUP , os . path . realpath ( __file__ ) , updir ) else : cmd = "python \"{this_file}\" MergeGenomeFasta --updir {upid}" . format ( this_file = os . path . realpath ( __file__ ) , updir = updir ) elif self . tool . lower ( ) == 'fasplit' : if self . lsf is True : cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " "-g %s python %s SplitGenomeFasta --updir %s --upid %s" % ( gc . MEM , gc . MEM , gc . TMP_MEM , os . path . join ( updir , "split.out" ) , os . path . join ( updir , "split.err" ) , gc . USER_EMAIL , gc . SRCH_GROUP , os . path . realpath ( __file__ ) , updir , upid ) else : cmd = "python \"{this_file}\" SplitGenomeFasta --updir {upid} --upid {upid}" . format ( this_file = os . path . realpath ( __file__ ) , updir = updir , upid = upid ) elif self . tool . lower ( ) == 'faclean' : if self . lsf is True : cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " "-g %s python %s RewriteCleanFasta --updir %s --upid %s" % ( gc . MEM , gc . MEM , gc . TMP_MEM , os . path . join ( updir , "clean.out" ) , os . path . join ( updir , "clean.err" ) , gc . USER_EMAIL , gc . SRCH_GROUP , os . path . realpath ( __file__ ) , updir , upid ) else : cmd = "python \"{this_file}\" RewriteCleanFasta --updir {upid} --upid {upid}" . format ( this_file = os . path . realpath ( __file__ ) , updir = updir , upid = upid ) elif self . tool . lower ( ) == 'tblmerge' : if self . lsf is True : cmd = "bsub -M %s -R \"rusage[mem=%s,tmp=%s]\" -o %s -e %s -u %s -Ep \"rm -rf luigi\" " "-g %s python %s MergeGenomeTBLOUT --updir %s --upid %s" % ( gc . MEM , gc . MEM , gc . TMP_MEM , os . path . join ( updir , "tbl_merge.out" ) , os . path . join ( updir , "tbl_merge.err" ) , gc . USER_EMAIL , gc . SRCH_GROUP , os . path . realpath ( __file__ ) , updir , upid ) else : cmd = "python \"{this_file}\" MergeGenomeTBLOUT --updir {upid} --upid {upid}" . format ( this_file = os . path . realpath ( __file__ ) , updir = updir , upid = upid ) subprocess . call ( cmd , shell = True ) cmd = ''
Call load_upid_gca_file to export all upid_gca accession pairs in
json format.
Call load_upid_gca_file to export all upid_gca accession pairs in json format .
"""
        Call load_upid_gca_file to export all upid_gca accession pairs in
        json format.
        """ # Merge Genomes
self