Re: [Soaplab-users] Output files based on input argument
Brought to you by:
marsenger
From: Martin S. <mar...@gm...> - 2010-08-04 11:34:32
|
I am sorry for a BIG delay in my reply. Somehow I forgot about this email... In case you still do not have an answer... I try to define output section for one of my tool but I cannot find the > right way: > > The tool takes a mandatory argument and returns three different files > with names starting by the mandatory argument. > e.g.: input ./tool --pdb=2SRC > outputs 2SRC.out, 2SRC.gff, 2SRC.bed > > > How to properly code this in ACD format ? > Soaplab does not allow users to specify names of the output files (the reasons are mostly because of the distributed character of web services where the concept of "files" is blurred; but also some legacy reasons). Therefore, if an application has to have a fixed names (either hard-coded names or names based on other parameters, as it is in your example) one must wrap the application into a wrapper script. The acd file specifies this wrapper as an executable. The wrapper maps the fixed names into the names generated by Soaplab. The wrapper knows what names were generated by Soaplab because it gets the full command line created by Soaplab. Here is an example - for the "cap3" program ( http://pbil.univ-lyon1.fr/cap3.php). The "cap3" program uses the name of its input file as a prefix for several output file names. [In your example, the prefix would be taken from the parameter "-pdb" and not from the input file name.] The wrapper for cap3 program could use this command-line: cap3_wrapper -I seq -q seq.qual -C seq.con -A seq.cap.ace -G seq.cap.contigs -Q seq.cap.contigs.qual -L seq.cap.contigs.links -F seq.cap.info -S seq.cap.singlets -R seq.con.cap.results Where "-I" indicates the input file, and -A, -G, -Q, -L, -F, -S, and -R are all possible output files. The ACD file will reflect this command-line. For example, the first two outputs will be specified as: ... outfile: ace [ additional: "Y" qualifier: "A" ] outfile: contigs [ additional: "Y" qualifier: "G" ] ... The wrapper itself (a Perl script) is attached (and included also below). Cheers, Martin #!/usr/bin/perl -w # # Martin Senger <mar...@gm...> # --------------------------------------- use strict; use Getopt::Std; use vars qw/ $opt_H $opt_I $opt_q $opt_C $opt_A $opt_G $opt_Q $opt_L $opt_F $opt_S $opt_R /; $Getopt::Std::STANDARD_HELP_VERSION = 'true'; getopts ('HI:q:C:A:G:Q:L:F:S:R:'); sub HELP_MESSAGE() { print STDOUT <<'END_OF_USAGE'; cap3 seq [cap3-options] other (optional) inputs: seq.qual seq.con outputs: standard output seq.cap.ace seq.cap.contigs seq.cap.contigs.qual seq.cap.contigs.links seq.cap.info seq.cap.singlets seq.con.cap.results cap3_wrapper -I seq -q seq.qual -C seq.con -A seq.cap.ace -G seq.cap.contigs -Q seq.cap.contigs.qual -L seq.cap.contigs.links -F seq.cap.info -S seq.cap.singlets -R seq.con.cap.results Other: -H ... help END_OF_USAGE exit (0); } HELP_MESSAGE() if $opt_H; # ----------------------------------------------------------- # -- change the input arguments die "Required input file (option -I) is missing\n" unless defined $opt_I; #my @cmdline = ('/home/senger/Software/CAP3/cap3', $opt_I); my @cmdline = ('cap3', $opt_I); push (@cmdline, @ARGV); my $inp_qual = $opt_I . '.qual'; `cp $opt_q $inp_qual` if defined $opt_q && -e $opt_q; my $inp_con = $opt_I . '.con'; `cp $opt_C $inp_con` if defined $opt_C && -e $opt_C; # -- call the real cap3 system (@cmdline) == 0 or die "Calling cap3 with the command line [" . join (" ", @cmdline) . "] failed: $?\n"; # -- rename cap3's outputs my $out_ace = $opt_I . '.cap.ace'; `mv $out_ace $opt_A` if -e $out_ace && defined $opt_A; my $out_contigs = $opt_I . '.cap.contigs'; `mv $out_contigs $opt_G` if -e $out_contigs && defined $opt_G; my $out_qual = $opt_I . '.cap.contigs.qual'; `mv $out_qual $opt_Q` if -e $out_qual && defined $opt_Q; my $out_links = $opt_I . '.cap.contigs.links'; `mv $out_links $opt_L` if -e $out_links && defined $opt_L; my $out_info = $opt_I . '.cap.info'; `mv $out_info $opt_F` if -e $out_info && defined $opt_F; my $out_singlets = $opt_I . '.cap.singlets'; `mv $out_singlets $opt_S` if -e $out_singlets && defined $opt_S; my $out_results = $opt_I . '.con.cap.results'; `mv $out_results $opt_R` if -e $out_results && defined $opt_R; -- Martin Senger email: mar...@gm...,mar...@ka... skype: martinsenger |