Dear all,

We have a modified Galaxy server with tools for virtual screening. You can access is at http://lisis.cs.ucy.ac.cy.

We created a composite datatype (auto_primary_file) to handle PDBQT files for proteins and their config file requested by AutoDock Vina, in simple words is a composite datatype consisted of two files, a pdbqt file and a text file.

We have the following problems:
  1. Uploading the files needed to create such a composite datatype via the Upload Tool, stacks in upload phase, as shown in the following figure http://prntscr.com/xbosn
    1. As you can see in the figure, uploading individual files works
    2. In this figure http://prntscr.com/xbp6k you can see the upload options for this composite datatype.
  2. Uploading composite datatypes within a data library does not provide the same functionality as the Upload Tool.
Regarding problem 1 what do you think is the underlying problem?

Following is the source code of this composite datatype class:

class PDBQT_Protein(Html):
    """PDBQT Protein files, ASCII protein information files."""
    MetadataElement(name = "base_name", desc = "Base name for all transformed versions of this PDBQT protein dataset", default = 'protein',
    readonly = False, set_in_upload = True)

    composite_type = 'auto_primary_file'
    allow_datatype_change = False
    file_ext = 'pdbqt_protein'

    def __init__(self, **kwd):
        Text.__init__(self, **kwd)
        self.add_composite_file('%s.pdbqt', description = 'PDBQT Protein File', substitute_name_with_metadata = 'base_name', mimetype = 'text/plain', is_binary = False)
        self.add_composite_file('%s_config.txt', description = 'PDBQT Config File', substitute_name_with_metadata = 'base_name', mimetype = 'text/plain', is_binary = False)

    def generate_primary_file(self, dataset = None):
        if dataset.metadata.base_name == "protein" and \
           dataset.metadata.base_name != dataset.name:
            dataset.metadata.base_name = dataset.name
        rval = ['<html><head><title>PDBQT Protein Galaxy/LiSIs Composite Dataset</title></head>']
        rval.append('<body><div>This %s composite dataset is composed of the following files:<ul>' % (dataset.metadata.base_name))
        for composite_name, composite_file in self.get_composite_files(dataset = dataset).iteritems():
            fn = composite_name
            opt_text = ''
            if composite_file.optional:
                opt_text = ' (optional)'
            if composite_file.get('description'):
                rval.append('<li><a href="%s">%s (%s)</a>%s</li>' % (fn, fn, composite_file.get('description'), opt_text))
            else:
                rval.append('<li><a href="%s">%s</a>%s</li>' % (fn, fn, opt_text))
        rval.append('</ul></div></body></html>')
        return "\n".join(rval)

    def regenerate_primary_file(self, dataset):
        """
        cannot do this until we are setting metadata
        """
        bn = dataset.metadata.base_name
        efp = dataset.extra_files_path
        flist = os.listdir(efp)
        rval = ['<html><head><title>PDBQT Protein Galaxy/LiSIs Composite Dataset</title></head>']
        rval.append('<body><div>This %s composite dataset is composed of the following files:<ul>' % (bn))
        for i, fname in enumerate(flist):
            sfname = os.path.split(fname)[-1]
            rval.append('<li><a href="%s">%s</a></li>' % (sfname, sfname))
        rval.append('</ul></div></body></html>')
        f = file(dataset.file_name, 'w')
        f.write("\n".join(rval))
        f.write('\n')
        f.close()

    def set_meta(self, dataset, **kwd):
        """
        Set metadata...
        """
        Text.set_meta(self, dataset, **kwd)
        if dataset.metadata.base_name == "protein" and \
           dataset.metadata.base_name != dataset.name:
            dataset.metadata.base_name = dataset.name
            log.debug('@@@ PDBQT_Protein set_meta changed dataset.metadata.base_name to: %s' % (dataset.metadata.base_name))
        if kwd.get('overwrite') == False:
            log.debug('@@@ PDBQT_Protein set_meta called with overwrite = False')
            return True
        try:
            efp = dataset.extra_files_path
        except:
            log.debug('@@@ PDBQT_Protein set_meta failed %s - dataset %s has no extra_files_path ?' % (sys.exc_info()[0], dataset.name))
            return False
        try:
            flist = os.listdir(efp)
        except:
            log.debug('@@@ PDBQT_Protein set_meta failed %s - dataset %s has no extra_files_path ?' % (sys.exc_info()[0], dataset.name))
            return False
        if len(flist) == 0:
            log.debug('@@@ PDBQT_Protein set_meta failed - %s extra_files_path %s is empty?' % (dataset.name, efp))
            return False
        self.regenerate_primary_file(dataset)
        if not dataset.info:
            dataset.info = 'Galaxy/LiSIs %s PDBQT Protein datatype object' % (dataset.metadata.base_name)
        if not dataset.blurb:
            dataset.blurb = 'Composite file - %s PDBQT Protein Galaxy/LiSIs datatype' % (dataset.metadata.base_name)
        return True


Thanks in advance,
Christos

--

Christos Kannas
Researcher
Ph.D Student 

e-Health Laboratory
kannas.christos@ucy.ac.cy
kannas.christos@cs.ucy.ac.cy
chriskannas@gmail.com 

Mob: (+357) 99530608