snakemake | development home of the workflow management system Snakemake | BPM library

 by   snakemake HTML Version: 8.11.0 License: MIT

kandi X-RAY | snakemake Summary

kandi X-RAY | snakemake Summary

snakemake is a HTML library typically used in Automation, BPM, Docker applications. snakemake has no bugs, it has no vulnerabilities, it has a Permissive License and it has high support. You can download it from GitHub.

The Snakemake workflow management system is a tool to create reproducible and scalable data analyses. Snakemake is highly popular, with on average more than 6 new citations per week, and over 200k downloads. Workflows are described via a human readable, Python based language. They can be seamlessly scaled to server, cluster, grid and cloud environments without the need to modify the workflow definition. Finally, Snakemake workflows can entail a description of required software, which will be automatically deployed to any execution environment. Copyright (c) 2012-2022 Johannes Köster johannes.koester@uni-due.com (see LICENSE).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              snakemake has a highly active ecosystem.
              It has 1719 star(s) with 448 fork(s). There are 21 watchers for this library.
              There were 10 major release(s) in the last 6 months.
              There are 757 open issues and 544 have been closed. On average issues are closed in 128 days. There are 63 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of snakemake is 8.11.0

            kandi-Quality Quality

              snakemake has 0 bugs and 0 code smells.

            kandi-Security Security

              snakemake has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              snakemake code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              snakemake is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              snakemake releases are available to install and integrate.
              It has 34702 lines of code, 2259 functions and 134 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of snakemake
            Get all kandi verified functions for this library.

            snakemake Key Features

            No Key Features are available at this moment for snakemake.

            snakemake Examples and Code Snippets

            Snakemake expand() only applies on the first element of a list
            Pythondot img1Lines of Code : 9dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            x=expand(
            [
                "results/qc/{u.sample}.foo.txt",
                "results/qc/{u.sample}.foo.bar.txt",
            ],
            u=list(samples.itertuples())
            )
            print(x)
            
            Snakemake with integrated conda env not properly installed
            Pythondot img2Lines of Code : 8dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            name: multiqc 
            channels:
              - conda-forge
              - bioconda
            dependencies:
              - python=3.7
              - multiqc=1.12
            
            Getting command line flags from snakemake
            Pythondot img3Lines of Code : 4dot img3License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            if not workflow.use_conda:
                sys.stderr.write("Use conda\n")
                sys.exit(1)
            
            snakemake - accessing config variables from cluster submission wrapper
            Pythondot img4Lines of Code : 33dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            rule all:
                input:
                    "a.txt",
                    "b.txt",
            
            
            rule a:
                output:
                    "a.txt",
                shell:
                    """
                    echo {params.val} > {output}
                    """
            
            
            rule b:
                output:
                    "b.txt",
                shell:
                    """
                    
            Snakemake expand is generating unexpected combinations of two wildcards
            Pythondot img5Lines of Code : 14dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            # Snakefile
            samples = ['1', '2']
            batches = ['b1', 'b2']
            
            print(expand(['{sample}/{batch}/{sample}'], zip, sample=samples, batch=batches))
            
            $ snakemake -nq
            ['1/b1/1', '2/b2/2']
            
            trim = expand(
            Snakemake: How to force the creation of all conda environments
            Pythondot img6Lines of Code : 23dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            localrules: all, make_envs
            
            rule all:
                input:
                    # Maybe not needed:
                    expand('{env}.done', env= ['env1', 'env2'])
            
            
            rule make_envs:
                conda:
                    'workflow/envs/{env}.yaml',
                output:
                    touch('{env}.done'),
            
            
            ru
            Snakemake: MissingInputException - Missing input files for rule all
            Pythondot img7Lines of Code : 29dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            expand("{{sample}}/{sample}_phased_illumina_FILT5_{chrom}.vcf", sample=samples, chrom=chroms)
            
            samples = ['12NAE3', '15NOH7']
            chroms = ['chr01','chr02']
            
            rule ConcatVCF:
                input:
                    expand("{{sample}}/{sample
            How to use a wildcard within expand function parameters in snakemake?
            Pythondot img8Lines of Code : 34dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            d = {
                "foo": {
                    "bar1": {
                        "A1": {"name": "A1", "path": "/path/to/A1"},
                        "B1": {"name": "B1", "path": "/path/to/B1"},
                        "C1": {"name": "C1", "path": "/path/to/C1"},
                        "D1": {"name": "D1"
            Array of values as input in Snakemake workflows
            Pythondot img9Lines of Code : 35dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def process_lines(file_name):
                """generates id/run, ignoring non-numeric lines"""
                with open(file_name, "r") as f:
                    for line in f:
                        detector_id, run_number, *_ = line.split()
                        if detector_id.isnumeric() a
            Snakefile how to mix wildcards and variables
            Pythondot img10Lines of Code : 11dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            rule all:
                input:
                    expand("{your_path}.extension", replacements)
            
            rule make_output:
                input: "{input}_{num}.extension"
                output: "{output}_{num}.extension"
                shell:
                    copy_sph_to_wav {input} > {output}
                
            

            Community Discussions

            QUESTION

            Snakemake with integrated conda env not properly installed
            Asked 2022-Apr-11 at 11:47

            I have a rule in my snakemake pipeline to run multiqc :

            ...

            ANSWER

            Answered 2022-Apr-11 at 10:56

            You most likely want to install python as well, since according to docs it's not recommended to use the system-wide python:

            Source https://stackoverflow.com/questions/71825092

            QUESTION

            snakemake - accessing config variables from cluster submission wrapper
            Asked 2022-Mar-19 at 07:47

            I am using a cluster submission wrapper script with snakemake --cluster "python qsub_script.py". I need to pass a global variable, taken from the config['someVar']. This should be applied to all rules. I could add it to the params of each rule, and then access it using job_properties['params']['someVar'], but this is probably not the best solution. Is there a way to access config from the submission wrapper? Simply using config['someVar'] gives me a NameError.

            If that's not possible, can you suggest an alternative? I suspect using profiles could be helpful, but couldn't figure out how this interacts with the submission wrapper.

            ...

            ANSWER

            Answered 2022-Mar-19 at 07:47

            The problem statement is a bit broad, so the solution below might not be the most optimal, but it should achieve what you are looking for. Specifically, the code below allows modifying every rule in the workflow.

            Here's a reproducible demo:

            Source https://stackoverflow.com/questions/71484653

            QUESTION

            Generate many files with wildcard, then merge into one
            Asked 2022-Mar-07 at 11:43

            I have two rules on my Snakefile: one generates several sets of files using wildcards, the other one merges everything into a single file. This is how I wrote it:

            ...

            ANSWER

            Answered 2022-Mar-07 at 11:43

            In rule generate I think you don't want to escape the {chr} wildcard, otherwise it doesn't get replaced. I.e.:

            Source https://stackoverflow.com/questions/71367128

            QUESTION

            Snakemake: How to force the creation of all conda environments
            Asked 2022-Mar-04 at 10:07

            I am aware that by adding the option --conda-create-envs-only you are able to create the conda environments for the workflow. However, would it be possible to force the creation of all conda environments under workflow/envs/ without knowing the workflow DAG in advance?

            The reason is that I am planning to run snakemake on an HPC, and the compute nodes have no internet. As such I have to set up the environment in a build node with internet. The problem is that I can only access my input data in the compute nodes.

            ...

            ANSWER

            Answered 2022-Mar-04 at 10:07

            Maybe make the creation of the conda environments a target itself? Something like, not tested:

            Source https://stackoverflow.com/questions/71345313

            QUESTION

            Passing wildcard values in params in snakemake
            Asked 2022-Mar-02 at 18:45

            I am trying to clean a data pipeline by using snakemake. It looks like wildcards are what I need but I don't manage to make it work in params

            My function needs a parameter that depends on the wildcard value. For instance, let's say it depends on sample that can either be A or B.

            I tried the following (my example is more complicated but this is basically what I am trying to do) :

            ...

            ANSWER

            Answered 2022-Mar-02 at 18:45

            I think that you are trying to get the sample wildcard to use as a parameter in your script.

            The wc variable is an instance of snakemake.io.Wildcards which is a snakemake.io.Namedlist. You can call .get(key) on these objects, so we can use a lambda function to generate the params.

            samples_from_wc=lambda wc: wc.get("sample") and use this in the run/shell as params.samples_from_wc.

            Source https://stackoverflow.com/questions/71326692

            QUESTION

            Snakemake: MissingInputException - Missing input files for rule all
            Asked 2022-Feb-28 at 19:44

            I am trying to make a snakemake workflow for whatshap haplotype caller but I am struggling with MissingInputException errors. This is what I get:

            ...

            ANSWER

            Answered 2022-Feb-26 at 01:06

            Troy Comi has already answered your question in comments, but I will explain it further.

            Indeed, removing double braces will help. The difference between single and double braces is that double braces escape the symbol '{' and '}'. In other words whenever Snakemake encounters a string like this one "{{sample}}/{sample}_phased_illumina_FILT5.vcf.gz" in the output section, it treats {sample} as a wildcard and {{sample}} as a string "{sample}". So it tries to find the files like {sample}/saturna_phased_illumina_FILT5.vcf.gz which it definitely fails to find.

            The problem is quite different in case of using this string in the expand function:

            Source https://stackoverflow.com/questions/71249606

            QUESTION

            How to use a wildcard within expand function parameters in snakemake?
            Asked 2022-Feb-23 at 14:23

            I have a json file like so:

            ...

            ANSWER

            Answered 2022-Feb-22 at 13:11

            There is a possibility of using a custom combinatoric function in expand. Most often this function is zip, however, in your case the nested dictionary shape will require designing a custom function. Instead, a simpler solution is to use Python to construct the list of desired files.

            Source https://stackoverflow.com/questions/71221124

            QUESTION

            How to use pandas within snakemake pipelines
            Asked 2022-Feb-17 at 17:09

            I would like to improve the reproducibility of some python codes I made by transforming some codes into a data pipeline. I am used to targets in R and would like to find an equivalent in Python. I have the impression that snakemake is quite close to that.

            I don't understand how we can use pandas to import an input in a snakemake task, modify it and then write output.

            Let's take the easiest pipeline I can think of: we take a csv and write a copy somewhere else.

            The pipeline works fine when using bash script:

            ...

            ANSWER

            Answered 2022-Feb-17 at 17:08

            You are very close, the curly braces are not needed within run directive:

            Source https://stackoverflow.com/questions/71162082

            QUESTION

            Array of values as input in Snakemake workflows
            Asked 2022-Feb-16 at 14:10

            I started to migrate my workflows from Nextflow to Snakemake and already hitting the wall at the start of my pipelines which very often begin with a list of numbers (representing a "run number" from our detector).

            What I have for example is a run-list.txt like

            ...

            ANSWER

            Answered 2022-Feb-16 at 14:08

            To make this work you need two ingredients:

            1. a rule that specifies the logic for generating a single file (defining any file dependencies, if necessary)
            2. a rule that defines which file should be calculated, by convention this rule is called all.

            Here is a rough sketch of the code:

            Source https://stackoverflow.com/questions/71142612

            QUESTION

            Snakemake input rule defintion via lambda + Pandas dataframe
            Asked 2022-Feb-15 at 11:15

            Sorry if this is gonna be probably a duplication of other questions, but I couldn't figure to debug what's going on in my case. Got a dataframe like this:

            ...

            ANSWER

            Answered 2022-Feb-15 at 11:15

            The parameters are stored in a dataframe, and there is a handy utility for working with tabulated parameters, Paramspace. Below is a rough take on your specific case, but it will need some adjustments for command syntax and paths.

            First step is to reshape the data for easier workflow:

            Source https://stackoverflow.com/questions/71116406

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install snakemake

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install snakemake

          • CLONE
          • HTTPS

            https://github.com/snakemake/snakemake.git

          • CLI

            gh repo clone snakemake/snakemake

          • sshUrl

            git@github.com:snakemake/snakemake.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular BPM Libraries

            Try Top Libraries by snakemake

            snakemake-wrappers

            by snakemakePython

            snakefmt

            by snakemakePython

            snakemake-github-action

            by snakemakeShell

            snakedeploy

            by snakemakePython