Helo Jelle,

I've taken a look at your patches and the code looks good.  

However, I'm wondering why you find it necessary to upload image files to 
Galaxy.  Do tools exist that take image files as input?  If the Galaxy 
community finds this feature as a good addition to Galaxy, we can probably 
incorporate it into the distribution.  However, we'll need an additional 
feature before we can do that.  We'll need to implement a type of config 
setting that enables / disables the uploading of image files via the Galaxy 
api.  This can either be an enhancement to the existing "display_in_upload" 
config setting, or a separate "allow_api_upload" config setting (probably the 
latter for clarity).  

I haven't looked too far into what it will take to do this, but if your reasons 
for needing this feature are beneficial to the community, I can spend some time 
on it - or if you want to take a pass at it, feel free!

Thanks very much for your contributions!

Greg Von Kuster


On Jul 25, 2011, at 11:23 AM, Jelle Scholtalbers wrote:

> Hi Greg,
> 
> this was indeed causing the problem. I added some code which now allows to 
> sniff image files. It is practically untested (it does work for me on bmp, 
> jpg, png, tiff) - didn't try with PIL although the code is there.
> Attached are diffs against changeset 058a5d7a4f84 (bit outdated - can provide 
> newer if desired..).
> 
> Sniffed formats:
> http://infohost.nmt.edu/tcc/help/pubs/pil/formats.html or 
> http://docs.python.org/library/imghdr.html depending if PIL is available or 
> not.
> 
> Cheers,
> Jelle
> 
> On Fri, Jul 22, 2011 at 6:46 PM, Greg Von Kuster <g...@bx.psu.edu> wrote:
> Based on the error message you gave, I assume the following code in 
> ~/lib/galaxy/datatypes/sniff.py is presenting the problem.
> 
>     if check_binary( filename ):
>         if ext not in unsniffable_binary_formats and not 
> datatypes_registry.get_datatype_by_extension( ext ).sniff( filename ):
>             raise InappropriateDatasetContentError, 'The binary uploaded file 
> contains inappropriate content.'
> 
> Have you tried adding your 'jpg' extension to the following in 
> ~/lib/galaxy/datatypes/binary.py?
> 
> # Currently these supported binary data types must be manually set on upload
> unsniffable_binary_formats = [ 'ab1', 'scf' ]
> 
> 
> On Jul 22, 2011, at 11:52 AM, Jelle Scholtalbers wrote:
> 
>> Hi Greg,
>> 
>> I used that link when trying to create the support. The jpg datatype was 
>> already present in the datatypes_conf.xml (
>> 
>> <datatype extension="jpg" type="galaxy.datatypes.images:Image" 
>> mimetype="image/jpeg"/> )
>> , so I first made it available at upload -> display_in_upload=True. As far 
>> as I understood, if galaxy doesn't have to guess what the format is, this 
>> would be sufficient? From step2:
>> 
>> "Galaxy tools are configured to automatically set the data type of an output 
>> dataset. However, in some scenarios, Galaxy will attempt to determine the 
>> data type of a file using a sniffer"
>> 
>> However manually setting the format on upload still gave the mentioned 
>> error. Therefore I followed the rest of the guide (adding a sniffer) but 
>> still seem to fail here..
>> 
>> Cheers,
>> Jelle
>> 
>> 
>> 
>> On Jul 22, 2011 3:26 PM, "Greg Von Kuster" <g...@bx.psu.edu> wrote:
>> > Hello Jelle,
>> > 
>> > There are a few things you need to do to add support for a new data type. 
>> > The steps are described here:
>> > 
>> > http://wiki.g2.bx.psu.edu/Admin/Datatypes/Adding%20Datatypes
>> > 
>> > Greg Von Kuster
>> > 
>> > On Jul 22, 2011, at 8:49 AM, Jelle Scholtalbers wrote:
>> > 
>> >> Hi all,
>> >> 
>> >> I would like to be able to upload images to my Galaxy instance - in 
>> >> particular jpg/png to data libraries. I can't however find out how to 
>> >> overcome the problem of inappropriate content in binary file.
>> >> How to go about? 
>> >> 
>> >> When I create a sniffer class in the galaxy.datatypes.images.py that 
>> >> always returns true (for testing purposes) I still don't get the jpg 
>> >> uploaded without an error (sniffer is incl. in the datatypes_conf.xml ). 
>> >> class Jpg( Image ):
>> >> file_ext = "jpg"
>> >> def sniff(self, filename):
>> >> """Determine if the file is in jpg format.
>> >> """
>> >> return True
>> >> 
>> >> It seems I'm missing something obvious and could use some help.
>> >> 
>> >> Cheers,
>> >> Jelle
>> >> ___________________________________________________________
>> >> Please keep all replies on the list by using "reply all"
>> >> in your mail client. To manage your subscriptions to this
>> >> and other Galaxy lists, please use the interface at:
>> >> 
>> >> http://lists.bx.psu.edu/
>> > 
>> > Greg Von Kuster
>> > Galaxy Development Team
>> > g...@bx.psu.edu
>> > 
>> > 
>> > 
> 
> Greg Von Kuster
> Galaxy Development Team
> g...@bx.psu.edu
> 
> 
> 
> 
> <datatypes_conf.xml.diff><images.py.diff><upload.py.diff>

Greg Von Kuster
Galaxy Development Team
g...@bx.psu.edu



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/

Reply via email to