G::Tools Alignment
Included librariesPackage variablesGeneral documentationMethods
Package variables
No package variables defined.
Included modules
G::Messenger
SelfLoader
SubOpt
Inherit
Exporter
Synopsis
No synopsis!
Description
No description!
Methods
_clustalw
No description
Code
Methods description
None available.
Methods code
_clustalwdescriptionprevnextTop
sub _clustalw {
    &opt_default(input=>"file",alnfile=>"clustalw.aln",dndfile=>"clustalw.dnd",output=>"f");
    my @args=opt_get(@_);

    my $input=&opt_val("input");
    my $alnfile=&opt_val("alnfile");
    my $dndfile=&opt_val("dndfile");
    my $output=&opt_val("output");
    my $seq;
    my @param;
    my $file;
    my %opt;
    my @aln;
    my @dnd;
    my $tmp;

    if($input eq 'seq'){
	$seq=shift @args;
	open(FILE,'>/tmp/tmp.clw');
	foreach(keys(%{$seq})){
	    print FILE '>',"$_","\n";
	    print FILE ${$seq}{$_},"\n\n";
	}
	close(FILE);
	$file="/tmp/tmp.clw"; 
    }
    else{
	$file=shift @args;
    }

    foreach(sort keys(%opt)){
	next if($opt{$_} eq '');
	push(@param,'-'.$_);
	push(@param,$opt{$_});
    }

    system('clustalw',"$file",@param);

    if($input eq 'seq'){
        unlink('/tmp/tmp.clw');
	if($output eq 'n'){	    
	    open(FILE,'/tmp/tmp.aln');
	    @aln=<FILE>;
	    close(FILE);
	    open(FILE,'/tmp/tmp.dnd');
	    @dnd=<FILE>;
	    close(FILE);
	    unlink('/tmp/tmp.aln');
	    unlink('/tmp/tmp.dnd');
	    return (\@aln,\@dnd);
	}
	else{
	    system('cp','/tmp/tmp.aln',"\.\/$alnfile");
	    system('cp','/tmp/tmp.dnd',"\.\/$dndfile");
	    unlink('/tmp/tmp.aln');
	    unlink('/tmp/tmp.dnd');
	}
    } 
    else{
	if($output eq "n"){
	    $tmp=substr($file,0,rindex($file,'.')).'.aln';
	    open(FILE,$tmp);
	    @aln=<FILE>;
	    close(FILE);
	    unlink("$tmp");
	    $tmp=substr($file,0,rindex($file,'.')).'.dnd';
	    open(FILE,$tmp);
	    @dnd=<FILE>;
	    close(FILE);
	    unlink("$tmp");
	    return (\@aln,\@dnd);
	}
    }

    return $file.' '.join(' ',@param);
}
General documentation
No general documentation available.