This is my code for running a samtools command internally, via Galaxy:

open INP,"< $ARGV[0]"
        or die "Cannot open file: $!";

$file = "$ARGV[1]";

open OUT, "> $file"
        or die "Cannot open file: $!";

@out = `/home/applications/samtools-0.1.7a/samtools view -bS $ARGV[0] 2>&1`;

print OUT @out;

close INP;
close OUT;

The 2>&1 is used to redirect the STDERR to STDOUT. When I run this in the
console, it gives a non-empty file. But when run it in Galaxy, Galaxy can
no longer find the path. This error message is given to me.

Traceback (most recent call last):
  File "/home/applications/galaxy-dist/lib/galaxy/jobs/runners/local.py",
line 126, in run_job
    job_wrapper.finish( stdout, stderr )
  File "/home/applications/galaxy-dist/lib/galaxy/jobs/__init__.py", line
618, in finish
    dataset.set_meta( overwrite = False )
  File "/home/applications/galaxy-dist/lib/galaxy/model/__init__.py", line
874, in set_meta
    return self.datatype.set_meta( self, **kwd )
  File "/home/applications/galaxy-dist/lib/galaxy/datatypes/binary.py",
line 179, in set_meta
    raise Exception, "Error Setting BAM Metadata: %s" % stderr
Exception: Error Setting BAM Metadata: /bin/sh: samtools: command not found

The weird thing is, when I remove the 2>&1 from the code and run it again
in Galaxy, I am able to get this diagnostic message:

[samopen] SAM header is present: 66338 sequences.

This is the reason why I added the 2>&1 in the first place, so that this
diagnostic message would be 'ignored' (since it is detected as an error).

Now, if the other code (the one without 2>&1) is able to produce the
aforementioned diagnostic message, then I assume that it is able to at
least execute the samtools command internally. But when I add the 2>&1,
galaxy can no longer find the command. Do I need to specify a path
somewhere in the galaxy-dist?

I apologize for the very long message.

Thanks in advance,

CL
___________________________________________________________
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