[Bio-software] Re: Converting Clustal alignment to a single consensus sequence

Don Gilbert via bio-soft%40net.bio.net (by gilbertd from bio.indiana.edu)
Sat Jan 16 16:24:35 EST 2010


Duncan,

Likely there are many such programs that can do this. Try this 
sort of unix script with BioPerl,
see http://www.bioperl.org/wiki/BioPerl_Tutorial#Alignments
- Don Gilbert

#!/bin/csh
# clustalw_consensus.sh using BioPerl AlignIO

foreach in (*.aln)
  env in=$in perl -e'use Bio::AlignIO; $in=$ENV{in}; \
  $aln=Bio::AlignIO->new("-format"=>"clustalw","-file"=>$in)->next_aln(); \
  ($id=$in) =~ s/\..*$//; ($fa=$aln->consensus_string()) =~ s/(.{60})/$1\n/g; \
  print ">$id\n$fa\n";'
end

>39815
MALTWKMIRLSGNWLLCLLLAASLTAAASSAIGATDPALDSKPALFNFVEPAPEILKNRK
GHALQQSDVSYANYLKYPMAQPSPTSLALSGSAAGVSFPNRIAFPPAQPLIHSAVHPDAY
...
>8864
MALTWKMIRLSGNWLLCLLLAASLTAAASSAIGATDPALDSKPALFNFVEPAPEILKNRK
GHALQQSDVSYANYLKYPMAQPSPTSLALSGSAAGVSFPNRIAFPPAQPLIHSAVHPDAY
...

On 2010-01-15, Duncan Clark <blackhole from abuse.plus.com> wrote:
> Hi Folks,
>
> Does anyone know of software or a web page that will take a Clustal .aln 
> file and simply spew out a single consensus sequence?
>



More information about the Bio-soft mailing list