forked from splicebox/PsiCLASS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilterSplice.pl
More file actions
48 lines (40 loc) · 841 Bytes
/
FilterSplice.pl
File metadata and controls
48 lines (40 loc) · 841 Bytes
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
#!/bin/perl
use strict ;
use warnings ;
die "usage: a.pl a.raw_splice trusted.plisce > filtered.splice\n" if ( @ARGV == 0 ) ;
my %trustedSplices ;
open FP1, $ARGV[1] ;
while ( <FP1> )
{
chomp ;
my @cols = split /\s+/, $_ ;
my $key = $cols[0]." ".$cols[1]." ".$cols[2] ;
$trustedSplices{ $key } = $cols[4] ;
}
close FP1 ;
open FP1, $ARGV[0] ;
while ( <FP1> )
{
chomp ;
my @cols = split /\s+/, $_ ;
my $key = $cols[0]." ".$cols[1]." ".$cols[2] ;
next if ( !defined $trustedSplices{ $key } ) ;
my $trustedStrand = $trustedSplices{ $key } ;
if ( $cols[3] <= 0 )
{
print $cols[0], " ", $cols[1], " ", $cols[2], " 1 ", $trustedStrand, " 1 0 0 0\n" ;
}
else
{
if ( $cols[4] eq $trustedStrand )
{
print $_, "\n" ;
}
else
{
$cols[4] = $trustedStrand ;
print join( " ", @cols ), "\n" ;
}
}
}
close FP1 ;