|
@@ -95,6 +95,7 @@ else {
|
|
1 counts
|
|
1 counts
|
|
2 fpkm
|
|
2 fpkm
|
|
3 tpm
|
|
3 tpm
|
|
|
|
+4 cpm
|
|
## RSEM:
|
|
## RSEM:
|
|
|
|
|
|
0 transcript_id
|
|
0 transcript_id
|
|
@@ -144,7 +145,7 @@ else {
|
|
|
|
|
|
;
|
|
;
|
|
|
|
|
|
-my ($acc_field, $counts_field, $fpkm_field, $tpm_field);
|
|
|
|
|
|
+my ($acc_field, $counts_field, $fpkm_field, $tpm_field, $cpm_field);
|
|
|
|
|
|
if ($est_method =~ /^rsem$/i) {
|
|
if ($est_method =~ /^rsem$/i) {
|
|
$acc_field = 0;
|
|
$acc_field = 0;
|
|
@@ -175,6 +176,7 @@ elsif ($est_method =~ /^featureCounts/) {
|
|
$counts_field = "counts";
|
|
$counts_field = "counts";
|
|
$fpkm_field = "fpkm";
|
|
$fpkm_field = "fpkm";
|
|
$tpm_field = "tpm";
|
|
$tpm_field = "tpm";
|
|
|
|
+ $cpm_field = "cpm";
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
die "Error, dont recognize --est_method [$est_method] ";
|
|
die "Error, dont recognize --est_method [$est_method] ";
|
|
@@ -199,10 +201,12 @@ main: {
|
|
my $count = $x[ $fields{$counts_field} ];
|
|
my $count = $x[ $fields{$counts_field} ];
|
|
my $fpkm = $x[ $fields{$fpkm_field} ];
|
|
my $fpkm = $x[ $fields{$fpkm_field} ];
|
|
my $tpm = $x[ $fields{$tpm_field} ];
|
|
my $tpm = $x[ $fields{$tpm_field} ];
|
|
|
|
+ my $cpm = $x[ $fields{$cpm_field} ];
|
|
|
|
|
|
$data{$acc}->{$file}->{count} = $count;
|
|
$data{$acc}->{$file}->{count} = $count;
|
|
$data{$acc}->{$file}->{FPKM} = $fpkm;
|
|
$data{$acc}->{$file}->{FPKM} = $fpkm;
|
|
$data{$acc}->{$file}->{TPM} = $tpm;
|
|
$data{$acc}->{$file}->{TPM} = $tpm;
|
|
|
|
+ $data{$acc}->{$file}->{CPM} = $cpm;
|
|
}
|
|
}
|
|
close $fh;
|
|
close $fh;
|
|
}
|
|
}
|
|
@@ -221,8 +225,10 @@ main: {
|
|
|
|
|
|
my $counts_matrix_file = "$out_prefix.counts.matrix";
|
|
my $counts_matrix_file = "$out_prefix.counts.matrix";
|
|
my $TPM_matrix_file = "$out_prefix.TPM.not_cross_norm";
|
|
my $TPM_matrix_file = "$out_prefix.TPM.not_cross_norm";
|
|
|
|
+ my $CPM_matrix_file = "$out_prefix.CPM.not_cross_norm";
|
|
open (my $ofh_counts, ">$counts_matrix_file") or die "Error, cannot write file $counts_matrix_file";
|
|
open (my $ofh_counts, ">$counts_matrix_file") or die "Error, cannot write file $counts_matrix_file";
|
|
open (my $ofh_TPM, ">$TPM_matrix_file") or die "Error, cannot write file $TPM_matrix_file";
|
|
open (my $ofh_TPM, ">$TPM_matrix_file") or die "Error, cannot write file $TPM_matrix_file";
|
|
|
|
+ open (my $ofh_CPM, ">$CPM_matrix_file") or die "Error, cannot write file $CPM_matrix_file";
|
|
|
|
|
|
{ # check to see if they're unique
|
|
{ # check to see if they're unique
|
|
my %filename_map = map { + $_ => 1 } @filenames;
|
|
my %filename_map = map { + $_ => 1 } @filenames;
|
|
@@ -243,11 +249,13 @@ main: {
|
|
|
|
|
|
print $ofh_counts join("\t", "", @filenames) . "\n";
|
|
print $ofh_counts join("\t", "", @filenames) . "\n";
|
|
print $ofh_TPM join("\t", "", @filenames) . "\n";
|
|
print $ofh_TPM join("\t", "", @filenames) . "\n";
|
|
|
|
+ print $ofh_CPM join("\t", "", @filenames) . "\n";
|
|
|
|
|
|
foreach my $acc (keys %data) {
|
|
foreach my $acc (keys %data) {
|
|
|
|
|
|
print $ofh_counts "$acc";
|
|
print $ofh_counts "$acc";
|
|
print $ofh_TPM "$acc";
|
|
print $ofh_TPM "$acc";
|
|
|
|
+ print $ofh_CPM "$acc";
|
|
|
|
|
|
foreach my $file (@files) {
|
|
foreach my $file (@files) {
|
|
|
|
|
|
@@ -262,28 +270,43 @@ main: {
|
|
else {
|
|
else {
|
|
$tpm = "NA";
|
|
$tpm = "NA";
|
|
}
|
|
}
|
|
|
|
+ my $cpm = $data{$acc}->{$file}->{CPM};
|
|
|
|
+ if (defined $cpm) {
|
|
|
|
+ $cpm = $cpm/1;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $cpm = "NA";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
print $ofh_counts "\t$count";
|
|
print $ofh_counts "\t$count";
|
|
print $ofh_TPM "\t$tpm";
|
|
print $ofh_TPM "\t$tpm";
|
|
|
|
+ print $ofh_CPM "\t$cpm";
|
|
}
|
|
}
|
|
|
|
|
|
print $ofh_counts "\n";
|
|
print $ofh_counts "\n";
|
|
print $ofh_TPM "\n";
|
|
print $ofh_TPM "\n";
|
|
|
|
+ print $ofh_CPM "\n";
|
|
|
|
|
|
}
|
|
}
|
|
close $ofh_counts;
|
|
close $ofh_counts;
|
|
close $ofh_TPM;
|
|
close $ofh_TPM;
|
|
|
|
+ close $ofh_CPM;
|
|
|
|
|
|
|
|
|
|
if (scalar @files > 1) {
|
|
if (scalar @files > 1) {
|
|
## more than one sample
|
|
## more than one sample
|
|
|
|
|
|
if ($cross_sample_norm =~ /^TMM$/i) {
|
|
if ($cross_sample_norm =~ /^TMM$/i) {
|
|
- my $cmd = "$FindBin::RealBin/support_scripts/run_TMM_scale_matrix.pl --matrix $TPM_matrix_file > $out_prefix.$cross_sample_norm.EXPR.matrix";
|
|
|
|
|
|
+ my $cmd = "$FindBin::RealBin/support_scripts/run_TMM_scale_matrix.pl --matrix $TPM_matrix_file > $out_prefix.$cross_sample_norm.TPM.matrix";
|
|
|
|
+ &process_cmd($cmd);
|
|
|
|
+ $cmd = "$FindBin::RealBin/support_scripts/run_TMM_scale_matrix.pl --matrix $CPM_matrix_file > $out_prefix.$cross_sample_norm.CPM.matrix";
|
|
&process_cmd($cmd);
|
|
&process_cmd($cmd);
|
|
}
|
|
}
|
|
elsif ($cross_sample_norm =~ /^UpperQuartile$/) {
|
|
elsif ($cross_sample_norm =~ /^UpperQuartile$/) {
|
|
- my $cmd = "$FindBin::RealBin/support_scripts/run_UpperQuartileNormalization_matrix.pl --matrix $TPM_matrix_file > $out_prefix.$cross_sample_norm.EXPR.matrix";
|
|
|
|
|
|
+ my $cmd = "$FindBin::RealBin/support_scripts/run_UpperQuartileNormalization_matrix.pl --matrix $TPM_matrix_file > $out_prefix.$cross_sample_norm.TPM.matrix";
|
|
|
|
+ &process_cmd($cmd);
|
|
|
|
+ $cmd = "$FindBin::RealBin/support_scripts/run_UpperQuartileNormalization_matrix.pl --matrix $CPM_matrix_file > $out_prefix.$cross_sample_norm.CPM.matrix";
|
|
&process_cmd($cmd);
|
|
&process_cmd($cmd);
|
|
}
|
|
}
|
|
elsif ($cross_sample_norm =~ /^none$/i) {
|
|
elsif ($cross_sample_norm =~ /^none$/i) {
|