Target Generation¶
This module is used to define PMHC objects (including Target and Template objects) and Model objects.
The class used to generate a PANDORA target is PANDORA.PMHC.Target.
This module also contain the Model class, carrying various information of the output models.
These objects can be saved when using PANDORA.Pandora.Pandora.model with the argument pickle_out=True
Basic target Example:
>>> from PANDORA.PMHC import Target
>>>
>>> target = PMHC.Target(id = 'myTestCase',
>>> MHC_class = 'I',
>>> allele_type = 'HLA-A*02:01',
>>> peptide = 'LLFGYPVYV',
>>> anchors = [2,9])
>>>
PMHC¶
- class PANDORA.PMHC.PMHC.PMHC(id, peptide='', allele_type=[], MHC_class='I', M_chain_seq='', B2M_seq='', N_chain_seq='', anchors=[], helix=False, sheet=False)[source]¶
Bases:
ABCpMHC class. Acts as a parent class to Template and Target
- Parameters:
id – (string) PDB identifier
allele_type – (list) list of MHC alleles (or allele)
peptide – (string) peptide sequence
MHC_class – (string) either ‘I’ or ‘II’ denoting MHC class I and MHC class II respectively
M_chain_seq – (string) M chain sequence for the Alpha chain
N_chain_seq – (string) N chain sequence for the Beta chain
anchors – (list) list of integers specifying which residue(s) of the peptide should be fixed as an anchor during the modelling. MHC class I typically has 2 anchors, while MHC class II typically has 4.
- class PANDORA.PMHC.PMHC.Template(id, peptide='', allele_type=[], MHC_class='I', M_chain_seq='', B2M_seq='', N_chain_seq='', anchors=[], G_domain_span=False, helix=False, sheet=False, pdb_path=False, pdb=False, remove_biopython_object=False, reverse=False)[source]¶
Bases:
PMHC- Template structure class. This class holds all information of a template structure that is used for
homology modelling. This class needs a id, allele and the path to a pdb file to work. (sequence info of the chains and peptide can be fetched from the pdb)
- Parameters:
id – (string) PDB identifier
allele_type – (list) list of MHC alleles (or allele)
peptide – (string) peptide sequence
MHC_class – (string) either ‘I’ or ‘II’ denoting MHC class I and MHC class II respectively
M_chain_seq – (string) M chain sequence for the Alpha chain
N_chain_seq – (string) N chain sequence for the Beta chain
anchors – (list) list of integers specifying which residue(s) of the peptide should be fixed as an anchor during the modelling. MHC class I typically has 2 anchors, while MHC class II typically has 4.
G_domain_span (list) – span of the G domain(s) over the sequence. The format should be [(1, 90),(1, 86)]
pdb_path – (string) path to pdb file. The user should provide this argument if they want to use a template outside the normal templates folder.
pdb – (Bio.PDB) Biopython PBD object
- parse_pdb(custom_map={'MSE': 'M'})[source]¶
Loads pdb from path, updates self.pdb field and self.chain_seq/self.peptide if they were empty
- Parameters:
custom_map (dict) – custom map of 3-letter to 1-letter residues translation, used by Bio.SeqUtiles.seq1 to decide how to assign non-canonical residues. Defaults to {“MSE”:”M”}.
- class PANDORA.PMHC.PMHC.Target(id, peptide, allele_type=[], MHC_class='I', M_chain_seq='', N_chain_seq='', B2M_seq='', anchors=[], helix=False, sheet=False, templates=False, use_netmhcpan=False, use_templ_seq=False, output_dir=False, rm_netmhcpan_output=True, reverse=False)[source]¶
Bases:
PMHCTarget structure class. This class needs an ID (preferably a PDB ID), allele and pepide information.
- Parameters:
id – (string) PDB identifier
peptide – (string) peptide sequence
allele_type – (list) list of MHC alleles (or allele)
MHC_class – (string) either ‘I’ or ‘II’ denoting MHC class I and MHC class II respectively
M_chain_seq – (string) M chain sequence for the Alpha chain
N_chain_seq – (string) N chain sequence for the Beta chain
anchors – (list) list of integers specifying which residue(s) of the peptide should be fixed as an anchor during the modelling. MHC class I typically has 2 anchors, while MHC class II typically has 4.
templates – Template object. The user can specify that PANDORA uses a certain structure as template.
use_netmhcpan (bool) – If True, uses local installation of NetMHCPan to predict the anchors when anchor positions are not provided. Defaults to False.
use_templ_seq (bool) – If True, if no MHC chain sequences could be retrieved starting from the allele name, it will use the best template MHC sequences for the modelling.
output_dir – (string) Path to output directory. Defaults to current working directory.
rm_netmhcpan_output – (bool) If True, removes the netmhcpan infile and outfile after having used them for netmhcpan.
- check_allele_name()[source]¶
Checks the spell of the allele name and tried to correct it. Prints out warning if the allele name does not seem correct.
- retrieve_MHC_refseq(input_file=None, chain='M', permissive=False)[source]¶
Retrieves MHC reference sequence from fasta file.
- Parameters:
input_file (str, optional) – Path to the input reference fasta file. Defaults to None.
chain (str) – ID of the chain to be retrieved (M or N). Defaults to ‘M’.
permissive (bool) – If True, if no chain of the exact allele can be found, it will try to retrieve a chain from the same allele subgroup. Defaults to False.
- Returns:
None.
Model¶
- class PANDORA.PMHC.Model.Model(target, model_path='', output_dir=False, pdb=False, molpdf=0, dope=0)[source]
Initiate model object :param target: Target object :param model_path: (string) path to hypothetical model :param output_dir: (string) output directory :param pdb: Bio.PDB object of the hypothetical model :param molpdf: (float) molpdf score :param dope: (float) DOPE score
- calc_LRMSD(reference_pdb, atoms=['C', 'CA', 'N', 'O'], ligand_zone='whole')[source]
- Calculate the L-RMSD between the decoy and reference structure (ground truth).
This function requires the pdb2sql module for L-RMSD calculation.
- Parameters:
- Raises:
Exception – PDB2SQL LRMSD claulation failed
Returns: (float) L-RMSD calculated by PDB2SQL
- PANDORA.PMHC.Model.merge_chains(pdb)[source]
Merges two chains of MHCII to one chain. pdb2sql can only calculate L-rmsd with one chain. :param pdb: Bio.PDB object
Returns: Bio.PDB object with its M and N chain merged as M chain
- PANDORA.PMHC.Model.renumber(pdb_ref, pdb_decoy, custom_map={'MSE': 'M'})[source]
aligns two pdb’s and renumber them accordingly. :param pdb_ref: Bio.PDB object :param pdb_decoy: Bio.PDB object
Returns: Bio.PDB objects with renumbered residues
- PANDORA.PMHC.Model.homogenize_pdbs(decoy, ref, atoms, output_dir, target_id='MHC', anchors=False, flanking=False)[source]
Make sure that the decoy and reference structure have the same structure sequences. :param decoy: Bio.PDB object of the decoy structure :param ref: Bio.PDB object of the reference structure :param output_dir: (string) directory that is used to write intermediate files
Returns: (tuple) Bio.PDB objects with the same structure sequence
- PANDORA.PMHC.Model.get_Gdomain_lzone(ref_pdb, output_dir, MHC_class)[source]
Produce a lzone file for pdb2sql. :param ref_pdb: path to the pdb file to use for the lzone :type ref_pdb: str :param output_dir: output directory :type output_dir: str :param MHC_class: Class of the MHC :type MHC_class: str
- PANDORA.PMHC.Model.remove_C_like_domain(pdb, need_to_be_removed=None)[source]
Removes the C-like domain from a MHC struture and keeps only the G domain :param pdb: (Bio.PDB): Bio.PDB object with chains names M (N for MHCII) and P :param need_to_be_removed: list of atoms to remove from M chain. Defaults to None. :type need_to_be_removed: list, optional
Returns: (Bio.PDB): Bio.PDB object without the C-like domain
- PANDORA.PMHC.Model.trim_indels(pdb_ref, pdb_decoy, ref_sequences, decoy_sequences)[source]
Trim indels for both reference and decoy PDBs
- Parameters:
pdb_ref (Bio.PDB) – object with chains names M (N for MHCII) and P
pdb_decoy (Bio.PDB) – object with chains names M (N for MHCII) and P
ref_sequences – List of residue numbers in reference PDB
decoy_sequences – List of residue numbers in decoy PDB
Returns: Bio.PDB objects (reference and decoy) with matched residues
- PANDORA.PMHC.Model.get_residue_atoms(decoy_res, ref_res)[source]
Retrieves all atom names of a given residue for both reference and decoy
- Parameters:
ref_res (Bio.PDB.Residue) – Residue object from reference PDB
decoy_res (Bio.PDB.Residue) – Residue object from decoy PDB
Returns: Bio.PDB.Atom objects (reference and decoy) of the given residues
- PANDORA.PMHC.Model.remove_atoms_from_res(ref_chain, decoy_chain, i)[source]
Mismatched residues in Reference is removed both from decoy and reference
- PANDORA.PMHC.Model.remove_mismatched_atoms_from_res(diff_atoms, dif_res, atoms)[source]
Mismatched atoms in the given residue object is removed
- PANDORA.PMHC.Model.remove_mismatched_atoms_from_pdb(ref, decoy, atoms)[source]
Mismatched atoms in the given PDB object is removed :param ref: object with chains names M (N for MHCII) and P :type ref: Bio.PDB :param decoy: object with chains names M (N for MHCII) and P :type decoy: Bio.PDB :param atoms: _description_ :type atoms: _type_
- Returns:
_description_
- Return type:
_type_
Anchors¶
- PANDORA.PMHC.Anchors.pMHCI_anchors(pdb)[source]
Finds peptide anchor residues of p:MHCI complexes
- Parameters:
pdb – Bio.PDB object (or path to pdb file (string))
Returns: (list of ints) Peptide anchor residue positions
- PANDORA.PMHC.Anchors.pMHCII_anchors(pdb)[source]
Finds peptide anchor residues of p:MHCII complexes
- Parameters:
pdb – Bio.PDB object (or path to pdb file (string))
Returns: (list of ints) Peptide anchor residue positions