Skip to content

Instantly share code, notes, and snippets.

Created May 14, 2014 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/e50ef06c30f10de01298 to your computer and use it in GitHub Desktop.
Save anonymous/e50ef06c30f10de01298 to your computer and use it in GitHub Desktop.
*#!/usr/bin/env perl
use strict;
use warnings;
use Bio::SeqIO;
my $file = shift;
# create reader for the input
my $seq_in = Bio::SeqIO->new( -file => $file,
-format => 'genbank' );
my @entries;
while (my $contig = $seq_in->next_seq()){
## do stuff
push @entries, $contig;
}
my $outfile = Bio::SeqIO->new( -file => ">out.gbk",
-format => 'genbank' );
foreach my $contig (@entries){
$outfile->write_seq($contig);
}
## Example for "do stuff"
#foreach my $feat ($contig->get_SeqFeatures()){
# if($feat->primary_tag() eq 'CDS'){
# my $feature_seq = $feat->seq();
# print $feature_seq."\n";
# }
#}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment