-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_embeded_alignment.pl
42 lines (37 loc) · 1013 Bytes
/
delete_embeded_alignment.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
#!/usr/bin/perl -w
use strict;
my $inalign=shift;
my $bestrefer=shift;
my $bestcontig=shift;
my %blocks;
open IN, "$inalign" || die "$!\n";
while(<IN>){
chomp;
my @info=split;
my @info2=split(/\|/, $info[18]);
next unless (($info[17] eq "$bestrefer") && ($info2[-1] eq "$bestcontig"));
#print "$_\n";
my $strand=($info[3]<$info[4]) ? "+" : "-";
push @{$blocks{"$info[18]\t$strand"}}, [@info];
}
close IN;
open IN2, "$inalign" || die "$!\n";
lable:while(<IN2>){
chomp;
my @info=split;
my @info2=split(/\|/, $info[18]);
next unless (($info[17] eq "$bestrefer") && ($info2[-1] eq "$bestcontig"));
my $s=($info[3]<$info[4]) ? "+" : "-";
my $bid="$info[18]\t$s";
#print "$bid\n";
for (my $i=0; $i<@{$blocks{$bid}}; $i++){
#print "$info[0]\_$info[1]\t$blocks{$bid}[$i][0]\t$blocks{$bid}[$i][1]\n";
my $olds=$blocks{$bid}[$i][0];
my $olde=$blocks{$bid}[$i][1];
if (($info[0]>=$olds && $info[1]<$olde) || ($info[0]>$olds && $info[1]<=$olde)){
next lable;
}
}
print "$_\n";
}
close IN2;