Skip to content

Instantly share code, notes, and snippets.

@sestaton
Last active August 29, 2015 14:11
Show Gist options
  • Save sestaton/651a34ae8dbb4d4c945c to your computer and use it in GitHub Desktop.
Save sestaton/651a34ae8dbb4d4c945c to your computer and use it in GitHub Desktop.
biostars123787.pl - print numeric Fasta records
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Bio::SeqIO;
use List::MoreUtils qw(any);
my @ids = (1, 5, 10);
my $num = 0;
my $seqio = Bio::SeqIO->new(-fh => \*STDIN);
while (my $seq = $seqio->next_seq) {
$num++;
say join "\n", ">".$seq->id, $seq->seq
if any { $_ == $num } @ids;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment