Skip to content

Instantly share code, notes, and snippets.

@sestaton
Last active August 29, 2015 14:13
Show Gist options
  • Save sestaton/7143b526c76b8e1f84b3 to your computer and use it in GitHub Desktop.
Save sestaton/7143b526c76b8e1f84b3 to your computer and use it in GitHub Desktop.
biostars125994.pl - align all files in a directory
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
use Bio::Tools::Run::Alignment::Clustalw;
my $dir = 'genes';
my @files;
find( sub {
push @files, $File::Find::name if -f and /\.fa$/
}, $dir);
for my $file (@files) {
my @params = ('ktuple' => 2, 'matrix' => 'BLOSUM', 'outfile' => "$file.aln");
my $factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);
my $aln = $factory->align($file);
# do something with $aln
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment