Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added workflow/envs/basic.yml
Empty file.
13 changes: 13 additions & 0 deletions workflow/envs/biopython.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
channels:
<<<<<<< HEAD
- conda-forge
- bioconda
dependencies:
- python>=3.12.4
- biopython >=1.84
- pandas>=2.2.2
=======
- conda-forge
dependencies:
- biopython>=1.85
>>>>>>> main
10 changes: 10 additions & 0 deletions workflow/envs/openbabel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
channels:
<<<<<<< HEAD
- conda-forge
dependencies:
- openbabel>=3.1.1
=======
- conda-forge
dependencies:
- openbabel>=3.1.1
>>>>>>> main
5 changes: 5 additions & 0 deletions workflow/envs/plotting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
dependencies:
- matplotlib>=3.10.6
- venn>=0.1.3
6 changes: 6 additions & 0 deletions workflow/envs/simple_pandas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
dependencies:
- python>=3.12.4
- pandas>=2.2.2
4 changes: 4 additions & 0 deletions workflow/envs/vinalc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
channels:
- bioconda
dependencies:
- vinalc>=1.4.2
18 changes: 13 additions & 5 deletions workflow/rules/analyse.smk
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ rule makeHistogram:
),
log:
"logs/makeHistogram_{receptorID}.log",
conda:
"../envs/plotting.yml"
envmodules:
config["PYPLOT"],
script:
Expand Down Expand Up @@ -214,6 +216,8 @@ rule dockingResultsTxt:
path.join(OUTPUT_DIR, "results", "{receptorID}_{percentage}.csv"),
log:
"logs/dockingResultsTxt_{receptorID}_{percentage}.log",
conda:
"../envs/simple_pandas.yml"
wildcard_constraints:
receptorID="[^/]+",
percentage="[^/]+",
Expand Down Expand Up @@ -277,11 +281,11 @@ rule prepareSecondDocking:
),
log:
"logs/prepareSecondDocking_{name}_{receptorID}_{percentage}.log",
shell:
"""
cp {input.grid} {output.grid}
echo {input.receptor} > {output.receptor}
"""
run:
import shutil

shutil.copy(input.grid, output.grid)
shutil.copy(input.receptor, output.receptor)


rule docking2:
Expand Down Expand Up @@ -314,6 +318,8 @@ rule docking2:
tasks=config["DOCKING"]["ntasks"],
slurm_extra=config["DOCKING"]["slurm_extra"],
runtime=config["DOCKING"]["runtime"],
conda:
"../envs/vinalc.yml"
envmodules:
config["VINALC"],
shell:
Expand Down Expand Up @@ -420,6 +426,8 @@ rule makeVenn:
),
category="Rescreening",
),
conda:
"../envs/plotting.yml"
log:
"logs/makeVenn_{receptorID}_{percentage}.log",
script:
Expand Down
2 changes: 2 additions & 0 deletions workflow/rules/docking.smk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ rule docking:
"{dataset}",
"{receptorID}.txt_{database}_{dataset}_{name}_{i}.txt.pdbqt.gz",
),
conda:
"../envs/vinalc.yml"
envmodules:
config["VINALC"],
params:
Expand Down
40 changes: 36 additions & 4 deletions workflow/rules/preparation.smk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ rule convertMol2:
path.join(INPUT_DIR, "ZINC", "subsets", "{subset}.mol2"),
output:
path.join(TMP_DIR, "unzipped", "ZINC", "subsets", "{subset}.pdbqt"),
conda:
"../envs/openbabel.yml"
envmodules:
config["OPENBABEL"],
shell:
Expand All @@ -43,6 +45,8 @@ rule mergeLocalInput:
in_dir=LOCAL_INPUT,
output:
path.join(TMP_DIR, "unzipped", "{database}", "{dataset}", "local.pdbqt"),
conda:
"../envs/openbabel.yml"
envmodules:
config["OPENBABEL"],
script:
Expand All @@ -64,6 +68,8 @@ rule SDFToPDBQT:
path.join(TMP_DIR, "unzipped", "{database}", "{dataset}", "{name}.sdf"),
output:
path.join(TMP_DIR, "unzipped", "{database}", "{dataset}", "{name}.pdbqt"),
conda:
"../envs/openbabel.yml"
envmodules:
config["OPENBABEL"],
shell:
Expand All @@ -75,6 +81,8 @@ rule prepareReceptor:
path.join(TMP_DIR, "unzipped", "PDB", "receptor", "{name}.pdb"),
output:
path.join(TMP_DIR, "PDB", "receptor", "{name}.pdb"),
conda:
"../envs/biopython.yml"
envmodules:
config["BIOPYTHON"],
script:
Expand All @@ -86,6 +94,8 @@ rule makeReceptorPDBQT:
path.join(TMP_DIR, "PDB", "receptor", "{name}.pdb"),
output:
path.join(PREPARED_DIR, "receptor", "{name}.pdbqt"),
conda:
"../envs/openbabel.yml"
envmodules:
config["OPENBABEL"],
shell:
Expand All @@ -97,6 +107,8 @@ rule gunzip:
path.join(INPUT_DIR, "{database}", "{dataset}", "{name}.{filetype}.gz"),
output:
path.join(TMP_DIR, "unzipped", "{database}", "{dataset}", "{name}.{filetype}"),
conda:
"../envs/basic.yml"
shell:
"gunzip < {input} > {output} || touch {output}"

Expand Down Expand Up @@ -138,6 +150,8 @@ rule energyMin:
partition=config["ENERGY_MIN"]["partition"],
runtime=config["ENERGY_MIN"]["runtime"],
mem_mb=config["ENERGY_MIN"]["mem_mb"],
conda:
"../envs/openbabel.yml"
envmodules:
config["OPENBABEL"],
shell:
Expand All @@ -149,8 +163,24 @@ rule prepareGeometry:
path.join(config["GRID_DIR"], "{receptorID}.gpf"),
output:
path.join(OUTPUT_DIR, "grid", "{receptorID}_grid.txt"),
shell:
"egrep 'npts|gridcenter' {input} |cut -f2-4 -d' '| tac |tr '\n' ' ' > {output} && sed -i -e '$a\ ' {output}"
run:
grid_params = []

with open(input[0], "r") as f:
for line in f:
# Match lines starting with 'npts' or 'gridcenter'
if line.startswith(("npts", "gridcenter")):
# Extract fields 2-4 (space-separated values after the first field)
parts = line.strip().split()
if len(parts) >= 4:
grid_params.append(" ".join(parts[1:4]))

# Reverse the order (equivalent to 'tac')
grid_params.reverse()

# Write to output file with space separation and trailing newline
with open(output[0], "w") as f:
f.write(" ".join(grid_params) + " \n")


rule prepareLibrary:
Expand All @@ -167,5 +197,7 @@ rule prepareDocking:
path.join(PREPARED_DIR, "receptor", "{receptorID}.pdbqt"),
output:
path.join(OUTPUT_DIR, "receptor", "{receptorID}.txt"),
shell:
"echo {input} > {output}"
run:
import shutil

shutil.copy(input[0], output[0])