Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1513 closed enhancement (fixed)

Add crystallographic reflection files to command-line open

Reported by: Tristan Croll Owned by: Tristan Croll
Priority: moderate Milestone:
Component: Command Line Version:
Keywords: Cc: Eric Pettersen, Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

I'm currently working on integrating ISOLDE and Clipper into the ChimeraX command line ahead of the 1.0b2 release. The following is something I'd like to get done, but I'm struggling with understanding the command-line API sufficiently to implement it. The Clipper plugin adds the ability to load crystallographic reflection data from MTZ files (and, in theory, .cif files, although the underlying library for that is half-baked to the point where I haven't actually bothered to do anything with it yet) and turn them into electron density maps. The files can hold multiple types of data, but two that are relevant to map generation:

  • pre-calculated amplitudes and phases (F/phi), which can be used to generate maps in the absence of a model; and
  • experimental amplitudes and their standard deviations (F/sigF), which cannot generate maps unless combined with an atomic model.

While the former can in theory be stand-alone, in my current implementation both types of map must be strictly associated with an atomic model, and end up bundled with it under a higher-level "manager" model.

So here's the question: given a function similar to the below, how can I add something like open xxx.mtz targetStructure #1?

    def add_xtal_data(self, filename, model=None):
        if model is None:
            model = self.selected_model
        if model is None:
            from .dialog import generic_warning
            generic_warning("You must have the corresponding model loaded "
                "before loading reflection data!")
        m = model
        from chimerax.clipper.symmetry import get_map_mgr
        map_mgr = get_map_mgr(m, create=True)
        xmapset = map_mgr.add_xmapset_from_mtz(filename, self.params.map_shannon_rate)
        if xmapset.live_xmap_mgr is not None:
            xmapset.live_update = self.iw._sim_basic_xtal_settings_live_recalc_checkbox.checkState()
            # 2mFo-DFc and mFo-DFc maps are created automatically, but should
            # not be used as MDFF potentials. For that, we need a specific map
            # that we know excludes the free reflections.
            from chimerax.clipper.maps.xmapset import map_potential_recommended_bsharp
            mdff_b = map_potential_recommended_bsharp(xmapset.resolution)
            mdff_p = xmapset.add_live_xmap('MDFF potential', b_sharp=mdff_b,
                is_difference_map=False,
                exclude_free_reflections=True,
                fill_with_fcalc = True,
                exclude_missing_reflections=True,
                display=False)
        self._change_selected_model(model=m, force=True)

Change History (2)

comment:1 by Tristan Croll, 7 years ago

Resolution: fixed
Status: assignedclosed

Never mind. All sorted out.

comment:2 by Eric Pettersen, 7 years ago

Component: UnassignedCommand Line
Note: See TracTickets for help on using tickets.