Skip to content

Commit

Permalink
Merge pull request #69 from gregdenay/master
Browse files Browse the repository at this point in the history
MIDORI
  • Loading branch information
gregdenay authored Apr 19, 2024
2 parents 2d12e1b + 030b0ba commit 2f356af
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
29 changes: 29 additions & 0 deletions ressources/create_MIDORI_blastdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Get MIDORI Fasta and reformat header
wget -S -P ./source/ https://www.reference-midori.info/forceDownload.php?fName=download/Databases/GenBank259_2023-12-17/BLAST/uniq/fasta/MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta.zip \
&& gunzip -c ./source/MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta.zip > ./source/MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta \
&& cut -d '#' -f1 ./source/MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta \
| tr -d '<' \
| sed 's/^>/@/' \
| tr -d '>' \
| tr '@' '>' \
| cut -d ',' -f1,2 \
| tr ',' '_' \
> MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta

# taxdb
wget -S -P ./source/ https://ftp.ncbi.nlm.nih.gov/blast/db/taxdb.tar.gz \
&& tar -xzvf ./source/taxdb.tar.gz

# taxdump
wget -S -P ./source/ https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/new_taxdump/new_taxdump.tar.gz \
&& tar -xzvf ./source/new_taxdump.tar.gz

# taxid file
# Get taxid from fasta headers
paste \
<(cat ./source/MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta | grep '^>' | cut -d '#' -f1 | tr -d '<' | tr -d '>' | cut -d ',' -f1,2 | tr ',' '_') \
<(cat ./source/MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta | grep '^>' | rev | cut -d '_' -f1 | rev) \
> ids2taxid

# Make db
makeblastdb -in MIDORI2_UNIQ_NUC_GB259_lrRNA_BLAST.fasta -parse_seqids -blastdb_version 5 -taxid_map ids2taxid -dbtype nucl
14 changes: 13 additions & 1 deletion workflow/paramspace
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ workdir: config["workdir"]
paramspace = Paramspace(pd.read_csv(config['paramspace'], sep="\t"))


# Snakemake 8 compatibility ----------------------------------------------------


def get_conda_prefix(wildcards):
try:
# snakemake < 8.0
return workflow.conda_prefix
except:
# snakemake > 8
return workflow.deployment_settings.conda_prefix


# Input rule ------------------------------------------------------------------


Expand Down Expand Up @@ -68,7 +80,7 @@ rule run_foodme_benchmark:
workdir=f"foodme_runs/{paramspace.wildcard_pattern}",
snakefile=os.path.join(workflow.basedir, "benchmark"),
cores=workflow.cores,
conda_prefix=workflow.conda_prefix,
conda_prefix=get_conda_prefix,
force_rerun="--forceall" if config["force_rerun"] else ""
log:
f"logs/{paramspace.wildcard_pattern}/snakemake.log"
Expand Down

0 comments on commit 2f356af

Please sign in to comment.