X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fanalyze_gc;h=8c0790f80db27e32dfc1df7095142f5e56682cbd;hb=801e0b96e0ac9ffb02f193e8432c021c92cbf78c;hp=491112459f7f8829f45edd0cbc7f4ebdc6bcd6f2;hpb=d55eed52586fe52477168339231f52783379ad7b;p=biopieces.git diff --git a/bp_bin/analyze_gc b/bp_bin/analyze_gc index 4911124..8c0790f 100755 --- a/bp_bin/analyze_gc +++ b/bp_bin/analyze_gc @@ -36,7 +36,7 @@ use Maasha::Biopieces; # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -my ( $options, $in, $out, $record, $gc ); +my ( $options, $in, $out, $record, $gc_count, $gc_percent ); $options = Maasha::Biopieces::parse_options(); @@ -45,7 +45,13 @@ $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } ); while ( $record = Maasha::Biopieces::get_record( $in ) ) { - $record->{ 'GC%' } = sprintf( "%.2f", ( $record->{ "SEQ" } =~ tr/GgCc// / length $record->{ "SEQ" } ) * 100 ) if $record->{ "SEQ" }; + if ( $record->{ "SEQ" } ) + { + $gc_count = $record->{ "SEQ" } =~ tr/GgCc//; + $gc_percent = ( $gc_count / length $record->{ "SEQ" } ) * 100; + $record->{ 'GC%' } = sprintf( "%.2f", $gc_percent ); +# $record->{ 'GC%' } = int $gc_percent; + } Maasha::Biopieces::put_record( $record, $out ); }