]> git.donarmstrong.com Git - biopieces.git/commitdiff
write_kiss now do blast output
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 13 Nov 2009 10:03:31 +0000 (10:03 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 13 Nov 2009 10:03:31 +0000 (10:03 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@759 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/KISS/IO.pm
code_perl/Maasha/KISS/Track.pm

index 965560f72165ccbb0bf5b9950a7e1c2b2117af2b..291749db54bd79dbfa1df4b1e4fddaaf2c3d82f3 100644 (file)
@@ -107,22 +107,28 @@ sub kiss_entry_put
     
     my ( @fields );
 
-    $fh ||= \*STDOUT;
-
-    $fields[ S_ID ]        = $entry->{ 'S_ID' };
-    $fields[ S_BEG ]       = $entry->{ 'S_BEG' };
-    $fields[ S_END ]       = $entry->{ 'S_END' };
-    $fields[ Q_ID ]        = $entry->{ 'Q_ID' };
-    $fields[ SCORE ]       = $entry->{ 'SCORE' };
-    $fields[ STRAND ]      = $entry->{ 'STRAND' };
-    $fields[ HITS ]        = $entry->{ 'HITS' };
-    $fields[ ALIGN ]       = $entry->{ 'ALIGN' };
-    $fields[ BLOCK_COUNT ] = $entry->{ 'BLOCK_COUNT' };
-    $fields[ BLOCK_BEGS ]  = $entry->{ 'BLOCK_BEGS' };
-    $fields[ BLOCK_LENS ]  = $entry->{ 'BLOCK_LENS' };
-    $fields[ BLOCK_TYPE ]  = $entry->{ 'BLOCK_TYPE' };
-
-    print $fh join( "\t", @fields ), "\n";
+    if ( defined $entry->{ 'S_ID' } and 
+         defined $entry->{ 'S_BEG' } and
+         defined $entry->{ 'S_END' }
+       )
+    {
+        $fh ||= \*STDOUT;
+    
+        $fields[ S_ID ]        = $entry->{ 'S_ID' };
+        $fields[ S_BEG ]       = $entry->{ 'S_BEG' };
+        $fields[ S_END ]       = $entry->{ 'S_END' };
+        $fields[ Q_ID ]        = $entry->{ 'Q_ID' };
+        $fields[ SCORE ]       = $entry->{ 'SCORE' };
+        $fields[ STRAND ]      = $entry->{ 'STRAND' };
+        $fields[ HITS ]        = $entry->{ 'HITS' };
+        $fields[ ALIGN ]       = $entry->{ 'ALIGN' };
+        $fields[ BLOCK_COUNT ] = $entry->{ 'BLOCK_COUNT' };
+        $fields[ BLOCK_BEGS ]  = $entry->{ 'BLOCK_BEGS' };
+        $fields[ BLOCK_LENS ]  = $entry->{ 'BLOCK_LENS' };
+        $fields[ BLOCK_TYPE ]  = $entry->{ 'BLOCK_TYPE' };
+
+        print $fh join( "\t", @fields ), "\n";
+    }
 }
 
 
@@ -345,6 +351,7 @@ sub biopiece2kiss
     my ( $record,   # Biopiece record
        ) = @_;
 
+    $record->{ 'SCORE' }       ||= $record->{ 'E_VAL' } || ".";
     $record->{ 'HITS' }        ||= ".";
     $record->{ 'BLOCK_COUNT' } ||= ".";
     $record->{ 'BLOCK_BEGS' }  ||= ".";
index a815dfef312b3bc9e42524bacd7ca88c8caf86b8..15007e20d13f2b6282e2279c851773402c5d0a2a 100644 (file)
@@ -31,6 +31,7 @@ package Maasha::KISS::Track;
 use warnings;
 use strict;
 use Data::Dumper;
+use Maasha::Common;
 use Maasha::Calc;
 use vars qw( @ISA @EXPORT );
 
@@ -192,7 +193,7 @@ sub feature_align
     {
         foreach $align ( split /,/, $entry->{ 'ALIGN' } )
         {
-            if ( $align =~ /(\d+):(\w)>(\w)/ )
+            if ( $align =~ /(\d+):([ATCGN-])>([ATCGN-])/ )
             {
                 $pos       = $1;
                 $nt_before = $2;
@@ -200,7 +201,7 @@ sub feature_align
             }
             else
             {
-                die;
+                Maasha::Common::error( qq(BAD align descriptor: "$align") );
             }
 
             $x1 = sprintf( "%.0f", ( $entry->{ 'S_BEG' } + $pos - $beg ) * $factor );