define alternative rules with snakemake
Hello I am new with snakemake and I need some help.
My goal is to index a genome (with bowtie2)
But I need some alternative steps depending of the files that are available
1> check if index already exist in storage (/storage/index)
2> if yes, copy index in local (/index)
3> if no, create index in local (/index)
4> then copy new index in storage (/storage/index)
I managed to setup a bash script to check the existing file and the alternative workflows. But I wish to use snakemake and I am not sure how to define the rules to obtain a similar behavior.
snakemake
add a comment |
Hello I am new with snakemake and I need some help.
My goal is to index a genome (with bowtie2)
But I need some alternative steps depending of the files that are available
1> check if index already exist in storage (/storage/index)
2> if yes, copy index in local (/index)
3> if no, create index in local (/index)
4> then copy new index in storage (/storage/index)
I managed to setup a bash script to check the existing file and the alternative workflows. But I wish to use snakemake and I am not sure how to define the rules to obtain a similar behavior.
snakemake
I would suggest showing what you have tried so far and where you ran into problems.
– JeeYem
Jan 2 at 16:53
add a comment |
Hello I am new with snakemake and I need some help.
My goal is to index a genome (with bowtie2)
But I need some alternative steps depending of the files that are available
1> check if index already exist in storage (/storage/index)
2> if yes, copy index in local (/index)
3> if no, create index in local (/index)
4> then copy new index in storage (/storage/index)
I managed to setup a bash script to check the existing file and the alternative workflows. But I wish to use snakemake and I am not sure how to define the rules to obtain a similar behavior.
snakemake
Hello I am new with snakemake and I need some help.
My goal is to index a genome (with bowtie2)
But I need some alternative steps depending of the files that are available
1> check if index already exist in storage (/storage/index)
2> if yes, copy index in local (/index)
3> if no, create index in local (/index)
4> then copy new index in storage (/storage/index)
I managed to setup a bash script to check the existing file and the alternative workflows. But I wish to use snakemake and I am not sure how to define the rules to obtain a similar behavior.
snakemake
snakemake
asked Jan 2 at 7:47
Maxime HebrardMaxime Hebrard
285
285
I would suggest showing what you have tried so far and where you ran into problems.
– JeeYem
Jan 2 at 16:53
add a comment |
I would suggest showing what you have tried so far and where you ran into problems.
– JeeYem
Jan 2 at 16:53
I would suggest showing what you have tried so far and where you ran into problems.
– JeeYem
Jan 2 at 16:53
I would suggest showing what you have tried so far and where you ran into problems.
– JeeYem
Jan 2 at 16:53
add a comment |
1 Answer
1
active
oldest
votes
Your psedocode logic, as it is, seems to create cyclical dependency problem in snakemake. So to make it simpler, I changed step3 to if no, create new index in storage (/storage/index)
and this allows step4 to be same as step1.
rule create_index:
input:
"/storage/index/a.fa"
output:
"/storage/index/a.idx"
message:
"Create index at source dir"
shell:
'''
index_tool {input} {output}
'''
rule copy_index:
input:
"/storage/index/a.idx"
output:
"/local/index/a.idx"
message:
"copy index to local dir"
shell:
'''
cp {input} {output}
'''
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I assumed this would be possible because of your step4. An ugly workaround is you excludeinput:
, just defineoutput:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.
– JeeYem
Jan 3 at 15:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002881%2fdefine-alternative-rules-with-snakemake%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your psedocode logic, as it is, seems to create cyclical dependency problem in snakemake. So to make it simpler, I changed step3 to if no, create new index in storage (/storage/index)
and this allows step4 to be same as step1.
rule create_index:
input:
"/storage/index/a.fa"
output:
"/storage/index/a.idx"
message:
"Create index at source dir"
shell:
'''
index_tool {input} {output}
'''
rule copy_index:
input:
"/storage/index/a.idx"
output:
"/local/index/a.idx"
message:
"copy index to local dir"
shell:
'''
cp {input} {output}
'''
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I assumed this would be possible because of your step4. An ugly workaround is you excludeinput:
, just defineoutput:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.
– JeeYem
Jan 3 at 15:59
add a comment |
Your psedocode logic, as it is, seems to create cyclical dependency problem in snakemake. So to make it simpler, I changed step3 to if no, create new index in storage (/storage/index)
and this allows step4 to be same as step1.
rule create_index:
input:
"/storage/index/a.fa"
output:
"/storage/index/a.idx"
message:
"Create index at source dir"
shell:
'''
index_tool {input} {output}
'''
rule copy_index:
input:
"/storage/index/a.idx"
output:
"/local/index/a.idx"
message:
"copy index to local dir"
shell:
'''
cp {input} {output}
'''
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I assumed this would be possible because of your step4. An ugly workaround is you excludeinput:
, just defineoutput:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.
– JeeYem
Jan 3 at 15:59
add a comment |
Your psedocode logic, as it is, seems to create cyclical dependency problem in snakemake. So to make it simpler, I changed step3 to if no, create new index in storage (/storage/index)
and this allows step4 to be same as step1.
rule create_index:
input:
"/storage/index/a.fa"
output:
"/storage/index/a.idx"
message:
"Create index at source dir"
shell:
'''
index_tool {input} {output}
'''
rule copy_index:
input:
"/storage/index/a.idx"
output:
"/local/index/a.idx"
message:
"copy index to local dir"
shell:
'''
cp {input} {output}
'''
Your psedocode logic, as it is, seems to create cyclical dependency problem in snakemake. So to make it simpler, I changed step3 to if no, create new index in storage (/storage/index)
and this allows step4 to be same as step1.
rule create_index:
input:
"/storage/index/a.fa"
output:
"/storage/index/a.idx"
message:
"Create index at source dir"
shell:
'''
index_tool {input} {output}
'''
rule copy_index:
input:
"/storage/index/a.idx"
output:
"/local/index/a.idx"
message:
"copy index to local dir"
shell:
'''
cp {input} {output}
'''
answered Jan 2 at 23:21
JeeYemJeeYem
1,227924
1,227924
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I assumed this would be possible because of your step4. An ugly workaround is you excludeinput:
, just defineoutput:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.
– JeeYem
Jan 3 at 15:59
add a comment |
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I assumed this would be possible because of your step4. An ugly workaround is you excludeinput:
, just defineoutput:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.
– JeeYem
Jan 3 at 15:59
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I get your point. But in my setup I cannot create the index directly in storage. I need to create the index in local then copy into storage.
– Maxime Hebrard
Jan 3 at 9:45
I assumed this would be possible because of your step4. An ugly workaround is you exclude
input:
, just define output:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.– JeeYem
Jan 3 at 15:59
I assumed this would be possible because of your step4. An ugly workaround is you exclude
input:
, just define output:
, and let your bash script do the job for you. Of course, you will be missing out on snakemake's advantages.– JeeYem
Jan 3 at 15:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002881%2fdefine-alternative-rules-with-snakemake%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I would suggest showing what you have tried so far and where you ran into problems.
– JeeYem
Jan 2 at 16:53