[views] Discard GenomicMeasure primary view. Provide uicfg Brainomics primary view customization instead (related to #3340591)
authorVladimir Popescu <vladimir.popescu@logilab.fr>
Mon, 20 Jan 2014 13:04:36 +0000
changeset 639 f7bc10589e3e
parent 638 897cfbb20efa
child 640 3b8b2078c21c
[views] Discard GenomicMeasure primary view. Provide uicfg Brainomics primary view customization instead (related to #3340591)
views/primary.py
views/uicfg.py
--- a/views/primary.py	Wed Dec 11 17:07:10 2013 +0100
+++ b/views/primary.py	Mon Jan 20 13:04:36 2014 +0000
@@ -314,46 +314,6 @@
 
 
 ###############################################################################
-### GENOMIC MEASURE ###########################################################
-###############################################################################
-class GenomicMeasurePrimaryView(BrainomicsPrimaryView):
-    __select__ = BrainomicsPrimaryView.__select__ & is_instance('GenomicMeasure')
-
-    def render_entity_attributes(self, entity):
-        subject = entity.concerns[0]
-        subject = u'<a href="%s">%s</a>' % (subject.absolute_url(), subject.dc_title())
-        fields = [(self._cw._('Type'), entity.type),
-                  (self._cw._('Format'), entity.format),
-                  (self._cw._('File path'), entity.filepath),
-                  (self._cw._('Chip S/N'), entity.formatted_chip_serialnum),
-                  (self._cw._('Subject'), subject),
-                  (self._cw._('Study'), entity.related_study[0].view('outofcontext'))]
-        if entity.platform:
-            fields.append((self._cw._('Platform'), entity.platform[0].view('outofcontext')))
-        return fields
-
-    def render_entity_relations(self, entity):
-        self.w(entity.view('results-view'))
-        cgh_results = self._cw.execute('Any R WHERE R is CghResult, '
-                                       'R related_measure X, X eid %(e)s',
-                                       {'e': entity.eid})
-        mutation_results = self._cw.execute('Any R WHERE R is Mutation, '
-                                            'R related_measure X, X eid %(e)s',
-                                            {'e': entity.eid})
-        if cgh_results or mutation_results:
-            if cgh_results:
-                # Add image
-                image = [e for e in entity.results_file if e.data_format.startswith('image')]
-                if image:
-                    self.w(u'<img src="%s"/>' % image[0].download_url())
-                self.w(u'<h3>%s</h3>' % self._cw._('CGH results'))
-                self.wview('cgh-table-view', rset=cgh_results)
-            if mutation_results:
-                self.w(u'<h3>%s</h3>' % self._cw._('Sequencing results'))
-                self.wview('mutation-table-view', rset=mutation_results)
-
-
-###############################################################################
 ### GENE ######################################################################
 ###############################################################################
 class GenePrimaryView(BrainomicsPrimaryView):
@@ -376,10 +336,10 @@
         if cgh_results or mutation_results:
             if cgh_results:
                 self.w(u'<h3>%s</h3>' % self._cw._('CGH results'))
-                self.wview('gene-cgh-table-view', rset=cgh_results)
+                self.wview('gene-genmeas-table-view', rset=cgh_results)
             if mutation_results:
                 self.w(u'<h3>%s</h3>' % self._cw._('Sequencing results'))
-                self.wview('gene-mutation-table-view', rset=mutation_results)
+                self.wview('gene-genmeas-table-view', rset=mutation_results)
 
 
 ###############################################################################
@@ -408,7 +368,7 @@
                                        {'e': entity.eid})
         if cgh_results:
             self.w(u'<h3>%s</h3>' % self._cw._('CGH results'))
-            self.wview('region-cgh-table-view', rset=cgh_results)
+            self.wview('region-genmeas-table-view', rset=cgh_results)
 
 
 ###############################################################################
--- a/views/uicfg.py	Wed Dec 11 17:07:10 2013 +0100
+++ b/views/uicfg.py	Mon Jan 20 13:04:36 2014 +0000
@@ -159,3 +159,16 @@
 _pvs.tag_subject_of(('ExternalResource', 'related_study', '*'), 'attributes')
 _pvdc.tag_subject_of(('ExternalResource', 'related_study', '*'),
                      {'vid': 'incontext', 'label': _('Study')})
+
+
+###############################################################################
+### GENOMICMEASURE ############################################################
+###############################################################################
+_pvs.tag_subject_of(('GenomicMeasure', 'concerns', 'Subject'), 'attributes')
+_pvs.tag_subject_of(('GenomicMeasure', 'related_study', 'Study'), 'attributes')
+_pvs.tag_subject_of(('GenomicMeasure', 'platform', '*'), 'attributes')
+_pvs.tag_object_of(('*', 'related_measure', 'GenomicMeasure'), 'relations')
+_pvdc.tag_object_of(('*', 'related_measure', 'GenomicMeasure'),
+                    {'label': _('Results'), 'vid': 'genmeas-table-view'})
+
+