Skip to content

Commit

Permalink
feat(style): pushing uncommited changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nbtm-sh committed Oct 10, 2024
1 parent 5fe8e1d commit 9af55b1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 45 deletions.
40 changes: 24 additions & 16 deletions modules/local/run_alphafold2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ process RUN_ALPHAFOLD2 {
tag "$meta.id"
label 'process_medium'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'docker://nfcore/proteinfold_alphafold2_standard:1.0.0' :
'nfcore/proteinfold_alphafold2_standard:1.0.0' }"
// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error("Local RUN_ALPHAFOLD2 module does not support Conda. Please use Docker / Singularity / Podman instead.")
}

container "nf-core/proteinfold_alphafold2_standard:1.1.1"

input:
tuple val(meta), path(fasta)
Expand All @@ -19,7 +22,7 @@ process RUN_ALPHAFOLD2 {
path ('mgnify/*')
path ('pdb70/*')
path ('pdb_mmcif/*')
path ('uniclust30/*')
path ('uniref30/*')
path ('uniref90/*')
path ('pdb_seqres/*')
path ('uniprot/*')
Expand All @@ -34,31 +37,35 @@ process RUN_ALPHAFOLD2 {

script:
def args = task.ext.args ?: ''
def db_preset = db_preset ? "full_dbs --bfd_database_path=${params.bfd_dir_path}${params.bfd_metaclust_clu_complete_id30_c90_final_seq_sorted_opt_name} --uniclust30_database_path=${params.uniclust30_dir_path}${params.uniclust30_db_name}" :
"reduced_dbs --small_bfd_database_path=${params.small_bfd_path}${params.bfd_first_non_consensus_sequences_name}"
def db_preset = db_preset ? "full_dbs --bfd_database_path=${params.alphafold2_db}/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt --uniref30_database_path=${params.alphafold2_db}/uniref30/UniRef30_2021_03" :
"reduced_dbs --small_bfd_database_path=${params.alphafold2_db}/small_bfd/bfd-first_non_consensus_sequences.fasta"
if (alphafold2_model_preset == 'multimer') {
alphafold2_model_preset += " --pdb_seqres_database_path=${params.pdb_seqres_dir_path}${params.pdb_seqres_txt_name} --uniprot_database_path=${params.uniprot_dir_path}${params.uniprot_fasta_name} "
alphafold2_model_preset += " --pdb_seqres_database_path=${params.alphafold2_db}/pdb_seqres/pdb_seqres.txt --uniprot_database_path=${params.alphafold2_db}/uniprot/uniprot.fasta "
}
else {
alphafold2_model_preset += " --pdb70_database_path=${params.pdb_dir_path}${params.pdb70_name} "
alphafold2_model_preset += " --pdb70_database_path=${params.alphafold2_db}/pdb70/pdb70_from_mmcif_200916/pdb70 "
}
"""
if [ -f ${params.pdb_seqres_dir_path}/${params.pdb_seqres_txt_name} ]
\$PDB_SEQRES_TEMP=\$(mktemp --directory)
cp ${params.pdb_seqres_dir_path}${params.pdb_seqres_txt_name} \${PDB_SEQRES_TEMP}/
then sed -i "/^\\w*0/d" \$PDB_SEQERS_TEMP/${params.pdb_seqres_txt_name}
RUNTIME_TMP=\$(mktemp -d)
nvcc --version 2>&1 | tee /home/z3545907/nvcc.txt
nvidia-smi 2>&1 | tee /home/z3545907/nvidia-smi.txt
if [ -f ${params.alphafold2_db}/pdb_seqres/pdb_seqres.txt ]
cp ${params.alphafold2_db}/pdb_seqres/pdb_seqres.txt \${RUNTIME_TMP}
then sed -i "/^\\w*0/d" \${RUNTIME_TMP}/pdb_seqres.txt
fi
if [ -d ${params.alphafold2_params_path} ]; then ln -r -s ${params.alphafold2_params_path} params/; fi
if [ -d ${params.alphafold2_db}/params/ ]; then ln -r -s ${params.alphafold2_db}/params params; fi
python3 /app/alphafold/run_alphafold.py \
--fasta_paths=${fasta} \
--model_preset=${alphafold2_model_preset} \
--db_preset=${db_preset} \
--output_dir=\$PWD \
--data_dir=\$PWD \
--uniref90_database_path=${params.uniref90_dir_path}uniref90.fasta \
--template_mmcif_dir=${params.template_mmcif_dir} \
--obsolete_pdbs_path=${params.obsolete_pdbs_path} \
--uniref90_database_path=${params.alphafold2_db}/uniref90/uniref90.fasta \
--mgnify_database_path=${params.alphafold2_db}/mgnify/mgy_clusters_2022_05.fa \
--template_mmcif_dir=${params.alphafold2_db}/pdb_mmcif/mmcif_files \
--obsolete_pdbs_path=${params.alphafold2_db}/pdb_mmcif/obsolete.dat \
--random_seed=53343 \
--use_gpu_relax \
$args
cp "${fasta.baseName}"/ranked_0.pdb ./"${fasta.baseName}".alphafold.pdb
Expand All @@ -71,6 +78,7 @@ process RUN_ALPHAFOLD2 {
echo -e Positions"\\t"rank_0"\\t"rank_1"\\t"rank_2"\\t"rank_3"\\t"rank_4 > header.tsv
cat header.tsv plddt.tsv > ../"${fasta.baseName}"_plddt_mqc.tsv
cd ..
rm -rf "\${RUNTIME_TMP}"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
39 changes: 21 additions & 18 deletions modules/local/run_alphafold2_msa.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
process RUN_ALPHAFOLD2_MSA {
tag "$meta.id"
label 'process_medium'
debug true

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'docker://nfcore/proteinfold_alphafold2_msa:1.0.0' :
'nfcore/proteinfold_alphafold2_msa:1.0.0' }"
// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error("Local RUN_ALPHAFOLD2_MSA module does not support Conda. Please use Docker / Singularity / Podman instead.")
}

container "nf-core/proteinfold_alphafold2_msa:1.1.1"

input:
tuple val(meta), path(fasta)
Expand All @@ -20,7 +22,7 @@ process RUN_ALPHAFOLD2_MSA {
path ('mgnify/*')
path ('pdb70/*')
path ('pdb_mmcif/*')
path ('uniclust30/*')
path ('uniref30/*')
path ('uniref90/*')
path ('pdb_seqres/*')
path ('uniprot/*')
Expand All @@ -35,33 +37,34 @@ process RUN_ALPHAFOLD2_MSA {

script:
def args = task.ext.args ?: ''
def db_preset = db_preset ? "full_dbs --bfd_database_path=${params.bfd_dir_path}${params.bfd_metaclust_clu_complete_id30_c90_final_seq_sorted_opt_name} --uniclust30_database_path=${params.uniclust30_dir_path}${params.uniclust30_db_name}" :
"reduced_dbs --small_bfd_database_path=${params.small_bfd_path}${params.bfd_first_non_consensus_sequences_name}"
def db_preset = db_preset ? "full_dbs --bfd_database_path=${params.alphafold2_db}/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt --uniref30_database_path=${params.alphafold2_db}/uniref30/UniRef30_2021_03" :
"reduced_dbs --small_bfd_database_path=${params.alphafold2_db}/small_bfd/bfd-first_non_consensus_sequences.fasta"
if (alphafold2_model_preset == 'multimer') {
alphafold2_model_preset += " --pdb_seqres_database_path=${params.pdb_seqres_dir_path}${params.pdb_seqres_txt_name} --uniprot_database_path=${params.uniprot_dir_path}/${params.uniprot_fasta_name} "
alphafold2_model_preset += " --pdb_seqres_database_path=${params.alphafold2_db}/pdb_seqres/pdb_seqres.txt --uniprot_database_path=${params.alphafold2_db}/uniprot/uniprot.fasta "
}
else {
alphafold2_model_preset += " --pdb70_database_path=${params.pdb70_dir_path}${params.pdb70_name} "
alphafold2_model_preset += " --pdb70_database_path=${params.alphafold2_db}/pdb70/pdb70_from_mmcif_200916/pdb70 "
}
"""
#if [ -f ${params.pdb_seqres_dir_path}/${params.pdb_seqres_txt_name} ]
# \$PDB_SEQRES_TEMP=\$(mktemp --directory)
# cp ${params.pdb_seqres_dir_path}${params.pdb_seqres_txt_name} \${PDB_SEQRES_TEMP}/
# then sed -i "/^\\w*0/d" \$PDB_SEQERS_TEMP/${params.pdb_seqres_txt_name}
#fi
RUNTIME_TMP=\$(mktemp -d)
if [ -f ${params.alphafold2_db}/pdb_seqres/pdb_seqres.txt ]
cp ${params.alphafold2_db}/pdb_seqres/pdb_seqres.txt \${RUNTIME_TMP}
then sed -i "/^\\w*0/d" \${RUNTIME_TMP}/pdb_seqres.txt
fi
python3 /app/alphafold/run_msa.py \
--fasta_paths=${fasta} \
--model_preset=${alphafold2_model_preset} \
--db_preset=${db_preset} \
--output_dir=\$PWD \
--data_dir=\$PWD \
--uniref90_database_path=${params.uniref90_dir_path}/${params.uniref90_fasta_name} \
--mgnify_database_path=${params.mgnify_database_path}/${params.mgy_clusters_fasta_name} \
--template_mmcif_dir=${params.template_mmcif_dir} \
--obsolete_pdbs_path=${params.obsolete_pdbs_path} \
--uniref90_database_path=${params.alphafold2_db}/uniref90/uniref90.fasta \
--mgnify_database_path=${params.alphafold2_db}/mgnify/mgy_clusters_2022_05.fa \
--template_mmcif_dir=${params.alphafold2_db}/pdb_mmcif/mmcif_files \
--obsolete_pdbs_path=${params.alphafold2_db}/pdb_mmcif/obsolete.dat \
$args
cp "${fasta.baseName}"/features.pkl ./"${fasta.baseName}".features.pkl
rm -rf "\${RUNTIME_TMP}"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
23 changes: 12 additions & 11 deletions modules/local/run_alphafold2_pred.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
*/
process RUN_ALPHAFOLD2_PRED {
tag "$meta.id"
label 'process_medium', 'gpu_compute'
label 'process_medium'
label 'gpu_compute'

// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error("Local RUN_ALPHAFOLD2_PRED module does not support Conda. Please use Docker / Singularity / Podman instead.")
}

container "nf-core/proteinfold_alphafold2_split:1.1.1"

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'docker://nfcore/proteinfold_alphafold2_split:1.0.0' :
'nfcore/proteinfold_alphafold2_split:1.0.0' }"
echo 'true'
input:
tuple val(meta), path(fasta)
val db_preset
Expand All @@ -19,7 +23,7 @@ process RUN_ALPHAFOLD2_PRED {
path ('mgnify/*')
path ('pdb70/*')
path ('pdb_mmcif/*')
path ('uniclust30/*')
path ('uniref30/*')
path ('uniref90/*')
path ('pdb_seqres/*')
path ('uniprot/*')
Expand All @@ -36,18 +40,15 @@ process RUN_ALPHAFOLD2_PRED {
script:
def args = task.ext.args ?: ''
"""
echo \$PWD
#if [ -d ${params.alphafold2_params_path} ];
#then
ln -r -f -s ${params.alphafold2_params_path}* params/
#fi
if [ -d ${params.alphafold2_db}/params/ ]; then ln -r -s ${params.alphafold2_db}/params params; fi
python3 /app/alphafold/run_predict.py \
--fasta_paths=${fasta} \
--model_preset=${alphafold2_model_preset} \
--output_dir=\$PWD \
--data_dir=\$PWD \
--random_seed=53343 \
--msa_path=${msa} \
--use_gpu_relax \
$args
cp "${fasta.baseName}"/ranked_0.pdb ./"${fasta.baseName}".alphafold.pdb
Expand Down

0 comments on commit 9af55b1

Please sign in to comment.