Last active
May 18, 2022 04:13
-
-
Save piroyon/895e0cc936d034e7d3d3d4021039fc22 to your computer and use it in GitHub Desktop.
Calculate alignment length from CIGAR string (perl, subroutine)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub cigarlen { | |
my $cigar = shift; | |
my @c = $cigar =~ /\d+[MI=X]/g; | |
my $len = 0; | |
foreach my $i (@c) { | |
$i =~ /(\d+)[MI=X]/; | |
$len += $1; | |
} | |
return $len; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment