Mercurial > repos > marpiech > norwich_docking_tools
diff galaxy-tools/tools/rdock/bin/sdmodify @ 2:0faa03a92843 draft default tip
Uploaded
author | dzesikah |
---|---|
date | Fri, 26 Aug 2016 10:19:49 -0400 |
parents | ad4bc82457e5 |
children |
line wrap: on
line diff
--- a/galaxy-tools/tools/rdock/bin/sdmodify Fri Aug 26 09:55:15 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -#!/usr/bin/perl -# Script to set the first title line equal to a given data field -# -# Usage: sdmodify -f<DataField> [sdFiles] -# -# If sdFiles not given, reads from standard input -# Output is to standard output - -use lib "$ENV{'RBT_ROOT'}/lib"; - -use SDRecord; - -my $SDMODKEY = "ID"; - -#Print help if no command line arguments -printHelpAndExit() if (scalar(@ARGV) == 0); - -#Parse command line arguments -my @files; -while (scalar(@ARGV)) { - my $arg = shift @ARGV; - printHelpAndExit() if ($arg eq '-h'); - if (index($arg,'-f')==0) { - $SDMODKEY = substr($arg,2);#modification key - } - else { - push @files,$arg;#must be a filename - } -} -push @ARGV,@files;#put the filenames back in the arg list - -#read records -my $sdRec = new SDRecord; -my $nRec=0; -while ($sdRec->readRec('DATA'=>1,'LINES'=>1)) { - $sdRec->addData('_REC' => ++$nRec);#add record# as temp data field - #set the first line equal to the given data field - my $nLines = scalar (@{$sdRec->{'LINES'}}); - if ($nLines > 0) { - ${$sdRec->{'LINES'}}[0] = $sdRec->{'DATA'}->{$SDMODKEY}; - } - $sdRec->writeRec(); -} - -#!/usr/bin/perl -# Script to set the first title line equal to a given data field -# -# Usage: sdmodify -f<DataField> [sdFiles] -# -# If sdFiles not given, reads from standard input -# Output is to standard output - -sub printHelpAndExit { - print "\nScript to set the first title line equal to a given data field.\n"; - print "\nUsage:\tsdmodify -f<DataField> [sdFiles]\n"; - print "\n\tIf sdFiles not given, reads from standard input.\n"; - print "\n\tOutput is to standard output.\n\n"; - exit; -}