File: mhap2paf.pl

package info (click to toggle)
miniasm 0.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 604 kB
  • ctags: 426
  • sloc: ansic: 2,487; perl: 85; sh: 66; makefile: 29
file content (23 lines) | stat: -rwxr-xr-x 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env perl

use strict;
use warnings;
use Getopt::Std;

my %opts = ();
getopts("2", \%opts);
my $is_dbl = defined($opts{2});

die("Usage: mhap2paf.pl [-2] <in.mhap>\n") if (@ARGV == 0 && -t STDIN);

while (<>) {
	chomp;
	my @t = split;
	my $bl = $t[6] - $t[5] > $t[10] - $t[9]? $t[6] - $t[5] : $t[10] - $t[9];
	my $r = $t[2];
	my $ml = int($bl * ($r <= 1.? $r : .01 * $r) + .499);
	my $cm = "cm:i:" . int($t[3] + .499);
	my $rev = $t[4] == $t[8]? '+' : '-';
	print(join("\t", @t[0,7,5,6], $rev, @t[1,11,9,10], $ml, $bl, 255, $cm), "\n");
	print(join("\t", @t[1,11,9,10], $rev, @t[0,7,5,6], $ml, $bl, 255, $cm), "\n") if ($is_dbl);
}