[Bioperl-guts-l] [14824] bioperl-run/trunk/Bio/Tools/Run/Alignment/Clustalw.pm: * add_sequences option (adds sequences to an alignment) - bug 2562

Christopher John Fields cjfields at dev.open-bio.org
Fri Aug 22 14:02:21 EDT 2008


Revision: 14824
Author:   cjfields
Date:     2008-08-22 14:02:21 -0400 (Fri, 22 Aug 2008)

Log Message:
-----------
* add_sequences option (adds sequences to an alignment) - bug 2562

Modified Paths:
--------------
    bioperl-run/trunk/Bio/Tools/Run/Alignment/Clustalw.pm

Modified: bioperl-run/trunk/Bio/Tools/Run/Alignment/Clustalw.pm
===================================================================
--- bioperl-run/trunk/Bio/Tools/Run/Alignment/Clustalw.pm	2008-08-22 14:57:17 UTC (rev 14823)
+++ bioperl-run/trunk/Bio/Tools/Run/Alignment/Clustalw.pm	2008-08-22 18:02:21 UTC (rev 14824)
@@ -540,7 +540,43 @@
     my $aln = $self->_run('profile-aln', $infilename1, $infilename2, $param_string);
 }
 
+=head2  add_sequences
 
+ Title   : add_sequences
+ Usage   :
+ Function: Align and add sequences into an alignment
+ Example :
+ Returns : Reference to a SimpleAlign object containing the (super)alignment.
+ Args    : Names of 2 files, the first one containing an alignment and the second one containing sequences to be added
+         or references to 2 Bio::SimpleAlign objects.
+
+Throws an exception if arguments are not either strings (eg filenames)
+or references to SimpleAlign objects.
+
+
+=cut
+
+sub add_sequences {
+
+    my ($self,$input1,$input2) = @_;
+    my ($temp,$infilename1,$infilename2,$input,$seq);
+    
+    $self->io->_io_cleanup();
+    # Create input file pointer
+    $infilename1 = $self->_setinput($input1,1);
+    $infilename2 = $self->_setinput($input2,2);
+    if (!$infilename1 || !$infilename2) {$self->throw("Bad input data: $input1 or $input2 !");}
+    unless ( -e $infilename1 and -e  $infilename2) {$self->throw("Bad input file: $input1 or $input2 !");}
+    
+    
+    # Create parameter string to pass to clustalw program
+    my $param_string = $self->_setparams();
+    # run clustalw
+    my $aln = $self->_run('add_sequences', $infilename1,
+    $infilename2, $param_string);
+
+}
+
 =head2  tree
 
  Title   : tree
@@ -672,6 +708,12 @@
     	$command = '-profile';
     }
     
+    if ($command =~ /add_sequences/) {
+      $instring =  "-profile1=$infile1  -profile2=$infile2";
+      chmod 0777, $infile1,$infile2;
+      $command = '-sequences';
+    }
+
     if ($command =~ /tree/) {
     	if( $^O eq 'dec_osf' ) {
             $instring =  $infile1;




More information about the Bioperl-guts-l mailing list