commit/galaxy-central: 3 new changesets
3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/94105d1ea20c/ Changeset: 94105d1ea20c User: jmchilton Date: 2014-08-12 18:26:20 Summary: Allow cheetah tool templates to reason polymorphically about datatypes. Adds a $input.is_of_type( 'ext' ) method to dataset wrappers. Peter brought this issue up on galaxy-dev here http://dev.list.galaxyproject.org/Determining-datatype-inheritance-in-tool-X.... There are some hacks if you are willing to import the datatype or use $__app__ but both of these are exposing details and frankly internals of Galaxy that we should not want to expose to tools or tool authors. Bad ways and new good way: #import galaxy.datatypes.sequence ; echo "${isinstance($input1.datatype, galaxy.datatypes.sequence.Fastq )}" ; echo "$input1.datatype.matches_any([galaxy.datatypes.sequence.Fastq])" ; echo "$input1.datatype.matches_any([ $__app__.datatypes_registry.get_datatype_by_extension( 'fastq' )])" ; echo "$input1.is_of_type( 'fastq' )" Affected #: 1 file diff -r f926988f8e0a480c09d3462002f482b5ac806682 -r 94105d1ea20c2cc9a5e5643db191178260a770cb lib/galaxy/tools/wrappers.py --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -194,6 +194,7 @@ else: self.dataset = dataset self.metadata = self.MetadataWrapper( dataset.metadata ) + self.datatypes_registry = datatypes_registry self.false_path = getattr( dataset_path, "false_path", None ) self.false_extra_files_path = getattr( dataset_path, "false_extra_files_path", None ) @@ -201,6 +202,10 @@ def is_collection( self ): return False + def is_of_type( self, ext ): + datatype = self.datatypes_registry.get_datatype_by_extension( ext ) + return self.dataset.datatype.matches_any( [ datatype ] ) + def __str__( self ): if self.false_path is not None: return self.false_path https://bitbucket.org/galaxy/galaxy-central/commits/1b28e2bd5bad/ Changeset: 1b28e2bd5bad User: jmchilton Date: 2014-08-12 19:08:11 Summary: Extend dataset_wrapper.is_of_type to allow multiple arguments. Affected #: 1 file diff -r 94105d1ea20c2cc9a5e5643db191178260a770cb -r 1b28e2bd5badd94c9e94053d1a80f98b4eb6a4e6 lib/galaxy/tools/wrappers.py --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -202,9 +202,9 @@ def is_collection( self ): return False - def is_of_type( self, ext ): - datatype = self.datatypes_registry.get_datatype_by_extension( ext ) - return self.dataset.datatype.matches_any( [ datatype ] ) + def is_of_type( self, *exts ): + datatypes = [ self.datatypes_registry.get_datatype_by_extension( e ) for e in exts ] + return self.dataset.datatype.matches_any( datatypes ) def __str__( self ): if self.false_path is not None: https://bitbucket.org/galaxy/galaxy-central/commits/08e25f0ffc06/ Changeset: 08e25f0ffc06 User: jmchilton Date: 2014-08-14 03:53:30 Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #457) Allow cheetah tool templates to reason polymorphically about datatypes. Affected #: 1 file diff -r be407987417297cb1543864e8448d49bb93851ab -r 08e25f0ffc06543bd76efbe7bca8a329bb1858cb lib/galaxy/tools/wrappers.py --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -194,6 +194,7 @@ else: self.dataset = dataset self.metadata = self.MetadataWrapper( dataset.metadata ) + self.datatypes_registry = datatypes_registry self.false_path = getattr( dataset_path, "false_path", None ) self.false_extra_files_path = getattr( dataset_path, "false_extra_files_path", None ) @@ -201,6 +202,10 @@ def is_collection( self ): return False + def is_of_type( self, *exts ): + datatypes = [ self.datatypes_registry.get_datatype_by_extension( e ) for e in exts ] + return self.dataset.datatype.matches_any( datatypes ) + def __str__( self ): if self.false_path is not None: return self.false_path 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.
participants (1)
-
commits-noreply@bitbucket.org