]> git.donarmstrong.com Git - rsem.git/blobdiff - rsem-generate-data-matrix
Modified the acknowledgement section of README.md
[rsem.git] / rsem-generate-data-matrix
index 951f415df24a8de4e5efd1e594daa11608abe87c..f85156d0bf68e1aa3bd138da730de578f4594ba6 100755 (executable)
@@ -1,14 +1,15 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 
 if (scalar(@ARGV) == 0) {
-    print "Usage: rsem-generate-data-matrix sampleA.[genes/isoforms].results sampleB.[genes/isoforms].results ... > output_name.matrix\n";
-    print "Results files should be either all .genes.results or all .isoforms.results.\n";
+    print "Usage: rsem-generate-data-matrix sampleA.[alleles/genes/isoforms].results sampleB.[alleles/genes/isoforms].results ... > output_name.matrix\n";
+    print "All result files should have the same file type. The 'TPM' columns of every result file are extracted to form the data matrix.\n";
     exit(-1);
 }
 
 my $offsite = 4; # for new file formats
+if ($ARGV[0] =~ /alleles.results$/) { $offsite = 5; }
 
 my $line;
 my $n = scalar(@ARGV);
@@ -22,7 +23,7 @@ sub loadData {
     while ($line = <INPUT>) {
        chomp($line); 
        my @fields = split(/\t/, $line);
-       push(@{$_[2]}, $fields[0]);
+       push(@{$_[2]}, "\"$fields[0]\"");
        push(@{$_[1]}, $fields[$offsite]);
     }
     close(INPUT);
@@ -59,7 +60,11 @@ for (my $i = 0; $i < $n; $i++) {
        exit(-1); 
     }
 
-    @ecs = ($ARGV[$i], @ecs);
+    my $colname;
+    if (substr($ARGV[$i], 0, 2) eq "./") { $colname = substr($ARGV[$i], 2); }
+    else { $colname = $ARGV[$i]; }
+    $colname = "\"$colname\"";
+    @ecs = ($colname, @ecs);
     push(@matrix, \@ecs);
 }