From: martinahansen Date: Fri, 13 Nov 2009 10:03:31 +0000 (+0000) Subject: write_kiss now do blast output X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0de17040610b3d1a5039d0df29ba5cca571ab8d8;p=biopieces.git write_kiss now do blast output git-svn-id: http://biopieces.googlecode.com/svn/trunk@759 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_perl/Maasha/KISS/IO.pm b/code_perl/Maasha/KISS/IO.pm index 965560f..291749d 100644 --- a/code_perl/Maasha/KISS/IO.pm +++ b/code_perl/Maasha/KISS/IO.pm @@ -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' } ||= "."; diff --git a/code_perl/Maasha/KISS/Track.pm b/code_perl/Maasha/KISS/Track.pm index a815dfe..15007e2 100644 --- a/code_perl/Maasha/KISS/Track.pm +++ b/code_perl/Maasha/KISS/Track.pm @@ -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 );