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

snakefmt moves interspersed comments #193

Open
hepcat72 opened this issue May 25, 2023 · 1 comment
Open

snakefmt moves interspersed comments #193

hepcat72 opened this issue May 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@hepcat72
Copy link

I intentionally changed some triple quoted shell strings to separate concatenated strings so that I could intersperse comments, but even though the code works, snakefmt moved the comments to the beginning and end.

Desired (note the space between the + and the "):

    shell:
        # Concatenate all the files together
        "cat {input:q} 2> {log.cat:q} | "
        # Coordinate sort everything
        + "sortBed 2> {log.sort:q} | "
        # Merge overlapping coordinates into individual expanded records
        + "mergeBed 2> {log.merge:q} 1> {output:q}"

snakefmt's munge:

    shell:
        # Concatenate all the files together
        "cat {input:q} 2> {log.cat:q} | "

        +"sortBed 2> {log.sort:q} | "

        +"mergeBed 2> {log.merge:q} 1> {output:q}"
        # Coordinate sort everything
        # Merge overlapping coordinates into individual expanded records

It also requires that the + be at the beginning of the next line and won't let them be at the end. If they are at the end, it gived a confusing syntax error.

Desired:

    shell:
        # Concatenate all the files together
        "cat {input:q} 2> {log.cat:q} | " +
        # Coordinate sort everything
        "sortBed 2> {log.sort:q} | " +
        # Merge overlapping coordinates into individual expanded records
        "mergeBed 2> {log.merge:q} 1> {output:q}"

snakefmt error:

snakefmt.exceptions.InvalidPython: Black error:
Cannot parse: 17:35: "cat {input:q} 2> {log.cat:q} | " +

How can I intersperse comments in multi-line shell strings without snakefmt moving them?

@mbhall88 mbhall88 added the bug Something isn't working label Jun 19, 2023
@mbhall88
Copy link
Member

This is related to #129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants