Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for foldmason Guidetree and visualization #179

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
50 changes: 50 additions & 0 deletions .params_2024-12-02_11-11-58.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"input": "https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/samplesheet/v1.0/samplesheet_test_af2.csv",
"tools": "https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/toolsheet/v1.0/toolsheet_small.csv",
"templates_suffix": ".pdb",
"optional_data_dir": null,
"build_consensus": true,
"skip_stats": false,
"calc_sim": true,
"calc_seq_stats": true,
"extract_plddt": true,
"skip_eval": false,
"calc_sp": true,
"calc_tc": true,
"calc_irmsd": true,
"calc_gaps": true,
"calc_tcs": true,
"skip_compression": false,
"multiqc_config": null,
"multiqc_title": null,
"multiqc_logo": null,
"max_multiqc_email_size": "25.MB",
"multiqc_methods_description": null,
"skip_multiqc": false,
"outdir": "results",
"publish_dir_mode": "copy",
"email": null,
"email_on_fail": null,
"plaintext_email": false,
"monochrome_logs": false,
"hook_url": null,
"help": false,
"help_full": false,
"show_hidden": false,
"version": false,
"pipelines_testdata_base_path": "https://raw.githubusercontent.com/nf-core/test-datasets/",
"shiny_app": "/home/luisasantus/Desktop/multiplesequencealign/bin/shiny_app",
"skip_shiny": false,
"shiny_trace_mode": "latest",
"config_profile_name": "Full test profile",
"config_profile_description": "Full test dataset to check pipeline function",
"custom_config_version": "master",
"custom_config_base": "https://raw.githubusercontent.com/nf-core/configs/master",
"config_profile_contact": null,
"config_profile_url": null,
"validate_params": true,
"igenomes_ignore": true,
"genomes": {

}
}
3 changes: 3 additions & 0 deletions assets/samplesheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,fasta,reference,optional_data
seatoxin-ref,https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/setoxin-ref.fa,https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/setoxin.ref,https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/structures/seatoxin-ref.tar.gz
toxin-ref,https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/toxin-ref.fa,https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/toxin.ref,
4 changes: 4 additions & 0 deletions assets/toolsheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tree,args_tree,aligner,args_aligner
,,FOLDMASON,
FAMSA,,FAMSA,
FAMSA,,FOLDMASON,
35 changes: 35 additions & 0 deletions bin/pdbs_to_fasta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python

# read in multiple pdb files, extract the sequence and write to a fasta file
import sys
from Bio import PDB
from Bio.SeqUtils import seq1


def pdb_to_fasta(pdb_file):
"""
Extract the sequence from a PDB file and format it in FASTA.
"""
parser = PDB.PDBParser(QUIET=True)
structure = parser.get_structure(pdb_file, pdb_file)
fasta_sequences = []
file_id = pdb_file.rsplit(".", 1)[0] # Use the file name without extension as ID

for model in structure:
for chain in model:
sequence = []
for residue in chain:
if PDB.is_aa(residue, standard=True):
sequence.append(seq1(residue.resname))
if sequence:
fasta_sequences.append(f">{file_id}\n{''.join(sequence)}")
return "\n".join(fasta_sequences)

def main():
pdb_files = sys.argv[1:]
for pdb_file in pdb_files:
fasta = pdb_to_fasta(pdb_file)
print(f"{fasta}")

if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions bin/shiny_app/shiny_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
sys.exit(1)

def merge_tree_args(row):
if str(row["tree"]) == "nan":
if str(row["tree"]) == "DEFAULT":
return "None"
elif str(row["args_tree"]) == "nan":
elif str(row["args_tree"]) == "default":
return str(row["tree"]) + " ()"
else:
return str(row["tree"]) + " (" + str(row["args_tree"]) + ")"
Expand All @@ -42,7 +42,7 @@ def merge_tree_args(row):
def merge_aligner_args(row):
if str(row["aligner"]) == "nan":
return "None"
elif str(row["args_aligner"]) == "nan":
elif str(row["args_aligner"]) == "default":
return str(row["aligner"]) + " ()"
else:
return str(row["aligner"]) + " (" + str(row["args_aligner"]) + ")"
Expand Down
30 changes: 21 additions & 9 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
meta.args_tree ? "args: ${meta.args_tree}" : ""
].join(' ').trim()
}
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}" }
ext.args = { "${meta.args_tree}" == "null" ? '' : "${meta.args_tree}" }
publishDir = [
path: { "${params.outdir}/trees/${meta.id}" },
Expand All @@ -99,7 +99,7 @@
meta.args_aligner ? "args: ${meta.args_aligner}" : ""
].join(' ').trim()
}
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}" }
ext.args = { "${meta.args_aligner}" == "null" ? '' : "${meta.args_aligner}" }
if(params.skip_compression){
publishDir = [
Expand All @@ -119,7 +119,7 @@
meta.args_aligner ? "args: ${meta.args_aligner}" : ""
].join(' ').trim()
}
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}" }
ext.args = { "${meta.args_aligner}" == "null" ? '' : "${meta.args_aligner}" }
if(params.skip_compression){
publishDir = [
Expand Down Expand Up @@ -174,21 +174,21 @@
//

withName: 'PARSE_IRMSD' {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_irmsd" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_irmsd" }
}

withName: 'TCOFFEE_ALNCOMPARE_SP' {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_sp" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_sp" }
ext.args = "-compare_mode sp"
}

withName: 'TCOFFEE_ALNCOMPARE_TC' {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_tc" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_tc" }
ext.args = "-compare_mode tc"
}

withName: 'TCOFFEE_IRMSD' {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_irmsd" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_irmsd" }
publishDir = [
path: { "${params.outdir}/evaluation/${task.process.tokenize(':')[-1].toLowerCase()}" },
mode: params.publish_dir_mode,
Expand All @@ -198,7 +198,7 @@
}

withName: "CALC_GAPS" {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_gaps" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_gaps" }
}

withName: "CONCAT_IRMSD" {
Expand All @@ -222,7 +222,7 @@
}

withName: 'TCOFFEE_TCS' {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_tcs" }
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}_tcs" }
publishDir = [
path: { "${params.outdir}/evaluation/${task.process.tokenize(':')[-1].toLowerCase()}" },
mode: params.publish_dir_mode,
Expand Down Expand Up @@ -269,4 +269,16 @@
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

//
// Visualization
//
withName: 'FOLDMASON_MSA2LDDTREPORT' {
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.args_tree_clean}_${meta.aligner}-args-${meta.args_aligner_clean}" }
publishDir = [
path: { "${params.outdir}/visualization" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}
13 changes: 7 additions & 6 deletions conf/test_pdb.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ params {
config_profile_name = 'Test profile'
config_profile_description = 'Minimal test dataset to check pipeline function'

skip_stats = true
calc_irmsd = true
calc_sp = false
calc_tc = false
calc_gaps = false
calc_tcs = false
skip_preprocessing = false
skip_stats = true
calc_irmsd = true
calc_sp = false
calc_tc = false
calc_gaps = false
calc_tcs = false

// Input data
input = params.pipelines_testdata_base_path + 'multiplesequencealign/samplesheet/v1.0/samplesheet_test.csv'
Expand Down
Loading
Loading