1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/df2a99433e85/ Changeset: df2a99433e85 User: carlfeberhard Date: 2014-08-28 15:44:56 Summary: Vis registry: add two tests (has_attribute, not_eq); add see also for test types in visualization.dtd; correct applicability tests for trackster and circster using not_eq on datatype.track_type Affected #: 4 files
diff -r f36c6fc80e8cd2bc6a5c6f77f0806aa7271e65f0 -r df2a99433e850b7ba594994fece91fdc87c24181 config/plugins/visualizations/circster/config/circster.xml --- a/config/plugins/visualizations/circster/config/circster.xml +++ b/config/plugins/visualizations/circster/config/circster.xml @@ -4,13 +4,13 @@ <data_sources><data_source><model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <test type="not_eq" test_attr="datatype.track_type">None</test><to_param param_attr="id">dataset_id</to_param><to_param assign="hda">hda_ldda</to_param></data_source><data_source><model_class>LibraryDatasetDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <test type="not_eq" test_attr="datatype.track_type">None</test><to_param param_attr="id">dataset_id</to_param><to_param assign="ldda">hda_ldda</to_param></data_source>
diff -r f36c6fc80e8cd2bc6a5c6f77f0806aa7271e65f0 -r df2a99433e850b7ba594994fece91fdc87c24181 config/plugins/visualizations/trackster/config/trackster.xml --- a/config/plugins/visualizations/trackster/config/trackster.xml +++ b/config/plugins/visualizations/trackster/config/trackster.xml @@ -5,14 +5,14 @@ <data_sources><data_source><model_class>HistoryDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <test type="not_eq" test_attr="datatype.track_type">None</test><to_param param_attr="id">dataset_id</to_param><to_param assign="hda">hda_ldda</to_param><to_param param_attr="dbkey">dbkey</to_param></data_source><data_source><model_class>LibraryDatasetDatasetAssociation</model_class> - <test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test> + <test type="not_eq" test_attr="datatype.track_type">None</test><to_param param_attr="id">dataset_id</to_param><to_param assign="ldda">hda_ldda</to_param></data_source>
diff -r f36c6fc80e8cd2bc6a5c6f77f0806aa7271e65f0 -r df2a99433e850b7ba594994fece91fdc87c24181 config/plugins/visualizations/visualization.dtd --- a/config/plugins/visualizations/visualization.dtd +++ b/config/plugins/visualizations/visualization.dtd @@ -33,7 +33,8 @@ Currently, all tests are OR'd and there is no logical grouping. Tests are run in order. (text): the text of this element is what the given target will be compared to (REQUIRED) type: what type of test to run (e.g. when the target is an HDA the test will often be of type 'isinstance' - and test whether the HDA's datatype isinstace of a class) + and test whether the HDA's datatype isinstace of a class). + See lib/galaxy/visualizations/registry.py, DataSourceParser.parse_tests for test type options. DEFAULT: string comparison. test_attr: what attribute of the target object should be used in the test. For instance, 'datatype' will attempt to get the HDA.datatype from a target HDA. If the given object doesn't have
diff -r f36c6fc80e8cd2bc6a5c6f77f0806aa7271e65f0 -r df2a99433e850b7ba594994fece91fdc87c24181 lib/galaxy/visualization/registry.py --- a/lib/galaxy/visualization/registry.py +++ b/lib/galaxy/visualization/registry.py @@ -203,6 +203,7 @@ #log.debug( '\t passed model_class' )
# tests are optional - default is the above class test +#TODO: not true: must have test currently tests = data_source[ 'tests' ] if tests and not self.is_object_applicable( trans, target_object, tests ): continue @@ -228,14 +229,14 @@ Run a visualization's data_source tests to find out if it can be applied to the target_object. """ - #log.debug( 'is_object_applicable( self, trans, %s, %s )', target_object, data_source_tests ) + log.debug( 'is_object_applicable( self, trans, %s, %s )', target_object, data_source_tests ) for test in data_source_tests: test_type = test[ 'type' ] result_type = test[ 'result_type' ] test_result = test[ 'result' ] test_fn = test[ 'fn' ] - #log.debug( '%s %s: %s, %s, %s, %s', str( target_object ), 'is_object_applicable', - # test_type, result_type, test_result, test_fn ) + log.debug( '%s %s: %s, %s, %s, %s', str( target_object ), 'is_object_applicable', + test_type, result_type, test_result, test_fn )
if test_type == 'isinstance': # parse test_result based on result_type (curr: only datatype has to do this) @@ -253,7 +254,7 @@
#NOTE: tests are OR'd, if any test passes - the visualization can be applied if test_fn( target_object, test_result ): - #log.debug( '\t test passed' ) + log.debug( '\t test passed' ) return True
return False @@ -407,6 +408,7 @@
# allow manually turning off a vis by checking for a disabled property if 'disabled' in xml_tree.attrib: +#TODO: differentiate between disabled and failed to parse, log.warn only on failure, log.info otherwise return None
# a text display name for end user links @@ -627,6 +629,13 @@ test_fn = lambda o, result: ( hasattr( getter( o ), 'has_dataprovider' ) and getter( o ).has_dataprovider( result ) )
+ elif test_type == 'has_attribute': + # does the object itself have attr in 'result' (no equivalence checking) + test_fn = lambda o, result: hasattr( getter( o ), result ) + + elif test_type == 'not_eq': + test_fn = lambda o, result: str( getter( o ) ) != result + else: # default to simple (string) equilavance (coercing the test_attr to a string) test_fn = lambda o, result: str( getter( o ) ) == result
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.