Getting the input name of the dataset
Hi there, I am new to Galaxy and I've just recently learned how to integrate a Perl script to it. Now, my code uses the input file's name as a header for a column in the output. When I ran it in Galaxy, I did get the filename, but it's the one ending in .dat (actually, I got the entire path of the file). I was wondering if it's possible to retain the original name of the file (or retrieve the name of the input dataset) and use it in the output file. I can't think of a Perl script for this yet, for my scripting's a bit rusty (I just started learning Perl last month). I've already checked the FAQs page, the wiki and the mailing list, but I did not get any useful hints. I hope my writing made sense. Thank you for your time! - Diana
You can use $input.name to get the name you see in the history. Unfortunately, that usually is something silly like "Samtools on data 3".... I have changed all the labels for all the major file that are produced to provide more sensible names, usually based on the input... An example below is how I use the original name of the BAM file when I convert it into a SAM file but just taking the prefix of the input1 and adding ".sam" at the end. I am using the special parsing language that Galaxy is using to split the extension from the file name using the os.path.splitext function... Untill Galaxy comes up with a better way to maintain the original file names somehow, this is your best shot... Thon <inputs> <param name="input1" type="data" format="bam" label="BAM File to Convert" /> <param name="header" type="boolean" truevalue="--header" falsevalue="" checked="False" label="Include header in output" /> </inputs> <outputs> <data format="sam" name="output1" label="#echo os.path.splitext ( str ( $input1.name ) ) [ 0 ] #.sam" /> </outputs> On Mar 19, 2012, at 08:00 PM, diana michelle magbanua <dmdrmagbanua@gmail.com> wrote:
Hi there,
I am new to Galaxy and I've just recently learned how to integrate a Perl script to it. Now, my code uses the input file's name as a header for a column in the output. When I ran it in Galaxy, I did get the filename, but it's the one ending in .dat (actually, I got the entire path of the file). I was wondering if it's possible to retain the original name of the file (or retrieve the name of the input dataset) and use it in the output file. I can't think of a Perl script for this yet, for my scripting's a bit rusty (I just started learning Perl last month). I've already checked the FAQs page, the wiki and the mailing list, but I did not get any useful hints.
I hope my writing made sense. Thank you for your time!
- Diana ___________________________________________________________ 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:
participants (2)
-
diana michelle magbanua
-
thondeboer@me.com