]> git.donarmstrong.com Git - biopieces.git/commitdiff
added splice to get_genome_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 9 Dec 2008 04:17:24 +0000 (04:17 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 9 Dec 2008 04:17:24 +0000 (04:17 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@346 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm

index 41199b3d36b396a2c2146414c32624ada9386541..3d5d994d2127daf95985029c2dd35e0852e24518 100644 (file)
@@ -511,6 +511,7 @@ sub get_options
             len|l=s
             flank|f=s
             mask|m
+            splice|s
         );
     }
     elsif ( $script eq "get_genome_align" )
@@ -2988,7 +2989,7 @@ sub script_get_genome_seq
 
     # Returns nothing.
 
-    my ( $record, $genome, $genome_file, $index_file, $index, $fh, $index_head, $index_beg, $index_len, $beg, $len, %lookup_hash, @begs, @lens, $i );
+    my ( $record, $genome, $genome_file, $index_file, $index, $fh, $index_head, $index_beg, $index_len, $beg, $len, %lookup_hash, @begs, @lens, $i, $seq );
 
     $options->{ "flank" } ||= 0;
 
@@ -3094,18 +3095,31 @@ sub script_get_genome_seq
 
             if ( $options->{ "mask" } )
             {
-                if ( $record->{ "BLOCKCOUNT" } > 1 ) # uppercase hit block segments and lowercase the rest.
+                if ( $record->{ "BLOCK_COUNT" } > 1 ) # uppercase hit block segments and lowercase the rest.
                 {
                     $record->{ "SEQ" } = lc $record->{ "SEQ" };
                 
                     @begs = split ",", $record->{ "Q_BEGS" };
-                    @lens = split ",", $record->{ "BLOCKSIZES" };
+                    @lens = split ",", $record->{ "BLOCK_LENS" };
 
                     for ( $i = 0; $i < @begs; $i++ ) {
                         substr $record->{ "SEQ" }, $begs[ $i ], $lens[ $i ], uc substr $record->{ "SEQ" }, $begs[ $i ], $lens[ $i ];
                     }
                 }
             }
+            elsif ( $options->{ "splice" } )
+            {
+                if ( $record->{ "BLOCK_COUNT" } > 1 ) # splice block sequences
+                {
+                    $seq  = "";
+                    @begs = split ",", $record->{ "Q_BEGS" };
+                    @lens = split ",", $record->{ "BLOCK_LENS" };
+
+                    for ( $i = 0; $i < @begs; $i++ ) {
+                        $seq .= substr $record->{ "SEQ" }, $begs[ $i ], $lens[ $i ];
+                    }
+                }
+            }
         }
 
         put_record( $record, $out );