Skip to content

Commit e2f22b8

Browse files
Brandon Duane Walkerwalkerbdev
authored andcommitted
openfold
1 parent 801a628 commit e2f22b8

File tree

3 files changed

+180
-0
lines changed

3 files changed

+180
-0
lines changed

cwl_adapters/openfold.cwl

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.2
3+
4+
class: CommandLineTool
5+
6+
label: OpenFold Inference
7+
8+
doc: |-
9+
OpenFold Inference using a pre-trained model.
10+
11+
baseCommand: ['python3', '/opt/openfold/run_pretrained_openfold.py']
12+
13+
hints:
14+
cwltool:CUDARequirement:
15+
cudaVersionMin: "10.2"
16+
cudaComputeCapability: "3.0"
17+
cudaDeviceCountMin: 1
18+
cudaDeviceCountMax: 1
19+
DockerRequirement:
20+
dockerPull: polusai/openfold-tool@sha256:84e1bb34f9d7ccfbd670e76d3f602334960f65ac091f96e9956ceeef985a9ffe
21+
dockerOutputDirectory: /app
22+
23+
requirements:
24+
EnvVarRequirement:
25+
envDef:
26+
CONDA_PREFIX: /opt/conda/
27+
# needed because https://github.com/aqlaboratory/openfold/blob/6f63267114435f94ac0604b6d89e82ef45d94484/scripts/utils.py#L9
28+
InlineJavascriptRequirement: {}
29+
InitialWorkDirRequirement:
30+
listing:
31+
- $(inputs.input_fasta_dir)
32+
- $(inputs.template_mmcif_dir)
33+
- $(inputs.BASE_DATA_DIR)
34+
- $(inputs.PARAMS_DIR)
35+
36+
inputs:
37+
38+
PARAMS_DIR:
39+
type: Directory
40+
doc: "Directory containing OpenFold model parameter files."
41+
42+
BASE_DATA_DIR:
43+
type: Directory
44+
doc: "Directory containing OpenFold databases."
45+
46+
input_fasta_dir:
47+
type: Directory
48+
doc: "Directory containing OpenFold input fasta sequence."
49+
50+
template_mmcif_dir:
51+
type: Directory
52+
doc: "MMCIF files to use for template matching. This directory is required even if using template free inference."
53+
54+
input_fasta_dir_string:
55+
type: string?
56+
inputBinding:
57+
position: 1
58+
default: /app/fasta
59+
60+
template_mmcif_dir_string:
61+
type: string?
62+
inputBinding:
63+
position: 2
64+
default: /app/mmcif_files
65+
66+
output_dir:
67+
type: string
68+
inputBinding:
69+
prefix: --output_dir
70+
default: "/app"
71+
doc: "Need to stage outputs in container in a specified directory"
72+
73+
openfold_checkpoint_path:
74+
type: string?
75+
inputBinding:
76+
prefix: --openfold_checkpoint_path
77+
default: /app/params/finetuning_ptm_1.pt
78+
doc: "Uses an checkpoint or parameter file. Expected types are Deepspeed checkpoint files or .pt files. Make sure your selected checkpoint file matches the configuration setting chosen in --config_preset"
79+
80+
config_preset:
81+
type: string?
82+
inputBinding:
83+
prefix: --config_preset
84+
default: "finetuning_ptm"
85+
doc: "Specify a different model configuration. There are 5 available model preset settings, some of which support template modeling, others support template-free modeling. The default is model_1."
86+
87+
uniref90_database_path:
88+
type: string?
89+
inputBinding:
90+
prefix: --uniref90_database_path
91+
default: /app/openfold_databases/uniref90/uniref90.fasta
92+
doc: "For alignments to Uniref90 dataset."
93+
94+
mgnify_database_path:
95+
type: string?
96+
inputBinding:
97+
prefix: --mgnify_database_path
98+
default: /app/openfold_databases/mgnify/mgy_clusters_2022_05.fa
99+
doc: "For alignments to Mgnify, dataset."
100+
101+
pdb70_database_path:
102+
type: string?
103+
inputBinding:
104+
prefix: --pdb70_database_path
105+
default: /app/openfold_databases/pdb70/pdb70
106+
doc: "For template matching to PDB70 database"
107+
108+
uniclust30_database_path:
109+
type: string?
110+
inputBinding:
111+
prefix: --uniclust30_database_path
112+
default: /app/openfold_databases/uniclust30/uniclust30_2018_08/uniclust30_2018_08
113+
doc: "For template matching to Uniclust30 database"
114+
115+
bfd_database_path:
116+
type: string?
117+
inputBinding:
118+
prefix: --bfd_database_path
119+
default: /app/openfold_databases/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt
120+
doc: "For alignments to BFD dataset."
121+
122+
model_device:
123+
type: string?
124+
inputBinding:
125+
prefix: --model_device
126+
default: "cuda:0"
127+
128+
outputs:
129+
output_files:
130+
type: File[]
131+
outputBinding:
132+
glob: "/app/predictions/*"
133+
134+
135+
$namespaces:
136+
edam: https://edamontology.org/
137+
cwltool: http://commonwl.org/cwltool#
138+
139+
$schemas:
140+
- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl

examples/openfold/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# docker build -f Dockerfile -t polusai/openfold-tool:0.1.0 .
2+
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu18.04
3+
4+
RUN apt-key del 7fa2af80
5+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
6+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
7+
8+
RUN apt-get update && apt-get install -y wget libxml2 cuda-minimal-build-11-3 libcusparse-dev-11-3 libcublas-dev-11-3 libcusolver-dev-11-3 git
9+
RUN wget -P /tmp \
10+
"https://github.com/conda-forge/miniforge/releases/download/23.3.1-1/Miniforge3-Linux-x86_64.sh" \
11+
&& bash /tmp/Miniforge3-Linux-x86_64.sh -b -p /opt/conda \
12+
&& rm /tmp/Miniforge3-Linux-x86_64.sh
13+
ENV PATH /opt/conda/bin:$PATH
14+
15+
WORKDIR /opt/
16+
17+
RUN git clone https://github.com/aqlaboratory/openfold.git
18+
19+
WORKDIR /opt/openfold
20+
21+
RUN mamba env update -n base --file /opt/openfold/environment.yml && mamba clean --all
22+
RUN export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
23+
RUN wget -q -P /opt/openfold/openfold/resources \
24+
https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt
25+
RUN python3 setup.py install
26+
27+
# by default openfold looks for parameters in the resources directory
28+
RUN mkdir resources
29+
30+
RUN bash scripts/download_alphafold_params.sh resources

examples/openfold/openfold.wic

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
steps:
2+
3+
- id: openfold
4+
in:
5+
PARAMS_DIR: !ii '/polus2/OpenFold/openfold/openfold/resources/params'
6+
BASE_DATA_DIR: !ii '/polus2/OpenFold/openfold_databases'
7+
input_fasta_dir: !ii '/polus2/OpenFold/fasta'
8+
template_mmcif_dir: !ii '/polus2/OpenFold/mmcifs/pdb_mmcif/mmcif_files'
9+
out:
10+
- output_files: !& outputs

0 commit comments

Comments
 (0)