-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse_pilon.pl
49 lines (38 loc) · 872 Bytes
/
parse_pilon.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
44
45
46
47
48
#!/usr/bin/perl -w
use strict;
my $id=shift;
my $in_pilon_report=shift;
my $in_samtools_stat=shift;
#print "ID (raw_read mapped mapped_%) Length(bp) # of Reads Mean Coverage Minimum Coverage Confirmed(%)"
print "$id\t";
if ($in_samtools_stat){
open IN, "$in_samtools_stat" || die "$!\n";
while(<IN>){
print "$1\t" if (/(\d+).+total/);
if (/(\d+).+mapped\s+\((\S+)\%/){
#my $mapped=$1;
#my $mapped_percent=$2;
print "$1\t$2\t";
}
}
close IN
}
open IN, "$in_pilon_report" || die "$!\n";
while(<IN>){
chomp;
if(/Input genome size: (\d+)/){
print "$1\t";
}
if (/:\s+(\d+)\s+reads.+\s+(\d+)\s+mapped.+\s+(\d+)\+\//){
print "$1\t$2\t";
printf "%.2f\t", $2/$1*100;
print "$3\t";
}
if(/Total Reads: (\d+), Coverage: (\d+), minDepth: (\d+)/){
print "$2\t$3\t";
}
if(/Confirmed.+bases \((\S+)\%\)/){
print "$1\n";
}
}
close IN;