Hi Eli,

That could easily be accomplished without changing the code, by writing a simple tool.

The xml-file:

<tool id="importer" name="Import" version="0.0.1" hidden="false">
<description>Import files</description>
<parallelism method="basic"></parallelism>
<command interpreter="python">
    importer.py
    -$link "$infile" "$outfile"
</command>
<inputs>
<param type="text" name="infile" size="180" label="Enter path to file to upload" /> <param name="link" type="boolean" truevalue="--link" checked="false" falsevalue="" label="Link to file" help="Should the file be linked instead of copied into Galaxy?" />
</inputs>
<outputs>
<data format="data" name="outfile" label="Imported file" />
</outputs>
<help>

**What it does**

This tool is a simple file importer

------

The path string points to a local file, that should be imported into the current history.

</help>
</tool>


And the Python script:

#!/usr/bin/python

import argparse, os
version = '0.0.1'
progName='importer'


def __main__():
  parser = argparse.ArgumentParser(
    prog=progName,
    description='Simple Galaxy file importer')

  parser.add_argument('--version', action='version',
    version='%(prog)s '+version,
    help='Display version information')

  parser.add_argument('infile', nargs=1,
    type=str,
    help='input filename mask')

  parser.add_argument('savefile', nargs=1,
    type=str,
    help='savefile filename')

  parser.add_argument('-l','--link',
    action='store_true',
    default=False,
    help='Make symbolic link to file')


  try:
    args = parser.parse_args()

    if args.link:
      os.system('ln -fs %s %s' % (args.infile[0],args.savefile[0]))
    else:
      os.system('cp %s %s' % (args.infile[0],args.savefile[0]))


  except Exception as E:
    print >> sys.stderr, E
    exit(1)
    pass

if __name__=="__main__": __main__()


I have written a handful of Galaxy tools that implements this technique, and it works like a charm. However this specific example is copy and pasted and simplified from one of my existing tools, so I haven't actually tried it, so It might contain a few spelling mistooks.

With a minimum of coding, the opposite can also be implemented, namely exporting files from galaxy to an external local file.

Kind regards

Frank Sorensen

Den 16-04-2012 08:13, Eli Reuveni skrev:

Hi,

I have a local galaxy instance in my institute and have few basic questions:

1)I need to enable galaxy to upload large files from the local galaxy server without the need to use the ftp or the file upload module, is there an easy way to do it or do I need to write a special code?

2)I need to customize galaxy Python code (i.e., under the ~/galaxy-dist/lib directory). Where can I find documentation of the galaxy Python classes (using wiki or other format)

Thanks in advanced,


--
Frank Sørensen, B.Sc., Programmer
Molecular Diagnostic Laboratory (MDL)
Molekylær Medicinsk Afdeling (MOMA)
Århus Universitetshospital Skejby, Brendstrupgårdsvej, 8200 Århus N
Tlf. +45 7845 5363
___________________________________________________________
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