[Bio] / FigKernelScripts / align_with_clustal.pl Repository:
ViewVC logotype

View of /FigKernelScripts/align_with_clustal.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Wed May 19 21:34:22 2004 UTC (15 years, 8 months ago) by overbeek
Branch: MAIN
Changes since 1.1: +2 -0 lines
fixed multiple identical rows in ssa due to import

# -*- perl -*-

use Carp;
use Data::Dumper;
use tree_utilities;
use FIG;

my $fig = new FIG;

$| = 1;

# usage: align_with_clustal Id1 Id2 ...

(@ARGV > 1) || die "usage: align_with_clustal [-tree] Id1 Id2 ... ";

my $temp_dir = $FIG_Config::temp;
my $file     = "$temp_dir/tmp$$";
my $relabel  = {};

if ($ARGV[0] =~ /-tree/)
{
    $tree = 1;
    shift @ARGV;
}

open(TMP,">$file.fasta") || die "could not open $file";
foreach $id (@ARGV)
{
    next if ($seen{$id});
    if ($seq = $fig->get_translation($id))
    {
	$seen{$id} = 1;
	print TMP ">$id\n$seq\n";
	$func = $fig->function_of($id);
	$relabel->{$id} = "$id: $func";
    }
    else
    {
	print STDERR "could not find translation for $id\n";
    }
}
close(TMP);

system "$FIG_Config::ext_bin/clustalw -infile=$file.fasta -align -outorder=aligned > /dev/null";
print `cat $file.aln`;
if ($tree)
{
    print "=======================================================================\n\n\n";
    $tree = "";
 
    if (-s "$file.dnd")
    {
        @treefile = `cat $file.dnd`;
        if (@treefile && ($tree = &parse_newick_tree(join("",@treefile))))
        {
            $tree = &display_tree($tree,$relabel);
        }
    }
    print "$tree\n";
}

unlink("$file.fasta","$file.aln","$file.dnd");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3