[ssml] Multiple Alignment to PSSM
Yun He
jarod at spg.biosci.tsinghua.edu.cn
Fri Apr 29 21:38:19 EDT 2005
Hi, Rajesh
I had asked the same question here several months ago, some one told me that
it is very difficult to covert the alignments into PSSM in the manner of
BLAST/PSI-BLAST, but you can do that with HMMER instead. Then I tried to use
HMMER, yes, HMMER really can.
/usr/local/HMMER/bin/hmmbuild -F --fast --gapmax 1 --wblosum tmp.hmm
your_multialignments_in_FASTA_format.fasta > /dev/null
/usr/local/HMMER/bin/hmmconvert -F -p tmp.hmm profile_in_HMMER_format.prof
> /dev/null
If you want to convert profile_in_HMMER_format into PSSM format, can use this
Perl script:
##Main part
my @effective_alphabet = qw(A R N D C Q E G H I L K M F P S T
W Y V); ## Columns order like PSSM
my $normalized_ratio = 100; ## set this if you want to normalize those columns
my @hmmprof;
&read_hmmprof("profile_in_HMMER_format.prof", \@hmmprof);
print " ";
for(my $i=0; $i < scalar @effective_alphabet; $i++)
{
printf " %s ", $effective_alphabet[$i];
}
print "\n";
for(my $i=0; $i < scalar @hmmprof; $i++)
{
printf "%1s ", substr($your_query_sequence, $i, 1);
for(my $j=0; $j < scalar @{$hmmprof[$i]}; $j++)
{
printf "%7.3f ", $hmmprof[$i][$j]/$normalized_ratio;
}
print "\n";
}
exit 0 ;
sub read_hmmprof
{
my $file = shift; ## INPUT: HMM profile format
my $prof = shift; ## OUTPUT: ref of array (profile matrix)
open IN, $file or return 0;
my $c = 0;
my @matrix;
my @order;
while (<IN>){
if (/^Cons/){
@order = (split / +/)[1..24];
while (($line = <IN>)!~ /\*/)
{
if ($line !~ /\!/){
@{$matrix[$c]} = (split / +/, $line)[2..25];
$c++;
}
}
}
}
close IN;
my @idxorder;
for(my $i=0; $i < scalar @effective_alphabet; $i++){
for(my $j=0; $j < scalar @order; $j++){
if($effective_alphabet[$i] eq $order[$j]){
$idxorder[$i] = $j;
last ;
}
}
}
for(my $i=0; $i < scalar @matrix; $i++)
{
for(my $j=0; $j < scalar @effective_alphabet; $j++)
{
$prof->[$i][$j] = $matrix[$i][$idxorder[$j]];
}
}
undef @matrix;
return 1;
}
=== Jarod
On Saturday 30 April 2005 00:07, ssml-general-request at bioinformatics.org
wrote:
> Dear All,
>
> I have a set of multiple alignments which I want to convert into PSSM
> profiles (searchable byr RPSblast). Could anyone please tell how to achieve
> this?
>
> Thanks in advance.
>
> Rajesh
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://bioinformatics.org/pipermail/ssml-general/attachments/20050430/cc4d561a/attachment.bin
More information about the ssml-general
mailing list