Opened 6 years ago

Closed 6 years ago

#3131 closed enhancement (fixed)

Read CCD CIFs directly

Reported by: goddard@… Owned by: Eric Pettersen
Priority: normal Milestone:
Component: Input/Output Version:
Keywords: Cc: Eric Pettersen, Greg Couch
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Darwin-19.4.0-x86_64-i386-64bit
ChimeraX Version: 0.94 (2020-04-16)
Description
Would be nice if ChimeraX could display ligand structures from the RCSB chemical component dictionary.  When I try to open CRO.cif, the fluorophore from GFP ChimeraX simply opens no models and gives no warning.

I realize these CIF files are slightly different but the do contain the atomic coordinates.  It is useful to look at them to see all the standard hydrogens.

I've attached CRO.cif.

Log:
Startup Messages  
---  
note | FYI: command is replacing existing command: "open"  
  
UCSF ChimeraX version: 0.94.dev202004160103 (2020-04-16)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> open CRO.cif




OpenGL version: 4.1 ATI-3.8.24
OpenGL renderer: AMD Radeon Pro Vega 20 OpenGL Engine
OpenGL vendor: ATI Technologies Inc.
File attachment: CRO.cif

CRO.cif

Attachments (1)

CRO.cif (8.9 KB ) - added by goddard@… 6 years ago.
Added by email2trac

Download all attachments as: .zip

Change History (9)

by goddard@…, 6 years ago

Attachment: CRO.cif added

Added by email2trac

comment:1 by Eric Pettersen, 6 years ago

Cc: Eric Pettersen added
Component: UnassignedInput/Output
Owner: set to Greg Couch
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionRead CCD CIFs directly
Type: defectenhancement

This could be handled by requiring the 'format' argument for such CIFs (e.g. "format cif") and handing off a flag to the mmCIF code in such a case. For that matter, an entirely separate bundle could handle these files.

comment:2 by Eric Pettersen, 6 years ago

Actually probably "format ccdcif" or "format ccd" since you might want to reserve "cif" for non-RCSB small-molecule CIFs.

comment:3 by Greg Couch, 6 years ago

There are a couple of ways this can be done. ChimeraX already exposes the atomic coordinates of the CCD files, atomic.mmcif.find_template_residue(session, name) will get/fetch the named CCD file and return a TmplResidue object. The bonds need to be exposed (I see the TmplBond class exposed, but no way to get them). So, that could be turned into a model.

But it would be nice if there were a mechanism for the mmCIF reader to tell if the CIF file were really a different format, and then invoke that format's parser. For example, if no atomic coordinates are found, but there are atom_site.fract_{x,y,z} data items, then it is a small molecule CIF file.

comment:4 by Eric Pettersen, 6 years ago

It would probably be most convenient if you actually implemented it as a fetcher, e.g. "open ccd:fxn"

comment:5 by Tristan Croll, 6 years ago

I've been using the following in ISOLDE to build new residues from a TmplResidue for a while. Even if the TmplBond class isn't exposed, each atom has a neighbors property.

def new_residue_from_template(model, template, chain_id, center,
        residue_number=None, insert_code=' ', b_factor=50, precedes=None):
    '''
    Create a new residue based on a template, and add it to the model.
    '''
    if residue_number is None:
        if chain_id in model.residues.chain_ids:
            residue_number = suggest_new_residue_number_for_ligand(model, chain_id)
        else:
            residue_number = 0
    import numpy
    from chimerax.atomic import Atom
    t_coords = numpy.array([a.coord for a in template.atoms])
    t_center = t_coords.mean(axis=0)
    t_coords += numpy.array(center) - t_center
    tatom_to_atom = {}
    r = model.new_residue(template.name, chain_id, residue_number,
        insert=insert_code, precedes=precedes)
    for i, ta in enumerate(template.atoms):
        a = tatom_to_atom[ta] = model.new_atom(ta.name, ta.element)
        a.coord = t_coords[i]
        a.bfactor = b_factor
        r.add_atom(a)
        for tn in ta.neighbors:
            n = tatom_to_atom.get(tn, None)
            if n is not None:
                model.new_bond(a, n)
    return r

comment:6 by Greg Couch, 6 years ago

Owner: changed from Greg Couch to Eric Pettersen

Added "open ccd:GLY". Clicking on it in the File History doesn't work (Invalid Format), but Eric will look at that.

comment:7 by Greg Couch, 6 years ago

Cc: Greg Couch added

comment:8 by Eric Pettersen, 6 years ago

Resolution: fixed
Status: assignedclosed

Error was only happening for fetch-only formats. SMILES suffered from the same problem. Fixed.

Note: See TracTickets for help on using tickets.