]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed a couple of bugs - good
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 4 Jun 2009 15:34:51 +0000 (15:34 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 4 Jun 2009 15:34:51 +0000 (15:34 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@474 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/align_seq
code_perl/Maasha/Align.pm
code_perl/Maasha/Solexa.pm

index e34759a9c34472058382d2587faf567904a2ef56..86ea57763f23f12d6e89d08188fb46a10e6593be 100755 (executable)
@@ -66,6 +66,7 @@ foreach $entry ( @entries )
         $record = {
             SEQ_NAME => $entry->[ SEQ_NAME ],
             SEQ      => $entry->[ SEQ ],
+            SEQ_LEN  => length $entry->[ SEQ ],
         };
 
         Maasha::Biopieces::put_record( $record, $out );
index 986a9b7a9bd1246619cd14d547ee754860685ea3..caf1eef47d7bc4e7ee5509ee149957e0cb6b25b6 100644 (file)
@@ -38,8 +38,8 @@ use Maasha::Seq;
 use vars qw ( @ISA @EXPORT );
 
 use constant {
-    HEAD  => 0,
-    SEQ   => 1,
+    SEQ_NAME => 0,
+    SEQ      => 1,
 };
 
 @ISA = qw( Exporter );
@@ -157,7 +157,7 @@ sub align_print_multi
     $consensus = align_consensus( $entries ) if not $no_cons;
 
     unshift @{ $entries }, $ruler if not $no_ruler;
-    push    @{ $entries }, $consensus;
+    push    @{ $entries }, $consensus if not $no_cons;
 
     align_print( $entries, $fh, $wrap );
 }
@@ -180,7 +180,7 @@ sub align_print
 
     $max = 0;
 
-    map { $max = length $_->[ HEAD ] if length $_->[ HEAD ] > $max } @{ $entries };
+    map { $max = length $_->[ SEQ_NAME ] if length $_->[ SEQ_NAME ] > $max } @{ $entries };
 
     $blocks = align_wrap( $entries, $wrap );
 
@@ -188,12 +188,12 @@ sub align_print
     {
         foreach $entry ( @{ $block } )
         {
-            $entry->[ HEAD ] =~ s/stats|ruler|consensus//;                                                                          
+            $entry->[ SEQ_NAME ] =~ s/stats|ruler|consensus//;                                                                          
 
             if ( $fh ) {
-                print $fh $entry->[ HEAD ], " " x ( $max + 3 - length $entry->[ HEAD ] ), $entry->[ SEQ ], "\n";                                 
+                print $fh $entry->[ SEQ_NAME ], " " x ( $max + 3 - length $entry->[ SEQ_NAME ] ), $entry->[ SEQ ], "\n";                                 
             } else {
-                print $entry->[ HEAD ], " " x ( $max + 3 - length $entry->[ HEAD ] ), $entry->[ SEQ ], "\n";                                 
+                print $entry->[ SEQ_NAME ], " " x ( $max + 3 - length $entry->[ SEQ_NAME ] ), $entry->[ SEQ ], "\n";                                 
             }
         }
     }
@@ -225,7 +225,7 @@ sub align_wrap
 
         for ( $c = 0; $c < @{ $entries }; $c++ )
         {
-            if ( $entries->[ $c ]->[ HEAD ] eq "ruler" )
+            if ( $entries->[ $c ]->[ SEQ_NAME ] eq "ruler" )
             {
                 $ruler = substr $entries->[ $c ]->[ SEQ ], $i, $wrap;
 
@@ -241,7 +241,7 @@ sub align_wrap
             }
             else
             {
-                push @lines, [ $entries->[ $c ]->[ HEAD ], substr $entries->[ $c ]->[ SEQ ], $i, $wrap ];
+                push @lines, [ $entries->[ $c ]->[ SEQ_NAME ], substr $entries->[ $c ]->[ SEQ ], $i, $wrap ];
             }
         }
 
@@ -402,7 +402,7 @@ sub align_consensus
         }
     }
 
-    $entry->[ HEAD ] = "Consensus: $min_sim%";
+    $entry->[ SEQ_NAME ] = "Consensus: $min_sim%";
 
     return wantarray ? @{ $entry } : $entry;
 }
@@ -462,8 +462,8 @@ sub align_tile
     # using pairwise alignments. The result is returned as a list of
     # aligned FASTA entries.
     
-    my ( $ref_entry,   # reference entry as [ HEAD, SEQ ] tuple
-         $q_entries,   # list of [ HEAD, SEQ ] tuples
+    my ( $ref_entry,   # reference entry as [ SEQ_NAME, SEQ ] tuple
+         $q_entries,   # list of [ SEQ_NAME, SEQ ] tuples
          $args,        # argument hash
        ) = @_;
 
@@ -487,8 +487,8 @@ sub align_tile
             Maasha::Common::error( qq(Bad sequence type->$type) );
         }
 
-        $align1 = Maasha::Align::align_muscle( [ $ref_entry, [ $entry->[ HEAD ] . "_+", $seq1 ] ], "-quiet -maxiters 1" );
-        $align2 = Maasha::Align::align_muscle( [ $ref_entry, [ $entry->[ HEAD ] . "_-", $seq2 ] ], "-quiet -maxiters 1" );
+        $align1 = Maasha::Align::align_muscle( [ $ref_entry, [ $entry->[ SEQ_NAME ] . "_+", $seq1 ] ], "-quiet -maxiters 1" );
+        $align2 = Maasha::Align::align_muscle( [ $ref_entry, [ $entry->[ SEQ_NAME ] . "_-", $seq2 ] ], "-quiet -maxiters 1" );
 
         if ( $args->{ "supress_indels" } )
         {
@@ -509,7 +509,7 @@ sub align_tile
 
             $align1->[ 1 ]->[ SEQ ] =~ s/-{$gaps}$// if $gaps;
             
-            $entry->[ HEAD ] = "$align1->[ 1 ]->[ HEAD ]_$sim1";
+            $entry->[ SEQ_NAME ] = "$align1->[ 1 ]->[ SEQ_NAME ]_$sim1";
             $entry->[ SEQ ]  = $align1->[ 1 ]->[ SEQ ];
 
             push @entries, $entry;
@@ -520,7 +520,7 @@ sub align_tile
 
             $align2->[ 1 ]->[ SEQ ] =~ s/-{$gaps}$// if $gaps;
 
-            $entry->[ HEAD ] = "$align2->[ 1 ]->[ HEAD ]_$sim2";
+            $entry->[ SEQ_NAME ] = "$align2->[ 1 ]->[ SEQ_NAME ]_$sim2";
             $entry->[ SEQ ]  = $align2->[ 1 ]->[ SEQ ];
 
             push @entries, $entry;
index d7c0d75af9a27c616e708304da819efaebab2fad..058a00a6a73322216abe41b25567391e6b1c446c 100644 (file)
@@ -29,6 +29,9 @@ package Maasha::Solexa;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use Maasha::Calc;
+use Data::Dumper;
+
 use vars qw( @ISA @EXPORT_OK );
 
 require Exporter;
@@ -153,8 +156,8 @@ sub solexa2biopiece
 
     # Converts a Solexa entry to a Biopiece record.
 
-    my ( $entry,      # Solexa entry
-         $qualilty,   # Quality cutoff
+    my ( $entry,     # Solexa entry
+         $quality,   # Quality cutoff
        ) = @_;
 
     # Returns a hashref.