How to use the genomepy.utils.run_index_cmd function in genomepy

To help you get started, we’ve selected a few genomepy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vanheeringen-lab / genomepy / genomepy / plugins / gmap.py View on Github external
# Create index dir
        index_dir = genome.props["gmap"]["index_dir"]
        if force:
            # Start from scratch
            rmtree(index_dir, ignore_errors=True)

        if not os.path.exists(index_dir):
            # unzip genome if zipped and return up-to-date genome name
            bgzip, fname = bgunzip_and_name(genome)

            # gmap outputs a folder named genome.name
            # its content is moved to index dir, consistent with other plugins
            with TemporaryDirectory() as tmpdir:
                # Create index
                cmd = "gmap_build -D {} -d {} {}".format(tmpdir, genome.name, fname)
                run_index_cmd("gmap", cmd)

                # Move files to index_dir
                src = os.path.join(tmpdir, genome.name)
                move(src, index_dir)

            # re-zip genome if unzipped
            bgrezip(bgzip, fname)
github vanheeringen-lab / genomepy / genomepy / plugins / hisat2.py View on Github external
# Create index dir
        index_dir = genome.props["hisat2"]["index_dir"]
        index_name = genome.props["hisat2"]["index_name"]
        if force:
            # Start from scratch
            rmtree(index_dir, ignore_errors=True)
        mkdir_p(index_dir)

        if not any(fname.endswith(".ht2") for fname in os.listdir(index_dir)):
            # unzip genome if zipped and return up-to-date genome name
            bgzip, fname = bgunzip_and_name(genome)

            # Create index
            cmd = "hisat2-build -p {} {} {}".format(threads, fname, index_name)
            run_index_cmd("hisat2", cmd)

            # re-zip genome if unzipped
            bgrezip(bgzip, fname)
github vanheeringen-lab / genomepy / genomepy / plugins / star.py View on Github external
index_dir = genome.props["star"]["index_dir"]
        index_name = genome.props["star"]["index_name"]
        if force:
            # Start from scratch
            rmtree(index_dir, ignore_errors=True)
        mkdir_p(index_dir)

        if not os.path.exists(index_name):
            # unzip genome if zipped and return up-to-date genome name
            bgzip, fname = bgunzip_and_name(genome)

            # Create index
            cmd = "STAR --runMode genomeGenerate --runThreadN {} --genomeFastaFiles {} --genomeDir {} --outFileNamePrefix {}".format(
                threads, fname, index_dir, index_dir
            )
            run_index_cmd("star", cmd)

            # re-zip genome if it was unzipped prior
            bgrezip(bgzip, fname)
github vanheeringen-lab / genomepy / genomepy / plugins / bowtie2.py View on Github external
return

        # Create index dir
        index_dir = genome.props["bowtie2"]["index_dir"]
        index_name = genome.props["bowtie2"]["index_name"]
        if force:
            # Start from scratch
            rmtree(index_dir, ignore_errors=True)
        mkdir_p(index_dir)

        if not any(fname.endswith(".bt2") for fname in os.listdir(index_dir)):
            # Create index
            cmd = "bowtie2-build --threads {} {} {}".format(
                threads, genome.filename, index_name
            )
            run_index_cmd("bowtie2", cmd)
github vanheeringen-lab / genomepy / genomepy / plugins / minimap2.py View on Github external
def after_genome_download(self, genome, threads=1, force=False):
        if not cmd_ok("minimap2"):
            return

        # Create index dir
        index_dir = genome.props["minimap2"]["index_dir"]
        index_name = genome.props["minimap2"]["index_name"]
        if force:
            # Start from scratch
            rmtree(index_dir, ignore_errors=True)
        mkdir_p(index_dir)

        if not any(fname.endswith(".mmi") for fname in os.listdir(index_dir)):
            # Create index
            cmd = "minimap2 -t {} -d {} {}".format(threads, index_name, genome.filename)
            run_index_cmd("minimap2", cmd)
github vanheeringen-lab / genomepy / genomepy / plugins / bwa.py View on Github external
# Create index dir
        index_dir = genome.props["bwa"]["index_dir"]
        index_name = genome.props["bwa"]["index_name"]
        if force:
            # Start from scratch
            rmtree(index_dir, ignore_errors=True)
        mkdir_p(index_dir)

        if not any(fname.endswith(".bwt") for fname in os.listdir(index_dir)):
            # Create index
            if not os.path.exists(index_name):
                os.symlink(genome.filename, index_name)

            cmd = "bwa index {}".format(index_name)
            run_index_cmd("bwa", cmd)