| 
1
 | 
     1 #!/usr/bin/perl
 | 
| 
 | 
     2 my $SrcFolder="/home/galaxy/galaxy-dist/tools/SpliceTrap.0.90.1/bin";
 | 
| 
 | 
     3 # this script is a wrapup for Post analysis based on the ratio file output
 | 
| 
 | 
     4 
 | 
| 
 | 
     5 use strict;
 | 
| 
 | 
     6 use Getopt::Long;
 | 
| 
 | 
     7 my $RatioFile="";
 | 
| 
 | 
     8 my $OutputFile = "";
 | 
| 
 | 
     9 my $JunctionCut=5;
 | 
| 
 | 
    10 my $CutoffLevel="M";
 | 
| 
 | 
    11 my $noIRM = 0;
 | 
| 
 | 
    12 my $noIRMstr="";
 | 
| 
 | 
    13 
 | 
| 
 | 
    14 GetOptions (
 | 
| 
 | 
    15 	"i:s"=>\$RatioFile,
 | 
| 
 | 
    16 	"o:s"=>\$OutputFile,
 | 
| 
 | 
    17 	"c:s"=>\$CutoffLevel,
 | 
| 
 | 
    18 	"noIRM|noirm"=>\$noIRM,
 | 
| 
 | 
    19 	"j:i"=>\$JunctionCut
 | 
| 
 | 
    20 );
 | 
| 
 | 
    21 
 | 
| 
 | 
    22 my $InputParaDes="	Usage of the script:
 | 
| 
 | 
    23 	-i      input file (.ratio file)
 | 
| 
 | 
    24 	-o      output file
 | 
| 
 | 
    25 	-c      Cutoff Level:H/[M]/L
 | 
| 
 | 
    26 		Means High, Middle or Low
 | 
| 
 | 
    27 	-j	Junction reads per junction requirement for each exon-isoform [5]
 | 
| 
 | 
    28 	--noIRM Use the unadjusted inclusion ratios (before IRM correction)
 | 
| 
 | 
    29 ";
 | 
| 
 | 
    30 
 | 
| 
 | 
    31 if($RatioFile eq "")
 | 
| 
 | 
    32 {
 | 
| 
 | 
    33 	print $InputParaDes;
 | 
| 
 | 
    34 	exit;
 | 
| 
 | 
    35 }
 | 
| 
 | 
    36 
 | 
| 
 | 
    37 if($CutoffLevel ne "H" and  $CutoffLevel ne "M" and  $CutoffLevel ne "L")
 | 
| 
 | 
    38 {
 | 
| 
 | 
    39 	print $InputParaDes;
 | 
| 
 | 
    40 	exit;
 | 
| 
 | 
    41 }
 | 
| 
 | 
    42 if($noIRM)
 | 
| 
 | 
    43 {
 | 
| 
 | 
    44 	$noIRMstr= "noirm";
 | 
| 
 | 
    45 }
 | 
| 
 | 
    46 
 | 
| 
 | 
    47 
 | 
| 
 | 
    48 system("perl $SrcFolder/ApplyCutoff.jie.pl $RatioFile $CutoffLevel $JunctionCut  $noIRMstr >$OutputFile.raw");
 | 
| 
 | 
    49 
 | 
| 
 | 
    50 open(rawfile, "$OutputFile.raw");
 | 
| 
 | 
    51 open(outfile, ">$OutputFile");
 | 
| 
 | 
    52 while(my $line=<rawfile>)
 | 
| 
 | 
    53 {
 | 
| 
 | 
    54 	chomp($line);
 | 
| 
 | 
    55 	my @a=split("\t",$line);
 | 
| 
 | 
    56 	if($noIRM)
 | 
| 
 | 
    57 	{
 | 
| 
 | 
    58 		print outfile join("\t",$a[21],$a[1],$a[3],$a[4],$a[5],$a[6],$a[7],$a[11],$a[12],$a[13],$a[14]),"\n";
 | 
| 
 | 
    59 	}
 | 
| 
 | 
    60 	else
 | 
| 
 | 
    61 	{
 | 
| 
 | 
    62 		print outfile join("\t",$a[21],$a[2],$a[3],$a[4],$a[5],$a[6],$a[7],$a[11],$a[12],$a[13],$a[14]),"\n";
 | 
| 
 | 
    63 	}
 | 
| 
 | 
    64 }
 | 
| 
 | 
    65 close(outfile);
 | 
| 
 | 
    66 close(rawfile);
 |