1 | #! /usr/bin/perl -w |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | my $command = ""; |
---|
6 | # a wrapper for paste for use in galaxy |
---|
7 | # pasteWrapper.pl [filename1] [filename2] [delimiter] [output] |
---|
8 | |
---|
9 | die "Check arguments" unless @ARGV == 4; |
---|
10 | |
---|
11 | if ($ARGV[2] eq 'T') { |
---|
12 | $command = "paste $ARGV[0] $ARGV[1]"; |
---|
13 | } elsif ($ARGV[2] eq 'C') { |
---|
14 | $command = "paste -d \",\" $ARGV[0] $ARGV[1]"; |
---|
15 | } elsif ($ARGV[2] eq 'D') { |
---|
16 | $command = "paste -d \"-\" $ARGV[0] $ARGV[1]"; |
---|
17 | } elsif ($ARGV[2] eq 'U') { |
---|
18 | $command = "paste -d \"_\" $ARGV[0] $ARGV[1]"; |
---|
19 | } elsif ($ARGV[2] eq 'P') { |
---|
20 | $command = "paste -d \"|\" $ARGV[0] $ARGV[1]"; |
---|
21 | } elsif ($ARGV[2] eq 'Dt') { |
---|
22 | $command = "paste -d \".\" $ARGV[0] $ARGV[1]"; |
---|
23 | } elsif ($ARGV[2] eq 'Sp') { |
---|
24 | $command = "paste -d \" \" $ARGV[0] $ARGV[1]"; |
---|
25 | } |
---|
26 | |
---|
27 | open (OUT, ">$ARGV[3]") or die "Cannot create $ARGV[2]:$!\n"; |
---|
28 | open (PASTE, "$command |") or die "Cannot run paste:$!\n"; |
---|
29 | |
---|
30 | while (<PASTE>) { |
---|
31 | print OUT; |
---|
32 | } |
---|
33 | close OUT; |
---|
34 | close PASTE; |
---|
35 | |
---|