Entering edit mode
5.9 years ago
Artem Kiselev
▴
50
Hi, for my purpose I want to write snakemake rules as part of python (.py) execution file, how to do it right?
Thanks!
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.
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.
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.
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.
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.
Thank you, I described the problem very confusingly. The question was about dynamic writing of snakemake file, using python.
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?
Extensions are meaningless (largely). Doesn't matter what it ends with.