I'm still struggling to get the example_watch_folder.py to work. So any 
help much appreciated.

I've created a simple workflow, which essentially opens a text file and then 
writes out the data to a html file.

My xml file:
<tool id="CopyTool" name="Copy Tool">
  <command interpreter="perl">$__root_dir__/tools/copy/copy.pl
          --input_image "$inputImage"
          --output_html "$output"

    <param format="txt" name="inputImage" type="data" label="Input Image" />
    <data format="html" name="output" label="${tool.name} on #echo 
os.path.basename( str ( $inputImage.name ) )#" />
Copy Tool


And copy.pl:
use strict;
use warnings;
use Getopt::Long;
my $input_image ;
my $output_html ;

# Get options from command line (i.e. galaxy)
my $result = GetOptions ( "input_image=s" => \$input_image,
                          "output_html=s" => \$output_html )
                          or die "Bad options";

print "input_image is: $input_image\n";

open FILE,"$input_image" or die $!;
my @lines = <FILE>;
close FILE;
my $numOfLines = scalar @lines;

# Create the output HTML, with links to the files and the square gif.
open HTML, ">", $output_html
        or die "Failed to create output HTML file '$output_html': $! ";

print HTML<<EOF;
iframe {
        border: 0px;
        background: #eeeeee ;
<h1>Copy Files tool</h1>
<h2>Generated $numOfLines files</h2>

# Put direct links to each output file
foreach my $sub_filename ( @lines )
  print HTML "Direct link to the $sub_filename file.<br/>\n";

print HTML "<br/><br/><br/>\n";

print HTML "</body></html>\n" ;

close HTML ;

So pretty basic.

I run:
./example_watch_folder.py cce1b01926646d548f6ddc32ff01aa2e /home/galaxy/data_input 
/home/galaxy/data_output "My API Import" f2db41e1fa331b3e

and get the following output:
{'outputs': ['a799d38679e985db'], 'history': '33b43b4e7093c91f'}

I can see the sample.txt file I placed in the /home/galaxy/data_input has been 
put into the database:

shows the file has been uploaded:

    "data_type": "txt",
    "date_uploaded": "2013-05-09T04:41:10.579602",
    "file_name": "/home/galaxy/galaxy-dist/database/files/000/dataset_8.dat",
    "file_size": 76,
    "genome_build": "?",
    "id": "1cd8e2f6b131e891",
    "ldda_id": "1cd8e2f6b131e891",
    "message": "",
    "metadata_data_lines": 8,
    "metadata_dbkey": "?",
    "misc_blurb": "8 lines",
    "misc_info": "uploaded txt file",
    "model_class": "LibraryDataset",
    "name": "sam2.txt",
    "template_data": {},
    "uploaded_by": "t...@test.com",
    "uuid": null

However, looking in the histories:

The output file is zero as the input file can not be found as shown below in 
bold ...

    "accessible": true,
    "api_type": "file",
    "data_type": "html",
    "deleted": false,
    "display_apps": [],
    "display_types": [],
    "file_ext": "html",
    "file_name": "/home/galaxy/galaxy-dist/database/files/000/dataset_9.dat",
    "file_size": 0,
    "genome_build": "?",
    "hid": 1,
    "history_id": "33b43b4e7093c91f",
    "id": "a799d38679e985db",
    "metadata_data_lines": null,
    "metadata_dbkey": "?",
    "misc_blurb": "error",
    "misc_info": "Thu May  9 14:42:10 2013input_image is: None\nNo such file or 
directory at /home/galaxy/galaxy-dist/tools/copy/copy.pl line 27.\n",
    "model_class": "HistoryDatasetAssociation",
    "name": "Copy Tool on None",
    "peek": null,
    "purged": false,
    "state": "error",
    "uuid": null,
    "visible": true,
    "visualizations": []

Does anyone have any idea why the input_file is not passed in/obtained in the 
perl script?
as the script obviously copies it to the database so part of the script is 

the file sam2.txt looks like this

Thanks again, sorry for swamping the list with this issue


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:

To search Galaxy mailing lists use the unified search at:

Reply via email to