pipelines/genome_search_utils.py
def run(self):
        """
        Main function that organises genome search directories based on
        genome size
        """
        # get updir location
        upid_fasta = os.path.join(self.updir, self.upid + '.fa')
        seq_chunks_dir = os.path.join(self.updir, "search_chunks")

        if not os.path.exists(seq_chunks_dir):
            os.mkdir(seq_chunks_dir)
            os.chmod(seq_chunks_dir, 0777)

            # check if we need to split the seq_file
            if gsu.count_nucleotides_in_fasta(upid_fasta) >= gc.SPLIT_SIZE:
                # split sequence file into smalled chunks
                gsu.split_seq_file(upid_fasta, gc.SPLIT_SIZE, dest_dir=seq_chunks_dir)

                # now index the fasta files
                seq_files = os.listdir(seq_chunks_dir)
                for seq_file in seq_files:
                    seq_file_loc = os.path.join(seq_chunks_dir, seq_file)
                    cmd = "%s --index %s" % (conf.ESL_SFETCH, seq_file_loc)
                    subprocess.call(cmd, shell=True)

            # for input consistency if the sequence file is small, copy it in the
            # search_chunks directory
            else:
                # copy file
                shutil.copyfile(upid_fasta, os.path.join(seq_chunks_dir,
                                                         self.upid + '.fa'))
                # index file
                cmd = "%s --index %s" % (conf.ESL_SFETCH, os.path.join(seq_chunks_dir,
                                                                       self.upid + '.fa'))
                subprocess.call(cmd, shell=True)

        Main function that organises genome search directories based on
        genome size
        
Main function that organises genome search directories based on
genome size
Main function that organises genome search directories based on genome size
def run(self):
        upid_fasta = os.path.join(self.updir, self.upid + '.fa')
        seq_chunks_dir = os.path.join(self.updir, "search_chunks")
        if not os.path.exists(seq_chunks_dir):
            os.mkdir(seq_chunks_dir)
            os.chmod(seq_chunks_dir, 0777)
            if gsu.count_nucleotides_in_fasta(upid_fasta) >= gc.SPLIT_SIZE:
                gsu.split_seq_file(upid_fasta, gc.SPLIT_SIZE, dest_dir=seq_chunks_dir)
                seq_files = os.listdir(seq_chunks_dir)
                for seq_file in seq_files:
                    seq_file_loc = os.path.join(seq_chunks_dir, seq_file)
                    cmd = "%s --index %s" % (conf.ESL_SFETCH, seq_file_loc)
                    subprocess.call(cmd, shell=True)
            else:
                shutil.copyfile(upid_fasta, os.path.join(seq_chunks_dir,
                                                         self.upid + '.fa'))
                cmd = "%s --index %s" % (conf.ESL_SFETCH, os.path.join(seq_chunks_dir,
                                                                       self.upid + '.fa'))
                subprocess.call(cmd, shell=True)
def run ( self ) : upid_fasta = os . path . join ( self . updir , self . upid + '.fa' ) seq_chunks_dir = os . path . join ( self . updir , "search_chunks" ) if not os . path . exists ( seq_chunks_dir ) : os . mkdir ( seq_chunks_dir ) os . chmod ( seq_chunks_dir , 0777 ) if gsu . count_nucleotides_in_fasta ( upid_fasta ) >= gc . SPLIT_SIZE : gsu . split_seq_file ( upid_fasta , gc . SPLIT_SIZE , dest_dir = seq_chunks_dir ) seq_files = os . listdir ( seq_chunks_dir ) for seq_file in seq_files : seq_file_loc = os . path . join ( seq_chunks_dir , seq_file ) cmd = "%s --index %s" % ( conf . ESL_SFETCH , seq_file_loc ) subprocess . call ( cmd , shell = True ) else : shutil . copyfile ( upid_fasta , os . path . join ( seq_chunks_dir , self . upid + '.fa' ) ) cmd = "%s --index %s" % ( conf . ESL_SFETCH , os . path . join ( seq_chunks_dir , self . upid + '.fa' ) ) subprocess . call ( cmd , shell = True )
Main function that organises genome search directories based on
genome size
Main function that organises genome search directories based on genome size
"""
        Main function that organises genome search directories based on
        genome size
        """ # get updir location # check if we need to split the seq_file # split sequence file into smalled chunks # now index the fasta files # for input consistency if the sequence file is small, copy it in the # search_chunks directory # copy file # index file
self