Skip to content

Relative path issue when running not in the repo directory #151

@gongyixiao

Description

@gongyixiao

When running without docker ENTRYPOINT mode, when below command is used:

cd [some_dir]
python [path_to_neoantigen-vaccine-pipeline]/run_snakemake.py

The current working directory is some_dir

And this line:

'pipeline/Snakefile',

It will interpret the relative path from some_dir and think pipeline/reference_Snakefile is in
[some_dir]/pipeline/reference_Snakefile, but in fact it is in [path_to_neoantigen-vaccine-pipeline]/pipeline/reference_Snakefile

It's not appropriate to assume people will run run_snakemake.py from the [path_to_neoantigen-vaccine-pipeline] all the time.

This is critical when running in singularity because you need to be able to run python [path_to_neoantigen-vaccine-pipeline] outside of the singularity container to for example submit a singularity job.

I purpose the following change which won't change any current behavior but at the same time fix the issue:

from os.path import dirname, isfile, join, basename, splitext, exists

Change to:

from os.path import dirname, isfile, join, basename, splitext, exists, realpath

'pipeline/Snakefile',

Change to:

dirname(realpath(__file__))+'/'+'pipeline/reference_Snakefile',

'pipeline/reference_Snakefile',

Change to:

dirname(realpath(__file__))+'/'+'pipeline/reference_Snakefile',

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions