-
Notifications
You must be signed in to change notification settings - Fork 0
/
contigs_check.pl
43 lines (38 loc) · 1.06 KB
/
contigs_check.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
#!/usr/bin/perl -w
use strict;
my $innucmer=shift;
my $len_cutoff=shift;
$len_cutoff ||="74,92,10,22,18,29";# xxKB, LSC/SSC/IR
my @info=split(/,/,$len_cutoff);
my %bhash;
my %chash;
open IN, "$innucmer" || die "$!\n";
while(<IN>){
chomp;
next unless (/\s+NODE\_/);
#print "$_\n";
my @info=split;
$bhash{$info[18]}=$info[12];
#my $cover=$1 if ($info[18]=~/\_cov\_(\S+)/);
my $cover=$1 if ($info[18]=~/\_cov\_(\S+)\|/);
#print "$info[18]\t$cover\n";
$chash{$info[18]}=$cover;
}
close IN;
my($x, $y, $z);
my $cnumber=scalar keys %bhash;
#print "$cnumber\n";
if($cnumber==3){
my $num=1;
foreach my $id(sort {$chash{$b}<=>$chash{$a}} keys %chash){
$x="LSC-YES" if ($num!=1 && $bhash{$id}>=$info[0]*1000 && $bhash{$id}<=$info[1]*1000);
$y="SSC-YES" if ($num!=1 && $bhash{$id}>=$info[2]*1000 && $bhash{$id}<=$info[3]*1000);
$z="IR-YES" if ($num==1 && $bhash{$id}>=$info[4]*1000 && $bhash{$id}<=$info[5]*1000);
$num++;
}
}
if ((defined $x && $x eq "LSC-YES") && (defined $y && $y eq "SSC-YES") && (defined $z && $z eq "IR-YES")){
print "PASS";
}else{
print "FAIL";
}