[views] Discard GenomicRegion primary view. Provide uicfg Brainomics primary view customization instead (related to #3340591)
authorVladimir Popescu <vladimir.popescu@logilab.fr>
Mon, 20 Jan 2014 13:19:49 +0000
changeset 641 1f4953c40332
parent 640 3b8b2078c21c
child 642 823f84c0a88b
[views] Discard GenomicRegion primary view. Provide uicfg Brainomics primary view customization instead (related to #3340591)
views/primary.py
views/uicfg.py
--- a/views/primary.py	Mon Jan 20 13:18:57 2014 +0000
+++ b/views/primary.py	Mon Jan 20 13:19:49 2014 +0000
@@ -314,35 +314,6 @@
 
 
 ###############################################################################
-### GENOMIC REGION ############################################################
-###############################################################################
-class GenomicRegionPrimaryView(BrainomicsPrimaryView):
-    __select__ = BrainomicsPrimaryView.__select__ & is_instance('GenomicRegion')
-
-    def render_entity_attributes(self, entity):
-        genes_rql = ('Any R WHERE R is Gene, X genes R, X eid %(e)s'
-                     % {'e': entity.eid})
-        genes_url = self._cw.build_url(rql=genes_rql)
-        fields = [
-                  (self._cw._('Start position'), entity.start),
-                  (self._cw._('Stop position'), entity.stop),
-                  (self._cw._('Width'), entity.width),
-                  (self._cw._('Cytoband start'), entity.cytoband_start),
-                  (self._cw._('Cytoband stop'), entity.cytoband_stop),
-                  (self._cw._('Chromosome'), entity.chromosome[0].view('incontext')),
-                  (self._cw._('Genes'), u'<a href="%s">%s</a>' % (genes_url, self._cw._('See all genes')))]
-        return fields
-
-    def render_entity_relations(self, entity):
-        cgh_results = self._cw.execute('Any R WHERE R is CghResult, '
-                                       'R genomic_region X, X eid %(e)s',
-                                       {'e': entity.eid})
-        if cgh_results:
-            self.w(u'<h3>%s</h3>' % self._cw._('CGH results'))
-            self.wview('region-genmeas-table-view', rset=cgh_results)
-
-
-###############################################################################
 ### SCORE GROUP ###############################################################
 ###############################################################################
 class ScoreGroupPrimaryView(BrainomicsPrimaryView):
--- a/views/uicfg.py	Mon Jan 20 13:18:57 2014 +0000
+++ b/views/uicfg.py	Mon Jan 20 13:19:49 2014 +0000
@@ -191,3 +191,16 @@
                     {'label': _('Sequencing results'),
                      'vid': 'gene-genmeas-table-view'})
 
+
+###############################################################################
+### GENOMICREGION #############################################################
+###############################################################################
+# XXX for GenomicRegion: could not:
+#     - use build_url to build custom RQL-defined URL to a set of entities
+# Genes
+_pvs.tag_subject_of(('GenomicRegion', 'genes', '*'), 'attributes')
+# CGH results
+_pvs.tag_object_of(('*', 'genomic_region', 'GenomicRegion'), 'relations')
+_pvdc.tag_object_of(('*', 'genomic_region', 'GenomicRegion'),
+                    {'label': _('CGH results'),
+                     'vid': 'region-genmeas-table-view'})