Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewjpage/f3ef06826d1244b642ccce4c26846c05 to your computer and use it in GitHub Desktop.
Save andrewjpage/f3ef06826d1244b642ccce4c26846c05 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Bio::SeqIO;
no warnings 'uninitialized';
my $in = Bio::SeqIO->new(-file => $ARGV[0] , '-format' => 'Fasta');
my $first_size = 0;
my $counter = 0;
my $error_found =0;
while ( my $seq = $in->next_seq() ) {
my $cur_size = $seq->length();
if($counter ==0)
{
$first_size = $cur_size;
}
if($first_size == $cur_size)
{
}
else
{
$error_found++;
print "Error in sequence ".$seq->display_id().". Size is ".$cur_size." but expected ".$first_size."\n";
}
$counter++;
}
if( $error_found > 0)
{
print "Sequences with errors: ".$error_found."\n";
}
print "Bases in each alignment: $first_size\n";
print "Number of sequences: ".$counter."\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment