How to run Snakemake pipeline from .py file instead of .smk file.
0
0
Entering edit mode
5.3 years ago

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

Thanks!

Snakemake Python Pipeline • 2.5k views
ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
1
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
1
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2591 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6