Skip to content

Instantly share code, notes, and snippets.

@standage
Created November 6, 2013 15:19
Show Gist options
  • Select an option

  • Save standage/7337762 to your computer and use it in GitHub Desktop.

Select an option

Save standage/7337762 to your computer and use it in GitHub Desktop.
Given a Fasta file, print out GFF3-compatible '##sequence-region' pragmas. Often when GFF3 files are produced, the sequence-region pragmas indicate the coordinates directly bounding and sequence annotations rather than the entire sequence length. In some cases, having the entire sequence length is useful, and this script facilitates this.
#!/usr/bin/env perl
use strict;
use Bio::SeqIO;
my $instream = Bio::SeqIO->new( -fh => \*STDIN, -format => "Fasta" );
while(my $seq = $instream->next_seq)
{
printf("##sequence-region %s %lu %lu\n", $seq->id, 1, $seq->length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment