Source-only snapshot of the cluster branch for WES execution. Large reference files (HPA/MANE/ensemble FASTA, model weights, ~597 MB) are omitted: they are baked into the container images at build time and mounted from the dreamdock-data PVC at runtime, and exceed the Gitea request size limit. Pipeline entry point is main.nf, which orchestrates the biotransformer, conplex and tissue modules as a single workflow. Ligand inputs are read from the eureka workspace; protein_zarr and chembl_db come from the dreamdock-data PVC.
124 lines
4.8 KiB
Plaintext
124 lines
4.8 KiB
Plaintext
nextflow.enable.dsl=2
|
|
|
|
|
|
process CONPLEX {
|
|
container "${params.container_conplex}"
|
|
containerOptions "${params.containerOptions}"
|
|
publishDir "${params.outdir}/${params.project_name}/receptors", mode: 'copy'
|
|
debug true
|
|
maxForks 5
|
|
// scratch true //deletes workdir after successful completion
|
|
|
|
input:
|
|
path smi_drug
|
|
path smi_metabolite
|
|
path mut_fasta
|
|
|
|
output:
|
|
path "*drug_scores.tsv", emit: drug
|
|
path "*significant_interactions.tsv", emit: interactions
|
|
|
|
script:
|
|
"""
|
|
workdir=`pwd`
|
|
|
|
#concat mutated and reference fasta files. If it has name with _2 its mutated.
|
|
#after test is don retrun this
|
|
cat $mut_fasta /home/omic/ConPLex/MANE_referent_transcipt_reference.fasta > \$workdir/all_protein.fasta
|
|
|
|
### Test
|
|
#head -n 100 /home/omic/ConPLex/MANE_referent_transcipt_reference.fasta > \$workdir/test.fasta
|
|
#cat $mut_fasta \$workdir/test.fasta > \$workdir/all_protein.fasta
|
|
###
|
|
|
|
. activate conplex-dti
|
|
|
|
#transform smi for conplex
|
|
python3 -c "
|
|
import sys
|
|
from rdkit import Chem
|
|
import numpy as np
|
|
import pandas as pd
|
|
|
|
def converter(drug_csv, outname):
|
|
#open file to write drug/matabolite smi
|
|
out_file = open(outname + '.txt', 'w')
|
|
|
|
#load drug csv; only has drug in separate lines
|
|
drug_smi_list = np.array(pd.read_csv(drug_csv)['SMILES']).tolist()
|
|
#original drugs are anotated with drug_{}
|
|
for n, smi in enumerate(drug_smi_list):
|
|
out_file.write('{}\\tdrug_{}\\n'.format(smi, n))
|
|
|
|
out_file.close()
|
|
|
|
converter('$smi_drug', 'drag')
|
|
"
|
|
#concatinate drag and metabolites
|
|
cat drag.txt $smi_metabolite > \$workdir/smiles.smi
|
|
#conplex predicition 1. round
|
|
python3 /home/omic/ConPLex/conplex.py --fastas \$workdir/all_protein.fasta --smis \$workdir/smiles.smi --screening_batch_size ${params.screening_batch_size} --outdir \$workdir --split_write_df 'no'
|
|
#### this part is use to test all alternative transcripts (this part can be skipped for now, cuz we will use it for tissue specific analysis later)
|
|
##get fasta for 2. round transcripts for proteins above threshold
|
|
#python3 /home/omic/ConPLex/get_round_2.py --threshold ${params.threshold} --workdir \$workdir --round 1
|
|
##conplex all transcipt for protrin above threshold
|
|
#python3 /home/omic/ConPLex/conplex.py --fastas \$workdir/round_2.fasta --smis \$workdir/smiles.smi --screening_batch_size ${params.screening_batch_size} --outdir \$workdir --split_write_df 'no'
|
|
####
|
|
#get data for second run
|
|
python3 /home/omic/ConPLex/get_round_2.py --threshold ${params.threshold} --workdir \$workdir --round 2
|
|
"""
|
|
}
|
|
|
|
process NETWORK_ENRICHMENT {
|
|
container "${params.container_conplex}"
|
|
containerOptions "${params.containerOptions}"
|
|
publishDir "${params.outdir}/${params.project_name}/receptors", mode: 'copy'
|
|
debug true
|
|
maxForks 5
|
|
|
|
input:
|
|
path interactions
|
|
|
|
output:
|
|
path "*_network_enrichment.tsv", emit: network_enrichment
|
|
path "*_network_interactions.tsv", emit: network_interactions
|
|
|
|
script:
|
|
"""
|
|
#!/opt/conda/envs/conplex-dti/bin/python
|
|
import pandas as pd
|
|
import requests
|
|
|
|
interaction_data = pd.read_csv('$interactions', sep = '\\t')
|
|
interaction_data = interaction_data.sort_values('conplex_score', ascending=False)
|
|
|
|
#get list of enst above threshold
|
|
protein_network_list = '%0d'.join(list(pd.unique(interaction_data[interaction_data['conplex_score'] > ${params.protein_network_threshold}]['transcipt'])))
|
|
|
|
#get urls
|
|
url_network = f'https://string-db.org/api/tsv/network?identifiers={protein_network_list}&species=9606'
|
|
url_enrichment = f'https://string-db.org/api/tsv/enrichment?identifiers={protein_network_list}&species=9606'
|
|
|
|
#get enrichment dataframe
|
|
r = requests.get(url_enrichment)
|
|
lines = r.text.split('\\n') # pull the text from the response object and split based on new lines
|
|
data = [l.split('\\t') for l in lines] # split each line into its components based on tabs
|
|
enrichment_df = pd.DataFrame(data[1:-1], columns = data[0]) # convert to dataframe using the first row as the column names; drop empty, final row
|
|
#get protein interaction dataframe
|
|
r = requests.get(url_network)
|
|
lines = r.text.split('\\n') # pull the text from the response object and split based on new lines
|
|
data = [l.split('\\t') for l in lines] # split each line into its components based on tabs
|
|
# convert to dataframe using the first row as the column names; drop empty, final row
|
|
interactions_df = pd.DataFrame(data[1:-1], columns = data[0])
|
|
# dataframe with the preferred names of the two proteins and the score of the interaction
|
|
#interactions_df = interactions_df[['preferredName_A', 'preferredName_B', 'score']]
|
|
|
|
#output name
|
|
output_name = '$interactions'.split('/')[-1].split('_significant_interactions.tsv')[0]
|
|
|
|
#save
|
|
enrichment_df.to_csv(f'{output_name }_network_enrichment.tsv',sep='\\t')
|
|
interactions_df.to_csv(f'{output_name }_network_interactions.tsv',sep='\\t')
|
|
"""
|
|
}
|