Mercurial > repos > lsong10 > psiclass
comparison PsiCLASS-1.0.2/FilterSplice.pl @ 0:903fc43d6227 draft default tip
Uploaded
author | lsong10 |
---|---|
date | Fri, 26 Mar 2021 16:52:45 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:903fc43d6227 |
---|---|
1 #!/bin/perl | |
2 | |
3 use strict ; | |
4 use warnings ; | |
5 | |
6 die "usage: a.pl a.raw_splice trusted.plisce > filtered.splice\n" if ( @ARGV == 0 ) ; | |
7 | |
8 my %trustedSplices ; | |
9 | |
10 open FP1, $ARGV[1] ; | |
11 while ( <FP1> ) | |
12 { | |
13 chomp ; | |
14 my @cols = split /\s+/, $_ ; | |
15 my $key = $cols[0]." ".$cols[1]." ".$cols[2] ; | |
16 $trustedSplices{ $key } = $cols[4] ; | |
17 } | |
18 close FP1 ; | |
19 | |
20 open FP1, $ARGV[0] ; | |
21 while ( <FP1> ) | |
22 { | |
23 chomp ; | |
24 my @cols = split /\s+/, $_ ; | |
25 my $key = $cols[0]." ".$cols[1]." ".$cols[2] ; | |
26 next if ( !defined $trustedSplices{ $key } ) ; | |
27 | |
28 my $trustedStrand = $trustedSplices{ $key } ; | |
29 if ( $cols[3] <= 0 ) | |
30 { | |
31 print $cols[0], " ", $cols[1], " ", $cols[2], " 1 ", $trustedStrand, " 1 0 0 0\n" ; | |
32 } | |
33 else | |
34 { | |
35 if ( $cols[4] eq $trustedStrand ) | |
36 { | |
37 print $_, "\n" ; | |
38 } | |
39 else | |
40 { | |
41 $cols[4] = $trustedStrand ; | |
42 print join( " ", @cols ), "\n" ; | |
43 } | |
44 } | |
45 | |
46 } | |
47 close FP1 ; | |
48 |