3 package rsem_perl_utils;
8 our @ISA = qw(Exporter);
9 our @EXPORT = qw(runCommand);
10 our @EXPORT_OK = qw(runCommand collectResults showVersionInfo);
15 my $status = system($_[0]);
18 my @arr = split(/[ \t]+/, $_[0]);
19 print "$arr[0] : $!!\n";
20 print "Please check if you have compiled the associated codes by typing related \"make\" commands and/or made related executables ready to use.\n";
26 if (scalar(@_) > 1) { $errmsg .= $_[1]."\n"; }
27 $errmsg .= "\"$_[0]\" failed! Plase check if you provide correct parameters/options for the pipeline!\n";
34 my @allele_title = ("allele_id", "transcript_id", "gene_id", "length", "effective_length", "expected_count", "TPM", "FPKM", "AlleleIsoPct", "AlleleGenePct", "posterior_mean_count", "posterior_standard_deviation_of_count", "pme_TPM", "pme_FPKM", "AlleleIsoPct_from_pme_TPM", "AlleleGenePct_from_pme_TPM", "TPM_ci_lower_bound", "TPM_ci_upper_bound", "FPKM_ci_lower_bound", "FPKM_ci_upper_bound");
36 my @transcript_title = ("transcript_id", "gene_id", "length", "effective_length", "expected_count", "TPM", "FPKM", "IsoPct", "posterior_mean_count", "posterior_standard_deviation_of_count", "pme_TPM", "pme_FPKM", "IsoPct_from_pme_TPM", "TPM_ci_lower_bound", "TPM_ci_upper_bound", "FPKM_ci_lower_bound", "FPKM_ci_upper_bound");
38 my @gene_title = ("gene_id", "transcript_id(s)", "length", "effective_length", "expected_count", "TPM", "FPKM", "posterior_mean_count", "posterior_standard_deviation_of_count", "pme_TPM", "pme_FPKM", "TPM_ci_lower_bound", "TPM_ci_upper_bound", "FPKM_ci_lower_bound", "FPKM_ci_upper_bound");
50 $local_status = open(INPUT, $inpF);
51 if ($local_status == 0) { print "Fail to open file $inpF!\n"; exit(-1); }
55 while ($line = <INPUT>) {
57 my @local_arr = split(/\t/, $line);
58 push(@results, \@local_arr);
63 $local_status = open(OUTPUT, ">$outF");
64 if ($local_status == 0) { print "Fail to create file $outF!\n"; exit(-1); }
66 my $n = scalar(@results);
67 my $m = scalar(@{$results[0]});
72 for (my $i = 0; $i < $n; $i++) {
73 if ($_[0] eq "allele") { push(@out_arr, $allele_title[$i]); }
74 elsif ($_[0] eq "isoform") { push(@out_arr, $transcript_title[$i]); }
75 elsif ($_[0] eq "gene") { push(@out_arr, $gene_title[$i]); }
76 else { print "A bug on 'collectResults' is detected!\n"; exit(-1); }
78 print OUTPUT "@out_arr\n";
80 for (my $i = 0; $i < $m; $i++) {
82 for (my $j = 0; $j < $n; $j++) { push(@out_arr, $results[$j][$i]); }
83 print OUTPUT "@out_arr\n";
91 open(INPUT, "$_[0]/WHAT_IS_NEW");
95 print "Current version is $line\n";