Recursive input calling in Snakemake rule











up vote
0
down vote

favorite












I am writing rule to process some data:

data in directory will be something like:



myfirst.trim_1P, myfirst.trim_2P, mysecond.trim_1P, mysecond.trim_2P,...



rule trim_data:
input:"{dataset}/{sample}.trim_{r}P"
output:"{dataset}/{sample}.{r}.fastq"
params:
length=14
shell:
"""
reformat.sh forcetrimleft="{params.length}" in="{input}" out="{output}"
"""


I have this error:



WorkflowError:
RecursionError: maximum recursion depth exceeded
If building the DAG exceeds the recursion limit


myDir/myfirst.1.trimed.1.trimed.2.trimed.2.trimed.2....



Why it run in recursive way if the output different from the input? and how I can fix it?










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am writing rule to process some data:

    data in directory will be something like:



    myfirst.trim_1P, myfirst.trim_2P, mysecond.trim_1P, mysecond.trim_2P,...



    rule trim_data:
    input:"{dataset}/{sample}.trim_{r}P"
    output:"{dataset}/{sample}.{r}.fastq"
    params:
    length=14
    shell:
    """
    reformat.sh forcetrimleft="{params.length}" in="{input}" out="{output}"
    """


    I have this error:



    WorkflowError:
    RecursionError: maximum recursion depth exceeded
    If building the DAG exceeds the recursion limit


    myDir/myfirst.1.trimed.1.trimed.2.trimed.2.trimed.2....



    Why it run in recursive way if the output different from the input? and how I can fix it?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am writing rule to process some data:

      data in directory will be something like:



      myfirst.trim_1P, myfirst.trim_2P, mysecond.trim_1P, mysecond.trim_2P,...



      rule trim_data:
      input:"{dataset}/{sample}.trim_{r}P"
      output:"{dataset}/{sample}.{r}.fastq"
      params:
      length=14
      shell:
      """
      reformat.sh forcetrimleft="{params.length}" in="{input}" out="{output}"
      """


      I have this error:



      WorkflowError:
      RecursionError: maximum recursion depth exceeded
      If building the DAG exceeds the recursion limit


      myDir/myfirst.1.trimed.1.trimed.2.trimed.2.trimed.2....



      Why it run in recursive way if the output different from the input? and how I can fix it?










      share|improve this question















      I am writing rule to process some data:

      data in directory will be something like:



      myfirst.trim_1P, myfirst.trim_2P, mysecond.trim_1P, mysecond.trim_2P,...



      rule trim_data:
      input:"{dataset}/{sample}.trim_{r}P"
      output:"{dataset}/{sample}.{r}.fastq"
      params:
      length=14
      shell:
      """
      reformat.sh forcetrimleft="{params.length}" in="{input}" out="{output}"
      """


      I have this error:



      WorkflowError:
      RecursionError: maximum recursion depth exceeded
      If building the DAG exceeds the recursion limit


      myDir/myfirst.1.trimed.1.trimed.2.trimed.2.trimed.2....



      Why it run in recursive way if the output different from the input? and how I can fix it?







      snakemake






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 at 18:22

























      asked Nov 21 at 21:50









      Medhat Helmy

      934820




      934820
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          This is a wild guess... Maybe the wildcards capture more then they should since they are interpreted as regular expression. If {dataset}, {sample} and {r} take a defined list of values, try constraining their scope with:



          wildcard_constraints:
          dataset= '|'.join([re.escape(x) for x in DATASET]),
          sample= '|'.join([re.escape(x) for x in SAMPLE]),
          r= '|'.join([re.escape(x) for x in R]),


          Where DATASET, SAMPLE and R are lists of values (e.g. R= ['1', '2'])






          share|improve this answer





















          • Thanks, this could be the case I will test it and give feedback.
            – Medhat Helmy
            Nov 22 at 18:33










          • unfortunately, it did not work. I will try to figure something else, Thanks.
            – Medhat Helmy
            Nov 26 at 16:00










          • So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
            – Medhat Helmy
            Nov 26 at 20:23











          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',
          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420956%2frecursive-input-calling-in-snakemake-rule%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








          up vote
          0
          down vote













          This is a wild guess... Maybe the wildcards capture more then they should since they are interpreted as regular expression. If {dataset}, {sample} and {r} take a defined list of values, try constraining their scope with:



          wildcard_constraints:
          dataset= '|'.join([re.escape(x) for x in DATASET]),
          sample= '|'.join([re.escape(x) for x in SAMPLE]),
          r= '|'.join([re.escape(x) for x in R]),


          Where DATASET, SAMPLE and R are lists of values (e.g. R= ['1', '2'])






          share|improve this answer





















          • Thanks, this could be the case I will test it and give feedback.
            – Medhat Helmy
            Nov 22 at 18:33










          • unfortunately, it did not work. I will try to figure something else, Thanks.
            – Medhat Helmy
            Nov 26 at 16:00










          • So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
            – Medhat Helmy
            Nov 26 at 20:23















          up vote
          0
          down vote













          This is a wild guess... Maybe the wildcards capture more then they should since they are interpreted as regular expression. If {dataset}, {sample} and {r} take a defined list of values, try constraining their scope with:



          wildcard_constraints:
          dataset= '|'.join([re.escape(x) for x in DATASET]),
          sample= '|'.join([re.escape(x) for x in SAMPLE]),
          r= '|'.join([re.escape(x) for x in R]),


          Where DATASET, SAMPLE and R are lists of values (e.g. R= ['1', '2'])






          share|improve this answer





















          • Thanks, this could be the case I will test it and give feedback.
            – Medhat Helmy
            Nov 22 at 18:33










          • unfortunately, it did not work. I will try to figure something else, Thanks.
            – Medhat Helmy
            Nov 26 at 16:00










          • So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
            – Medhat Helmy
            Nov 26 at 20:23













          up vote
          0
          down vote










          up vote
          0
          down vote









          This is a wild guess... Maybe the wildcards capture more then they should since they are interpreted as regular expression. If {dataset}, {sample} and {r} take a defined list of values, try constraining their scope with:



          wildcard_constraints:
          dataset= '|'.join([re.escape(x) for x in DATASET]),
          sample= '|'.join([re.escape(x) for x in SAMPLE]),
          r= '|'.join([re.escape(x) for x in R]),


          Where DATASET, SAMPLE and R are lists of values (e.g. R= ['1', '2'])






          share|improve this answer












          This is a wild guess... Maybe the wildcards capture more then they should since they are interpreted as regular expression. If {dataset}, {sample} and {r} take a defined list of values, try constraining their scope with:



          wildcard_constraints:
          dataset= '|'.join([re.escape(x) for x in DATASET]),
          sample= '|'.join([re.escape(x) for x in SAMPLE]),
          r= '|'.join([re.escape(x) for x in R]),


          Where DATASET, SAMPLE and R are lists of values (e.g. R= ['1', '2'])







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 at 10:07









          dariober

          9061121




          9061121












          • Thanks, this could be the case I will test it and give feedback.
            – Medhat Helmy
            Nov 22 at 18:33










          • unfortunately, it did not work. I will try to figure something else, Thanks.
            – Medhat Helmy
            Nov 26 at 16:00










          • So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
            – Medhat Helmy
            Nov 26 at 20:23


















          • Thanks, this could be the case I will test it and give feedback.
            – Medhat Helmy
            Nov 22 at 18:33










          • unfortunately, it did not work. I will try to figure something else, Thanks.
            – Medhat Helmy
            Nov 26 at 16:00










          • So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
            – Medhat Helmy
            Nov 26 at 20:23
















          Thanks, this could be the case I will test it and give feedback.
          – Medhat Helmy
          Nov 22 at 18:33




          Thanks, this could be the case I will test it and give feedback.
          – Medhat Helmy
          Nov 22 at 18:33












          unfortunately, it did not work. I will try to figure something else, Thanks.
          – Medhat Helmy
          Nov 26 at 16:00




          unfortunately, it did not work. I will try to figure something else, Thanks.
          – Medhat Helmy
          Nov 26 at 16:00












          So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
          – Medhat Helmy
          Nov 26 at 20:23




          So the error was in another downstream rule that could cause this recursion I fixed it and add some constraints on the name like this rule bam2fastq: input: datain="{dataset}/{sample}.{filter, ^[0-9]}.bam" output: dataout="{dataset}/{sample}.{filter}.reads.fastq" run: shell(""" bedtools bamtofastq -i "{input.datain}" -fq "{output.dataout}" """)
          – Medhat Helmy
          Nov 26 at 20:23


















          draft saved

          draft discarded




















































          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420956%2frecursive-input-calling-in-snakemake-rule%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          Berounka

          Different font size/position of beamer's navigation symbols template's content depending on regular/plain...

          Sphinx de Gizeh