Recursive input calling in Snakemake rule












0















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





























    0















    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



























      0












      0








      0








      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 '18 at 18:22







      Medhat

















      asked Nov 21 '18 at 21:50









      MedhatMedhat

      938820




      938820
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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
            Nov 22 '18 at 18:33











          • unfortunately, it did not work. I will try to figure something else, Thanks.

            – Medhat
            Nov 26 '18 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
            Nov 26 '18 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',
          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
          });


          }
          });














          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









          0














          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
            Nov 22 '18 at 18:33











          • unfortunately, it did not work. I will try to figure something else, Thanks.

            – Medhat
            Nov 26 '18 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
            Nov 26 '18 at 20:23
















          0














          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
            Nov 22 '18 at 18:33











          • unfortunately, it did not work. I will try to figure something else, Thanks.

            – Medhat
            Nov 26 '18 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
            Nov 26 '18 at 20:23














          0












          0








          0







          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 '18 at 10:07









          darioberdariober

          1,0361221




          1,0361221













          • Thanks, this could be the case I will test it and give feedback.

            – Medhat
            Nov 22 '18 at 18:33











          • unfortunately, it did not work. I will try to figure something else, Thanks.

            – Medhat
            Nov 26 '18 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
            Nov 26 '18 at 20:23



















          • Thanks, this could be the case I will test it and give feedback.

            – Medhat
            Nov 22 '18 at 18:33











          • unfortunately, it did not work. I will try to figure something else, Thanks.

            – Medhat
            Nov 26 '18 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
            Nov 26 '18 at 20:23

















          Thanks, this could be the case I will test it and give feedback.

          – Medhat
          Nov 22 '18 at 18:33





          Thanks, this could be the case I will test it and give feedback.

          – Medhat
          Nov 22 '18 at 18:33













          unfortunately, it did not work. I will try to figure something else, Thanks.

          – Medhat
          Nov 26 '18 at 16:00





          unfortunately, it did not work. I will try to figure something else, Thanks.

          – Medhat
          Nov 26 '18 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
          Nov 26 '18 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
          Nov 26 '18 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.




          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

          'app-layout' is not a known element: how to share Component with different Modules

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          WPF add header to Image with URL pettitions [duplicate]