[Chimera-users] How could I know the segment label
Tom Goddard
goddard at sonic.net
Tue Sep 3 15:37:44 PDT 2019
Hi Huiya,
The Segment Map tool has an Attributes Table under the Region menu that gives some info about each segmented region, although not the average density value.
To extract the per-region values you will need to be comfortable reading other people's complex and messy Python code. The Segment Map code was written outside our lab (by Greg Pintilie) and is many thousands of lines of code. The code is in your Chimera distribution
chimera/share/Segger/*.py
or on Mac (Chimera.app/Contents/Resources/Share/Segger/*.py). You would want to look at regions.py at the Segmentation and Region classes. Here's an example accessing the region data from Python where I just typed Python into the Chimera Python shell (menu Tools / General Controls / IDLE).
>>> chimera.openModels.list()
[<VolumeViewer.volume.Volume object at 0x7fd5895dcc20>, <_molecule.Molecule object at 0x7fd58943ed78>, <Segger.regions.Segmentation object at 0x7fd58942d950>]
>>> s = chimera.openModels.list()[2]
>>> s.regions
set([<Segger.regions.Region instance at 0x7fd58c538b48>, <Segger.regions.Region instance at 0x7fd58c53b680>, <Segger.regions.Region instance at 0x7fd58c53b710>, <Segger.regions.Region instance at 0x7fd58c53b758>, <Segger.regions.Region instance at 0x7fd58c53b7a0>, <Segger.regions.Region instance at 0x7fd58c53b7e8>, <Segger.regions.Region instance at 0x7fd58c53b830>, <Segger.regions.Region instance at 0x7fd58c53b878>, <Segger.regions.Region instance at 0x7fd58c53b8c0>, <Segger.regions.Region instance at 0x7fd58c53b908>, <Segger.regions.Region instance at 0x7fd58c53b950>, <Segger.regions.Region instance at 0x7fd58c53b998>, <Segger.regions.Region instance at 0x7fd58c53b9e0>, <Segger.regions.Region instance at 0x7fd58c53ba28>, <Segger.regions.Region instance at 0x7fd58c53ba70>, <Segger.regions.Region instance at 0x7fd58c53bab8>, <Segger.regions.Region instance at 0x7fd58c53bb00>, <Segger.regions.Region instance at 0x7fd58c53bb48>, <Segger.regions.Region instance at 0x7fd58c53bb90>, <Segger.regions.Region instance at 0x7fd58c53bbd8>, <Segger.regions.Region instance at 0x7fd58c53bc20>, <Segger.regions.Region instance at 0x7fd58c53bc68>, <Segger.regions.Region instance at 0x7fd58c53bcb0>, <Segger.regions.Region instance at 0x7fd58c53bcf8>, <Segger.regions.Region instance at 0x7fd58c53bd40>, <Segger.regions.Region instance at 0x7fd58c53bd88>, <Segger.regions.Region instance at 0x7fd58c53bdd0>, <Segger.regions.Region instance at 0x7fd58c5440e0>])
>>> v = chimera.openModels.list()[0]
>>> for r in s.regions:
p = r.map_points()
vals = v.interpolated_values(p)
print ('region ', r.rid, ' average density ', vals.mean())
('region ', 572, ' average density ', 1.4155183789779682)
('region ', 573, ' average density ', 1.4989512825784412)
('region ', 574, ' average density ', 1.4972014250578705)
('region ', 575, ' average density ', 1.4125457019340701)
('region ', 576, ' average density ', 1.5008908941625652)
('region ', 577, ' average density ', 1.4134244018033972)
('region ', 578, ' average density ', 1.4970225423711425)
('region ', 579, ' average density ', 1.5016543386711971)
('region ', 580, ' average density ', 1.5008901873280978)
('region ', 581, ' average density ', 1.4134236579258075)
('region ', 582, ' average density ', 1.5004523296628476)
('region ', 583, ' average density ', 1.4154380056984164)
('region ', 584, ' average density ', 1.4950021844161183)
('region ', 585, ' average density ', 1.5016561743149943)
('region ', 586, ' average density ', 1.4153593474743413)
('region ', 587, ' average density ', 1.4154392068823032)
('region ', 588, ' average density ', 1.4101623202035325)
('region ', 589, ' average density ', 1.4101611357735748)
('region ', 590, ' average density ', 1.4110644353261694)
('region ', 591, ' average density ', 1.4967169173433399)
('region ', 592, ' average density ', 1.4972017867476852)
('region ', 593, ' average density ', 1.4930268474402093)
('region ', 594, ' average density ', 1.4155168848492963)
('region ', 595, ' average density ', 1.5004516876702199)
('region ', 596, ' average density ', 1.4125473394626524)
('region ', 597, ' average density ', 1.4153560563629748)
('region ', 598, ' average density ', 1.4989507177649652)
('region ', 571, ' average density ', 1.4110653252676943)
>>>
Tom
> On Sep 3, 2019, at 8:24 AM, Huiya Zhou <huiya at tamu.edu> wrote:
>
> Hi,
>
> I use the “Segment Map” for the volume data to divide the density map into parts. How could I know the information of each region? For example, the label, the average value of each region. I also would like to know the regions which are connected with one specific region. How could I obtain information in python script?
>
> Thanks,
> Huiya
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>
More information about the Chimera-users
mailing list