| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# Fixes up the IID's and coords of the sim4db mapped regions from extractUnmapped. |
| 4 |
# Reads polishes from stdin, writes fixed polishes to stdout. |
| 5 |
|
| 6 |
use strict; |
| 7 |
use lib "/bioinfo/assembly/walenz/src/genomics/scripts"; |
| 8 |
use sim4polish; |
| 9 |
$| = 1; |
| 10 |
|
| 11 |
while (!eof(STDIN)) { |
| 12 |
my %p = &sim4polish::readPolish(*STDIN); |
| 13 |
|
| 14 |
if ($p{'raw'}) { |
| 15 |
my $estIID; |
| 16 |
my $estBeg = 0; |
| 17 |
my $estEnd = 0; |
| 18 |
|
| 19 |
my $dbIID; |
| 20 |
my $dbBeg = 0; |
| 21 |
my $dbEnd = 0; |
| 22 |
|
| 23 |
if ($p{'estDefLine'} =~ m/extracted\s+from\s+iid\s+(\d+)\s+pos\s+(\d+)\s+(\d+)\s+/) { |
| 24 |
$estIID = $1; |
| 25 |
$estBeg = $2; |
| 26 |
$estEnd = $3; |
| 27 |
} |
| 28 |
|
| 29 |
if ($p{'dbDefLine'} =~ m/extracted\s+from\s+iid\s+(\d+)\s+pos\s+(\d+)\s+(\d+)\s+/) { |
| 30 |
$dbIID = $1; |
| 31 |
$dbBeg = $2; |
| 32 |
$dbEnd = $3; |
| 33 |
} |
| 34 |
|
| 35 |
if (defined($estIID)) { |
| 36 |
$p{'estID'} = $estIID; |
| 37 |
foreach my $exon (@{@p{'exons'}}) { |
| 38 |
$exon->{'cDNAstart'} += $estBeg; |
| 39 |
$exon->{'cDNAend'} += $estBeg; |
| 40 |
} |
| 41 |
} |
| 42 |
if (defined($dbIID)) { |
| 43 |
$p{'dbID'} = $dbIID; |
| 44 |
foreach my $exon (@{@p{'exons'}}) { |
| 45 |
$exon->{'GENOMICstart'} += $dbBeg; |
| 46 |
$exon->{'GENOMICend'} += $dbBeg; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
# normalize |
| 51 |
foreach my $exon (@{@p{'exons'}}) { |
| 52 |
$exon->{'GENOMICstart'} += $p{'dbLo'}; |
| 53 |
$exon->{'GENOMICend'} += $p{'dbLo'}; |
| 54 |
} |
| 55 |
|
| 56 |
$p{'dbLo'} = 0; |
| 57 |
$p{'dbHi'} = 0; |
| 58 |
$p{'estLen'} = 0; |
| 59 |
|
| 60 |
$p{'raw'} = &sim4polish::updatePolish(%p); |
| 61 |
print $p{'raw'}; |
| 62 |
} |
| 63 |
} |