Skip to content

Commit

Permalink
Merge pull request #1054 from maxplanck-ie/KS
Browse files Browse the repository at this point in the history
Fix 1049 and 1009
  • Loading branch information
katsikora authored Sep 10, 2024
2 parents 6b6eea6 + 16e04bd commit 3f98cd8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
17 changes: 17 additions & 0 deletions snakePipes/snakePipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def parse_arguments():
"in the workflow-specific yaml files and where conda is installed.",
)

configParser.add_argument(
"--snakemakeProfile",
help="Path to custom snakemake profile file.",
default=defaults["snakemakeProfile"]
)

configParser.add_argument(
"--organismsDir",
help="The directory where global organism YAML files are to be stored. Both "
Expand Down Expand Up @@ -381,6 +387,7 @@ def updateConfig(args):
if args.configMode == "manual":
d = {
"snakemakeOptions": args.snakemakeOptions,
"snakemakeProfile": args.snakemakeProfile,
"condaEnvDir": args.condaEnvDir,
"organismsDir": args.organismsDir,
"tempDir": args.tempDir,
Expand All @@ -407,6 +414,16 @@ def updateConfig(args):
sys.exit("Config file not found\n")
updatedDict = cof.merge_dicts(currentDict, d)
cof.write_configfile(os.path.join(baseDir, "shared", "defaults.yaml"), updatedDict)

#update conda-prefix in snakemakeProfile
if args.condaEnvDir:
profilePath = cof.resolveSnakemakeProfile(d['snakemakeProfile'], baseDir)
f = open(profilePath / 'config.yaml')
pf = yaml.load(f, Loader=yaml.FullLoader)
pf['conda-prefix'] = args.condaEnvDir
cof.write_configfile(os.path.join(profilePath, "config.yaml"), pf)
f.close()

cof.load_configfile(
os.path.join(baseDir, "shared", "defaults.yaml"), True, "Final Updated Config"
)
Expand Down
2 changes: 1 addition & 1 deletion snakePipes/workflows/DNAmapping/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if "allelic-mapping" in mode:
SNPFile = "snp_genome/all_SNPs_" + strains[0] + "_" + genome_alias + ".txt.gz"
elif len(strains) == 2:
allele_hybrid = 'dual'
SNPFile = SNPFile = "snp_genome/all_" + strains[1] + "_SNPs_" + strains[0] + "_reference.based_on_" + genome_alias + ".txt"
SNPFile = "snp_genome/all_" + strains[1] + "_SNPs_" + strains[0] + "_reference.based_on_" + genome_alias + ".txt"

include: os.path.join(maindir, "shared", "rules", "masked_genomeIndex.snakefile")
elif allele_mode == 'map_only':
Expand Down
5 changes: 3 additions & 2 deletions snakePipes/workflows/mRNAseq/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ if not fromBAM:

## Allele-specific JOBS
if "allelic-mapping" in mode:
genome_alias = os.path.splitext(os.path.basename(genome))[0]
# Updated global vars if mode = "allelic-mapping"
if allele_mode == 'create_and_map':
star_index_allelic = 'snp_genome/star_Nmasked/Genome'
if len(strains) == 1:
allele_hybrid = 'single'
SNPFile = "snp_genome/all_SNPs_" + strains[0] + "_" + genome + ".txt.gz"
SNPFile = "snp_genome/all_SNPs_" + strains[0] + "_" + genome_alias + ".txt.gz"
elif len(strains) == 2:
allele_hybrid = 'dual'
SNPFile = "snp_genome/all_" + strains[1] + "_SNPs_" + strains[0] + "_reference.based_on_" + genome + ".txt"
SNPFile = "snp_genome/all_" + strains[1] + "_SNPs_" + strains[0] + "_reference.based_on_" + genome_alias + ".txt"

include: os.path.join(maindir, "shared", "rules", "masked_genomeIndex.snakefile")
elif allele_mode == 'map_only':
Expand Down

0 comments on commit 3f98cd8

Please sign in to comment.