X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Ffind_gaps;h=ade831ad9c9e1d28060050bec35a850a8cb4572a;hb=658943d07afe151e66c8ddfa0fc1708a48515f9d;hp=b39b22b0dd0570189f75ce1506a7ae8891f87923;hpb=cd6541f8b0c481181ebcf55be5aecf82001744f1;p=biopieces.git diff --git a/bp_bin/find_gaps b/bp_bin/find_gaps index b39b22b..ade831a 100755 --- a/bp_bin/find_gaps +++ b/bp_bin/find_gaps @@ -47,6 +47,8 @@ $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } ); while ( $record = Maasha::Biopieces::get_record( $in ) ) { + Maasha::Biopieces::put_record( $record, $out ); + if ( exists $record->{ 'SEQ' } ) { $gaps = find_gaps( $record->{ 'SEQ' }, $options->{ 'min_len' } ); @@ -58,8 +60,6 @@ while ( $record = Maasha::Biopieces::get_record( $in ) ) Maasha::Biopieces::put_record( $gap, $out ); } } - - Maasha::Biopieces::put_record( $record, $out ); } Maasha::Biopieces::close_stream( $in ); @@ -83,11 +83,13 @@ sub find_gaps # Returns a list. - my ( @gaps, $block, $beg, $end ); + my ( $gap_char, @gaps, $block, $beg, $end ); + + $gap_char = 'N'; $seq = uc $seq; - $block = 'N' x $min; + $block = $gap_char x $min; $beg = 0; @@ -99,13 +101,14 @@ sub find_gaps $end = $beg; - while ( substr( $seq, $end, 1 ) eq 'N' ) { + while ( substr( $seq, $end, 1 ) eq $gap_char ) { $end++; } push @gaps, { S_BEG => $beg, S_END => $end - 1, + S_LEN => $end - $beg, }; $beg = $end + 1;