-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathfinal_process_IR_output_short.pl
57 lines (52 loc) · 2.2 KB
/
final_process_IR_output_short.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl
use strict;
use warnings;
use List::Util qw( min max );
use List::Util qw(sum);
#data_file_1=cassette_sorted.txt; $data_file2=$condition_num; $data_file_3=$ctrl_num;
my $len=scalar(@ARGV);
if ($len < 1) {
die "Usage:final_process_IR_output_long.pl <data_file_1> <data_file_2> <data_file_3>\n";
}
my ($data_file_1, $data_file_2, $data_file_3) = @ARGV;
my $count=0;
open(IN1, "<$data_file_1") or die "can't open input1 file: $!";
open(OUT1, ">$data_file_2") || die "can't open OUT1 file";
open(OUT2, ">$data_file_3") || die "can't open OUT2 file";
my $coor;
my $start;
my $end;
my @pvalue=[0,0];
my @qvalue=[0,0];
my @array;
my $pmin;
my $qmin;
while(<IN1>) {
chomp;
if($_ !~ /raw_count/) {
if($count % 2 == 1) {
@array=split(/\s+/,$_);
$coor = $array[11] . "_" . $array[15] . "_" . $array[12] . "_" . $array[13];
$start = $array[12];
$end = $array[13];
$pvalue[0]=$array[6];
$qvalue[0]=$array[7];
$count=$count+1;
}
elsif($count % 2 == 0) {
@array=split(/\s+/,$_);
$pvalue[1]=$array[6];
$qvalue[1]=$array[7];
$count=$count+1;
$pmin = min @pvalue;
s/NA/1/g for @qvalue;
$qmin = min @qvalue;
print OUT1 $array[0]; print OUT1 "\t"; print OUT1 $coor; print OUT1 "\t"; print OUT1 $array[11]; print OUT1 "\t"; print OUT1 $array[15]; print OUT1 "\t"; print OUT1 $start; print OUT1 "\t"; print OUT1 $end; print OUT1 "\t"; print OUT1 $pmin; print OUT1 "\t"; print OUT1 $qmin; print OUT1 "\t"; print OUT1 $array[-1]; print OUT1 "\n";
print OUT2 $array[1]; print OUT2 "\t"; print OUT2 $coor; print OUT2 "\n";
}
}
else { @array=split(/\s+/,$_);
print OUT1 "Gene"; print OUT1 "\t"; print OUT1 "AS_event_ID"; print OUT1 "\t"; print OUT1 "chromosome"; print OUT1 "\t"; print OUT1 "strand"; print OUT1 "\t"; print OUT1 "retained_intron_start"; print OUT1 "\t"; print OUT1 "retained_intron_end"; print OUT1 "\t" ; print OUT1 "pvalue"; print OUT1 "\t"; print OUT1 "qvalue"; print OUT1 "\t"; print OUT1 "deltaPSI_"; print OUT1 $array[8]; print OUT1 "-"; print OUT1 $array[9]; print OUT1 "\n";
$count=$count+1;
}
}