Question: How to run Snakemake pipeline from .py file instead of .smk file.
0
gravatar for Artem Kiselev
9 months ago by
Russian Federation
Artem Kiselev20 wrote:

Hi, for my purpose I want to write snakemake rules as part of python (.py) execution file, how to do it right?

Thanks!

snakemake pipeline python • 355 views
ADD COMMENTlink modified 9 months ago • written 9 months ago by Artem Kiselev20
1

Please elaborate on what you are trying to do. Your current question does not contain enough information.

I also have no idea why you would like to do this.

ADD REPLYlink written 9 months ago by WouterDeCoster41k

My idea is the using of KNIME Analytics Platform for organisation of my SNP-calling pipeline, but despite the strong GUI capabilities, KNIME don't have enough good abilities for running of external programs (parallelism, etc). Inside of KNIME there is ability to run pure python scripts (form Knime gui with sort of IDE). I want to run of snakemake rules, directly from KNIME, using its capabilities to work with Python. In this case, I will be able to use all the KNIME features (for example flow variables) and convenient Snakemake features.

ADD REPLYlink written 9 months ago by Artem Kiselev20
1

I'm not familiar with KNIME, but by running snakemake in python in KNIME it sounds like you are stacking too many layers of complexity.

I also suspect that everything you want from KNIME can be done directly in snakemake and it would probably be easier not to complicate all of this.

Another advantage of snakemake is its reproducibility - for example, share your pipeline upon publication. That feature is probably entirely lost in your application.

ADD REPLYlink written 9 months ago by WouterDeCoster41k

Thanks for your comment, but it seems to me that it is more convenient to use a graphical interface for organizing scientific work, it is rather difficult to understand a large number of files, protocols and versions. With the help of KNIME, I have organized a very convenient pipeline for working with R based DeSeq2, it is very easy to reproduce, correct and share with colleagues.

ADD REPLYlink written 9 months ago by Artem Kiselev20
1

I completely agree with Wouter, this seems needlessly complex and likely more difficult to maintain than a straightforward snakemake pipeline.

Regardless, the subprocess module will let you call external commands from within python. Basically all I can point you to with the complete lack of details regarding what you specifically want, so I'm making the assumption that you're pre-creating your snakemake file and just want it to be run from a python script initiated by KNIME. If you're looking to actually write the snakemake file dynamically with variables, etc, from KNIME, then your question is likely way beyond the scope of biostars.

ADD REPLYlink written 9 months ago by jared.andrews073.4k

Thank you, I described the problem very confusingly. The question was about dynamic writing of snakemake file, using python.

ADD REPLYlink written 9 months ago by Artem Kiselev20

Yeah, then you really just need to write a file with python and use variables to change anything dynamic as needed. What specifically are you having an issue with?

ADD REPLYlink written 9 months ago by jared.andrews073.4k
1

Extensions are meaningless (largely). Doesn't matter what it ends with.

ADD REPLYlink written 9 months ago by Joe14k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2541 users visited in the last hour