Permalink
Browse files

convert MUMMER SNP output to GFF3 -- need to also support VCF later

  • Loading branch information...
1 parent 6268c7f commit 3e25c4ff1465df91eb25bc868b2d59819b921676 @hyphaltip committed Jan 24, 2013
Showing with 33 additions and 0 deletions.
  1. +33 −0 popgen/mummersnps_to_gff3.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+my $source = 'MUMMER';
+my $snptype = 'SNP';
+my $indeltype = 'INDEL';
+
+my %count = ($snptype => 1,
+ $indeltype => 1);
+<>;
+my $hdr = <>;
+if( $hdr !~ /^NUCMER/) {
+ warn "expected NUMBER as $hdr\n";
+}
+while(<>) {
+ next if /^(NUCMER|\s+|\[)/;
+ my @row = split;
+ my $type = $snptype;
+ if( $row[1] eq '.' || $row[2] eq '.') {
+ $type = $indeltype;
+ }
+ print join("\t", $row[10],$source, $type,
+ $row[0], $row[0]+1,
+ '.',
+ '.',
+ '.',
+ join(";",
+ sprintf("ID=%s%07d",$type,$count{$type}++),
+ sprintf("Target=%s %d %d %s",$row[11], $row[3],
+ $row[3] + 1,
+ $row[9] > 0 ? '+' : '-'))),"\n";
+}

0 comments on commit 3e25c4f

Please sign in to comment.