mrvollger / StainedGlass

Make colorful identity heatmaps of genomic sequence
https://mrvollger.github.io/StainedGlass/
MIT License
105 stars 10 forks source link

NameError: name 'srcdir' is not defined #34

Closed molecule53 closed 8 months ago

molecule53 commented 9 months ago

Hello,

Please help! Getting this error with the test file:

(snakemake) ubuntu@ip-172-31-23-2:/Data1/StainedGlass$ time snakemake --cores 8 --config sample=arabidopsis fasta=/Data1/Col-CEN_v1.2.fasta --use-conda cooler

Thanks for using StainedGlass and please remember to cite the tool! Mitchell R Vollger, Peter Kerpedjiev, Adam M Phillippy, Evan E Eichler. "StainedGlass: Interactive visualization of massive tandem repeat structures with identity heatmaps" Bioinformatics, 2022; https://doi.org/10.1093/bioinformatics/btac018

Traceback (most recent call last): File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/cli.py", line 1886, in args_to_api dag_api = workflow_api.dag( ^^^^^^^^^^^^^^^^^ File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/api.py", line 326, in dag return DAGApi( ^^^^^^^ File "", line 6, in init File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/api.py", line 436, in __post_init__ self.workflow_api._workflow.dag_settings = self.dag_settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/api.py", line 383, in _workflow workflow.include( File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/workflow.py", line 1374, in include exec(compile(code, snakefile.get_path_or_uri(), "exec"), self.globals) File "/Data1/StainedGlass/workflow/Snakefile", line 21, in SDIR = os.path.realpath(os.path.dirname(srcdir("Snakefile"))) ^^^^^^ NameError: name 'srcdir' is not defined

mrvollger commented 9 months ago

Snakemake v8 very recently made many code-breaking changes; can you please try installing snakemake v7

molecule53 commented 9 months ago

Hi Mitchell,

Thank you very much for this information.

I have snakemake-8.2.1 that installed by doing:

mamba create -c conda-forge -c bioconda -n snakemake snakemake

conda info --envs

snakemake * /home/ubuntu/miniforge3/envs/snakemake

It looks like I also have snakemake-7 but I can't figure out how to specify it:

@.***:~$ conda search -c bioconda -f snakemake=7 Loading channels: done

Name Version Build Channel

snakemake 7.0.0 hdfd78af_0 bioconda snakemake 7.0.1 hdfd78af_0 bioconda snakemake 7.0.1 hdfd78af_1 bioconda

Or what would be the alternative to installing the v7 version?

Thank you very much! Anastasia


From: Mitchell Robert Vollger @.> Sent: Thursday, January 18, 2024 5:53 PM To: mrvollger/StainedGlass @.> Cc: McKinlay, Anastasia @.>; Author @.> Subject: [External] Re: [mrvollger/StainedGlass] NameError: name 'srcdir' is not defined (Issue #34)

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

Snakemake v8 very recently made many code-breaking changes; can you please try installing snakemake v7

— Reply to this email directly, view it on GitHubhttps://github.com/mrvollger/StainedGlass/issues/34#issuecomment-1899347009, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6WBDRPSNQQT2TNWR23EBL3YPGRWZAVCNFSM6AAAAABCAWXPDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJZGM2DOMBQHE. You are receiving this because you authored the thread.Message ID: @.***>

mrvollger commented 9 months ago

You can try a branch I just made that allows snakemake v8: https://github.com/mrvollger/StainedGlass/tree/smk8 let me know how it goes.

molecule53 commented 9 months ago

Hi Mitchel, Thank you very much for looking into this.

Can I get this version by

git clone https://github.com/mrvollger/StainedGlass.git

?

It looks like it is the same link on https://github.com/mrvollger/StainedGlass/ and https://github.com/mrvollger/StainedGlass/tree/smk8

The reason I am asking is that I think I tried this new version but got the same error:

(snakemake) @.***:/Data1/StainedGlass$ snakemake --version

8.4.2

(snakemake) @.***:/Data1$ git clone https://github.com/mrvollger/StainedGlass.git

(snakemake) @.***:/Data1/StainedGlass$ snakemake --cores 8 -n

Thanks for using StainedGlass and please remember to cite the tool!

Mitchell R Vollger, Peter Kerpedjiev, Adam M Phillippy, Evan E Eichler.
        "StainedGlass: Interactive visualization of massive tandem repeat structures with identity heatmaps"
        Bioinformatics, 2022; https://doi.org/10.1093/bioinformatics/btac018

Traceback (most recent call last): File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/cli.py", line 1893, in args_to_api dag_api = workflow_api.dag( ^^^^^^^^^^^^^^^^^ File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/api.py", line 326, in dag return DAGApi( ^^^^^^^ File "", line 6, in init File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/api.py", line 436, in __post_init__ self.workflow_api._workflow.dag_settings = self.dag_settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/api.py", line 383, in _workflow workflow.include( File "/home/ubuntu/miniforge3/envs/snakemake/lib/python3.12/site-packages/snakemake/workflow.py", line 1379, in include exec(compile(code, snakefile.get_path_or_uri(), "exec"), self.globals) File "/Data1/StainedGlass/workflow/Snakefile", line 21, in SDIR = os.path.realpath(os.path.dirname(srcdir("Snakefile"))) ^^^^^^ NameError: name 'srcdir' is not defined


From: Mitchell Robert Vollger @.> Sent: Tuesday, January 30, 2024 12:53 PM To: mrvollger/StainedGlass @.> Cc: McKinlay, Anastasia @.>; Author @.> Subject: [External] Re: [mrvollger/StainedGlass] NameError: name 'srcdir' is not defined (Issue #34)

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

You can try a branch I just made that allows snakemake v8: https://github.com/mrvollger/StainedGlass/tree/smk8 let me know how it goes.

— Reply to this email directly, view it on GitHubhttps://github.com/mrvollger/StainedGlass/issues/34#issuecomment-1917584336, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6WBDRMSSNYWJ654OHSZHSLYREXQFAVCNFSM6AAAAABCAWXPDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJXGU4DIMZTGY. You are receiving this because you authored the thread.Message ID: @.***>

kbseah commented 9 months ago

chiming in here because i encountered the same issue

@molecule53 after cloning the repository you'll need to checkout the smk8 branch:

git clone https://github.com/mrvollger/StainedGlass.git
cd StainedGlass
git checkout smk8
git diff main workflow/Snakemake # show diff with main branch in the Snakefile where bug was previously
molecule53 commented 9 months ago

Thank you kbseah! I made a bit further but still have an error:(snakemake) ubuntu@ip-172-31-24-208:/Data1/StainedGlass$ ls Col-CEN_v1.2.fasta Col-CEN_v1.2.fasta.fai LICENSE README.md _config.yml case-example-arabidopsis config docs images previous_versions workflow

(snakemake) ubuntu@ip-172-31-24-208:/Data1/StainedGlass$ time snakemake --cores 8 --config sample=arabidopsis fasta=Col-CEN_v1.2.fasta --use-conda cooler

Using profile workflow/profiles/default and workflow specific profile workflow/profiles/default for setting default command line arguments. Thanks for using StainedGlass and please remember to cite the tool! Mitchell R Vollger, Peter Kerpedjiev, Adam M Phillippy, Evan E Eichler. "StainedGlass: Interactive visualization of massive tandem repeat structures with identity heatmaps" Bioinformatics, 2022; https://doi.org/10.1093/bioinformatics/btac018

Config file config/config.yaml is extended by additional config specified via the command line. [INFO] The sequence will be split into 4 batches. Building DAG of jobs... WorkflowError: The apptainer or singularity command has to be available in order to use apptainer/singularity integration.

real 0m22.936s user 0m0.501s sys 0m0.095s

molecule53 commented 9 months ago

Also, if it helps here is what I see after running (snakemake) ubuntu@ip-172-31-24-208:/Data1/StainedGlass$ git diff main workflow/Snakefile diff --git a/workflow/Snakefile b/workflow/Snakefile index ad167b1..1f34a94 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -4,7 +4,7 @@ import sys

from snakemake.utils import min_version

-min_version("6.0") +min_version("8.0")

bold = "\033[1m" green = "\033[92m" @@ -18,10 +18,12 @@ msg = f"""{green}{bold}Thanks for using StainedGlass and please remember to cite """ sys.stderr.write(msg)

-SDIR = os.path.realpath(os.path.dirname(srcdir("Snakefile"))) shell.prefix(f"set -eo pipefail; ")

+container: "docker://continuumio/miniconda3" + + configfile: "config/config.yaml"

mrvollger commented 8 months ago

snakemake v8 is now required (and in main) to avoid these issues. Please reopen if you have issues on main.