Crystallographic data (Views)

The models that these views work on can be found in Crystallographic data (Models)

Where the views are used (frontend)

Note: For the Diamond instance of fragalysis, authentication is handled by api.security.ISpyBSafeQuerySet, a version of the standard DRF (see RESTful API (Views)) viewsets.ReadOnlyModelViewSet.

  • viewer.views.TargetView: This view is used on the landing page (e.g. https://fragalysis.diamond.ac.uk/viewer/react/landing) to populate the Target list with either open targets (if the user is not logged in) or the Target list of targets that the user is authenticated to see.

  • viewer.views.ProteinView: This view is used on each target specific page to populate protein information on the left-hand side (LHS)

  • viewer.views.ProteinPDBInfoView: This view is used to retrieve the raw pdb file info to display in the central 3D viewer when a protein for a specific ligand is turned on from the LHS when the ‘P’ button is clicked in the hit navigator.

  • viewer.views.ProteinPDBBoundInfoView: This view was previously used to store the bound-state information for each crystal in a target set, and the full list for each target was zipped into a file by the front-end for download with the download button in the menu bar of a target specific page. This has been replaced by serving a zip file of all of the information uploaded to fragalysis for a specific target. (see: [link])

  • viewer.views.ProteinMapInfoView: This view is currently un-used, but is intended to serve the raw electron density data for each ligand when the ‘D’ button is clicked for a ligand in the hit navigator

  • viewer.views.MoleculeView: This view is used to retrieve 2D information about molecules - the properties in the view are displayed on each ligand card on the LHS.

  • viewer.views.MolImageView: This view is used to retreive the 2D image created by the loader, and display it on the LHS

  • viewer.views.CompoundView: This view is used to obtain the 3D coordinates for a molecule, and display them in the central 3D viewer on a target specific page when the ‘L’ button on a specific ligand card in the hit navigator is turned on.

Other views listed below are currently not in use by the front-end.

View details

class viewer.views.TargetView(**kwargs)

DjagnoRF view to retrieve info about targets

url:

api/targets

queryset:

viewer.models.Target.objects.filter()

filter fields:
  • viewer.models.Target.title - ?title=<str>

returns: JSON
  • id: id of the target object

  • title: name of the target

  • project_id: list of the ids of the projects the target is linked to

  • protein_set: list of the ids of the protein sets the target is linked to

  • template_protein: the template protein displayed in fragalysis front-end for this target

  • metadata: link to the metadata file for the target if it was uploaded

  • zip_archive: link to the zip archive of the uploaded data

example output:
   "results": [
    {
        "id": 62,
        "title": "Mpro",
        "project_id": [
            2
        ],
        "protein_set": [
            29281,
            29274,
            29259,
            29305,
            ...,
        ],
        "template_protein": "/media/pdbs/Mpro-x10417_0_apo.pdb",
        "metadata": "http://fragalysis.diamond.ac.uk/media/metadata/metadata_2FdP5OJ.csv",
        "zip_archive": "http://fragalysis.diamond.ac.uk/media/targets/Mpro.zip"
    }
]
serializer_class

alias of viewer.serializers.TargetSerializer

class viewer.views.ProteinView(**kwargs)

DjagnoRF view to retrieve bound pdb info (file) for a given protein

url:

api/proteins

queryset:

viewer.models.Protein.objects.filter()

filter fields:
  • viewer.models.Protein.code - ?code=<str>

  • viewer.models.Protein.target_id - ?target_id=<int>

  • viewer.models.Protein.prot_type - ?prot_type=<str>

returns: JSON
  • id: id of the protein object

  • code: the code/name of the protein

  • target_id: the id of the related target object

  • prot_type: the type of protein (e.g. AP for apo)

  • pdb_info: link to the apo pdb file

  • bound_info: link to the bound pdb file

  • mtz_info: link to the mtz file

  • map_info: link to the map file

  • cif_info: link to the cif file

example output:
"results": [
 {
     "id": 14902,
     "code": "XX02KALRNA-x1376_1",
     "target_id": 51,
     "prot_type": "AP",
     "pdb_info": "http://fragalysis.diamond.ac.uk/media/pdbs/XX02KALRNA-x1376_1_apo_9VSCvR8.pdb",
     "bound_info": "http://fragalysis.diamond.ac.uk/media/bound/XX02KALRNA-x1376_1_bound_6xmXkUm.pdb",
     "mtz_info": null,
     "map_info": null,
     "cif_info": null
 },]
serializer_class

alias of viewer.serializers.ProteinSerializer

class viewer.views.ProteinPDBInfoView(**kwargs)

DjagnoRF view to retrieve apo pdb info (file) for a given protein

url:

api/protpdb

queryset:

viewer.models.Protein.objects.filter()

filter fields:
  • viewer.models.Protein.code - ?code=<str>

  • viewer.models.Protein.target_id - ?target_id=<int>

  • viewer.models.Protein.prot_type - ?prot_type=<str>

returns: JSON
  • id: id of the protein object

  • pdb_data: If a pdb file has been uploaded for the protein bound_info.path.read()

  • prot_type: type of protein (e.g. AP for apo - see docs for model)

example output:
"results": [
 {
     "id": 27387,
     "pdb_data": "REMARK warning: chains may be ommitted for alignment REMARK ...",
     "prot_type": "AP"
 },]
serializer_class

alias of viewer.serializers.ProtPDBInfoSerialzer

class viewer.views.ProteinPDBBoundInfoView(**kwargs)

DjagnoRF view to retrieve bound pdb info (file) for a given protein

url:

api/protpdbbound

queryset:

viewer.models.Protein.objects.filter()

filter fields:
  • viewer.models.Protein.code - ?code=<str>

  • viewer.models.Protein.target_id - ?target_id=<int>

  • viewer.models.Protein.prot_type - ?prot_type=<str>

returns: JSON
  • id: id of the protein object

  • pdb_data: If a pdb file has been uploaded for the protein bound_info.path.read()

  • prot_type: type of protein (e.g. AP for apo - see docs for model)

example output:
"results": [
 {
     "id": 27387,
     "pdb_data": "REMARK warning: chains may be ommitted for alignment REMARK ...",
     "prot_type": "AP"
 },]
serializer_class

alias of viewer.serializers.ProtPDBBoundInfoSerialzer

class viewer.views.ProteinMapInfoView(**kwargs)

DjagnoRF view to retrieve map info (file) for a given protein

url:

api/protmap

queryset:

viewer.models.Protein.objects.filter()

filter fields:
  • viewer.models.Protein.code - ?code=<str>

  • viewer.models.Protein.target_id - ?target_id=<int>

  • viewer.models.Protein.prot_type - ?prot_type=<str>

returns:

If a map file has been uploaded for the protein map_info.path.read() (JSON)

serializer_class

alias of viewer.serializers.ProtMapInfoSerialzer

class viewer.views.MoleculeView(**kwargs)

DjagnoRF view to retrieve info about molecules

url:

api/molecules

queryset:

viewer.models.Molecule.objects.filter()

filter fields:
  • viewer.models.Molecule.prot_id - ?prot_id=<int>

  • viewer.models.Molecule.cmpd_id - ?cmpd_id=<int>

  • viewer.models.Molecule.smiles - ?smiles=<string>

  • viewer.models.Molecule.prot_id__target_id - ?target_id=<int>

  • viewer.models.Molecule.mol_type - ?mol_type=<str>

  • viewer.models.Molecule.mol_groups - ?mol_groups=<int>,<int>

returns: JSON
  • id: id of the target object

  • smiles: smiles string of the molecule

  • cmpd_id: id of the related 2D compound object

  • prot_id: id of the related protein object

  • protein_code: code of the related protein object

  • mol_type: type of molecule - see Molecule model docs

  • molecule_protein: filepath of the apo protein structure for the molecule

  • lig_id: residue label for the ligand

  • chain_id: chain in the pdb file that the ligand belongs to

  • sdf_info: 3D coordinated of the molecule in MDL file format

  • x_com: x-coordinate for molecule centre of mass

  • y_com: y-coordinate for molecule centre of mass

  • z_com: z-coordinate for molecule centre of mass

  • mw: molecular weight

  • logp: LogP

  • tpsa: Topological Polar Surface Area

  • ha: heavy atom count

  • hacc: hydrogen-bond acceptors

  • hdon: hydrogen-bond donors

  • rots: number of rotatable bonds

  • rings: number of rings

  • velec: number of valence electrons

example output:
"results": [
 {
     "id": 13912,
     "smiles": "CN(C)c1ccc(C(=O)Nc2ccccn2)cc1",
     "cmpd_id": 796,
     "prot_id": 13923,
     "protein_code": "NUDT7A_Crude-x2226_2",
     "mol_type": "PR",
     "molecule_protein": "/media/pdbs/NUDT7A_Crude-x2226_2_apo_x5GxiLq.pdb",
     "lig_id": "LIG",
     "chain_id": "Z",
     "sdf_info": "     RDKit          3D 18 19  0  0  0  0  0  0  0  0999...",
     "x_com": null,
     "y_com": null,
     "z_com": null,
     "mw": 241.12,
     "logp": 2.4,
     "tpsa": 45.23,
     "ha": 18,
     "hacc": 3,
     "hdon": 1,
     "rots": 3,
     "rings": 2,
     "velec": 92
 },]
serializer_class

alias of viewer.serializers.MoleculeSerializer

class viewer.views.MolImageView(**kwargs)

DjagnoRF view for molecule images

url:

api/molimg

queryset:

viewer.models.Molecule.objects.filter()

filter fields:
  • viewer.models.Molecule.prot_id - ?prot_id=<int>

  • viewer.models.Molecule.cmpd_id - ?cmpd_id=<int>

  • viewer.models.Molecule.smiles - ?smiles=<str>

  • viewer.models.Molecule.prot_id__target_id - ?target_id=<int>

  • viewer.models.Molecule.mol_groups - ?mol_groups=<int>,<int>

returns:

SVG image text for query molecule generated by api.utils.draw_mol() (JSON)

example output:
"results": [
       {"id": 13912,
           "mol_image": "<?xml version='1.0' encoding='iso-8859-1'?><svg version='1.1' nk'..."}]
serializer_class

alias of viewer.serializers.MolImageSerialzier

class viewer.views.CompoundView(**kwargs)

DjagnoRF view for compound info

url:

api/compounds

queryset:

viewer.models.Compound.objects.filter()

filter fields:
  • viewer.models.Molecule.smiles - ?smiles=<str>

returns:
  • id: id for compound object

  • inchi: inchi key for compound

  • smiles: smiles string for compound

  • mol_log_p: LogP for compound

  • num_h_acceptors: number of hydrogen-bond acceptors

  • num_h_donors: number of hydrogen-bond donors

example output:
"results": [
{
    "id": 1,
    "inchi": "InChI=1S/C9H15NOS/c1-7(11)5-10-6-9-4-3-8(2)12-9/h3-4,7,10-11H,5-6H2,1-2H3/t7-/m0/s1",
    "smiles": "Cc1ccc(CNC[C@H](C)O)s1",
    "mol_log_p": 1.52692,
    "mol_wt": 185.0874351,
    "num_h_acceptors": 3,
    "num_h_donors": 2
},]
serializer_class

alias of viewer.serializers.CompoundSerializer

class viewer.views.CompoundImageView(**kwargs)

DjagnoRF view for compound images

url:

api/cmpdimg

queryset:

viewer.models.Compound.objects.filter()

filter fields:
  • viewer.models.Molecule.smiles - ?smiles=<str>

returns:

SVG image text for query compound generated by api.utils.draw_mol() (JSON)

example output:
"results": [
        {"id": 13912,
            "mol_image": "<?xml version='1.0' encoding='iso-8859-1'?><svg version='1.1' nk'..."}]
serializer_class

alias of viewer.serializers.CmpdImageSerialzier