Difference between revisions of "NameIssue"

From Phyloinformatics
Jump to: navigation, search
 
m
Line 1: Line 1:
 +
###Two new Bio::SimpleAlign methods are written & tested: "$aln->set_displayname_safe" (assign serial names to sequences & store/resturn original names in a hash) and "$aln->restore_displayname". New files: SimpleAlign.pm and SimpleAlign.t
 +
###A use case: Run Phylip::SeqBoot while preserving names
 +
 
<perl>
 
<perl>
 
#!/usr/bin/perl -w
 
#!/usr/bin/perl -w

Revision as of 12:40, 15 December 2006

      1. Two new Bio::SimpleAlign methods are written & tested: "$aln->set_displayname_safe" (assign serial names to sequences & store/resturn original names in a hash) and "$aln->restore_displayname". New files: SimpleAlign.pm and SimpleAlign.t
      2. A use case: Run Phylip::SeqBoot while preserving names

<perl>

  1. !/usr/bin/perl -w
  2. Run SeqBoot (Phylip) without

use Bio::AlignIO; use Bio::Tools::Run::Phylo::Phylip::SeqBoot; use Data::Dumper;

my $long_name_file=shift @ARGV; my $in=new Bio::AlignIO(-file=>$long_name_file); my $aln=$in->next_aln();

  1. my ($aln2,$ref_name)=$aln->set_displayname_safe();
  2. print Dumper($ref_name);

my @params = ('datatype'=>'SEQUENCE','replicates'=>5); my $seq = Bio::Tools::Run::Phylo::Phylip::SeqBoot->new(@params);

  1. my $aln_ref = $seq->run($aln2);

my ($aln_ref, $name_ref) = $seq->run($aln);

  1. my $aio = Bio::AlignIO->new(-format=>"phylip");

my $aio = Bio::AlignIO->new(-format=>"fasta");

  1. $aln->set_displayname_flat();
  2. my $aio = Bio::AlignIO->new(-file=>">alignment.bootstrap.new",-format=>"clustalw");

foreach my $ai(@{$aln_ref}){

  1. $aio->write_aln($ai->restore_displayname($name_ref));
 foreach my $seq ($ai->each_seq()) {
   print $seq->id(), "\n";
 }
 print "\n";
 $ai=$ai->restore_displayname($name_ref);
 foreach my $seq ($ai->each_seq()) {
   print $seq->id(), "\n";
 }
 print "===\n"
  1. $aio->write_aln($ai);

} </perl>