#!/usr/bin/env perl
use strict;
use warnings;
use IO::String;
use Bio::Tools::RepeatMasker;
use Bio::FeatureIO;

my $fake_repeatmasker_file = IO::String->new(<<EOREPEATMASKER);
  SW  perc perc perc  query            position in query         matching    repeat         position in  repeat
score  div. del. ins.  sequence          begin    end   (left)   repeat      class/family   begin  end (left)  ID

  918  20.4  6.8  1.9  C08HBa0001K22.1    2095   2556 (124560) C  Contig151   Unknown/repeat   (7)  832    325   1
  488  17.9  0.0  6.6  C08HBa0001K22.1    2590   2736 (124380) C  Contig386   Unknown/repeat (592)  124      1   2
 1718  15.9  0.9  3.5  C08HBa0001K22.1    2787   3105 (124011) +  Contig358   Unknown/repeat     1  311    (3)   3
  312  14.5  0.0  1.6  C08HBa0001K22.1    3974   4036 (123080) C  hind_R=2046 Unknown          (0)  120     59   4
EOREPEATMASKER

my $fi = Bio::Tools::RepeatMasker->new( -fh => $fake_repeatmasker_file );

my $fo = Bio::FeatureIO->new(-fh=> \*STDOUT, -format => 'gff', -version => 3);
while (my $feature_pair = $fi->next_result() ) {
  $feature_pair->primary_tag('nucleotide_motif');
  $feature_pair->invert;  #should I really need to invert this?  is
                          #Bio::Tools::RepeatMasker making the pair in
                          #the wrong order?  or is Bio::Tools::GFF
                          #interpreting it in the wrong order?
  $fo->write_feature( $feature_pair->feature1 );
}


