Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JOSS Review] tab/space bug #12

Closed
gbouras13 opened this issue Jan 9, 2024 · 3 comments
Closed

[JOSS Review] tab/space bug #12

gbouras13 opened this issue Jan 9, 2024 · 3 comments

Comments

@gbouras13
Copy link
Contributor

Re openjournals/joss-reviews#6062

After #11 copying the Snakefile, I ran:

snakemake --snakefile Snakefile -j 8 --use-conda

which yielded an error (at the bottom of this issue).

It can be fixed by replacing tab with spaces in the line

" --prob-contamination 1e-3"

in the freebayes rule in the varcall.rules file.

Traceback (most recent call last):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/workflow.py", line 1369, in include
    exec(compile(code, snakefile.get_path_or_uri(), "exec"), self.globals)
  File "/Users/a1667917/Documents/Reviews/acanthophis/Acanthophis/tests/Snakefile", line 18, in <module>
    rules.varcall.input,
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/workflow.py", line 1347, in include
    code, linemap, rulecount = parse(
                               ^^^^^^
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 1307, in parse
    for t, orig_token in automaton.consume():
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 110, in consume
    for t, orig in self.state(token):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 1212, in python
    for t in self.subautomaton(token.string, token=token).consume():
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 110, in consume
    for t, orig in self.state(token):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 199, in block
    yield from self.block_content(token)
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 784, in block_content
    for t in self.block(e.token):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 199, in block
    yield from self.block_content(token)
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 784, in block_content
    for t in self.block(e.token):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 199, in block
    yield from self.block_content(token)
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 784, in block_content
    for t in self.block(e.token):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 199, in block
    yield from self.block_content(token)
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 773, in block_content
    for t in self.subautomaton(
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 107, in consume
    for token in self.snakefile:
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/parser.py", line 1238, in __next__
    return next(self.tokens)
           ^^^^^^^^^^^^^^^^^
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/tokenize.py", line 541, in _generate_tokens_from_c_tokenizer
    raise e from None
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/tokenize.py", line 537, in _generate_tokens_from_c_tokenizer
    for info in it:
  File "<string>", line 101
    	"   --skip-coverage 100000"
    	                           ^
TabError: inconsistent use of tabs and spaces in indentation

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/cli.py", line 1887, in args_to_api
    dag_api = workflow_api.dag(
              ^^^^^^^^^^^^^^^^^
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/api.py", line 326, in dag
    return DAGApi(
           ^^^^^^^
  File "<string>", line 6, in __init__
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/api.py", line 421, in __post_init__
    self.workflow_api._workflow.dag_settings = self.dag_settings
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/api.py", line 372, in _workflow
    workflow.include(
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/workflow.py", line 1371, in include
    e = update_lineno(e, self.linemaps)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/a1667917/mambaforge/envs/someproject/lib/python3.12/site-packages/snakemake/exceptions.py", line 165, in update_lineno
    ex.lineno = linemaps[ex.filename][ex.lineno]
                ~~~~~~~~^^^^^^^^^^^^^
KeyError: '<string>'

@kdm9
Copy link
Owner

kdm9 commented Jan 9, 2024

Now that is a good one 😄. I can't reproduce it from the main branch:

$ git grep -n -- --skip-coverage  
acanthophis/template/workflow/rules/varcall.rules:180:        "   --skip-coverage {params.max_depth}"
$ head -n 180 acanthophis/template/workflow/rules/varcall.rules | tail -n 1 
        "   --skip-coverage {params.max_depth}"
$ head -n 180 acanthophis/template/workflow/rules/varcall.rules | tail -n 1  | xxd
00000000: 2020 2020 2020 2020 2220 2020 2d2d 736b          "   --sk
00000010: 6970 2d63 6f76 6572 6167 6520 7b70 6172  ip-coverage {par
00000020: 616d 732e 6d61 785f 6465 7074 687d 220a  ams.max_depth}".

In English, all the whitespace on that line is spaces (0x20) and not tabs (0x09) in the source code.

when you say coping, I assume you mean cp blah/Snakefile ./ and not copy-pasting within editors?

@gbouras13
Copy link
Contributor Author

Hi @kdm9 ,

Yes, copying from the command line.

I'm getting back onto this now - will try and new pip install, will let you know how I go.

George

@kdm9
Copy link
Owner

kdm9 commented Jan 16, 2024

given in your other issue there is no such error, i assume this is fixed -- please reopen if not

@kdm9 kdm9 closed this as completed Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants