X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Frescan_seq;h=826a1f233da5d0a4c2ee1249e25da3643a90dd36;hb=48bea5c28b89dc5586d0bddb338ccd6ba23aa1f9;hp=22e0596480f8b654ab3b8e5f3edf41c057224227;hpb=cdd1aa98d4e29baa49ed44a28d6e16d3fb77f49a;p=biopieces.git diff --git a/bp_bin/rescan_seq b/bp_bin/rescan_seq index 22e0596..826a1f2 100755 --- a/bp_bin/rescan_seq +++ b/bp_bin/rescan_seq @@ -37,13 +37,14 @@ use Maasha::Patscan; # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -my ( $options, $in, $out, $record, $re_data, $re, $matches, $match, %re_hash, $res_enz ); +my ( $options, $in, $out, $record, $re_data, $re, $matches, $match, %re_hash, $res_enz, $new_record ); $options = Maasha::Biopieces::parse_options( [ - { long => 'res_enz', short => 'r', type => 'list', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, - { long => 'res_enz_in', short => 'R', type => 'file!', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, - { long => 'no_matches', short => 'M', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, + { long => 'res_enz', short => 'r', type => 'list', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, + { long => 'res_enz_in', short => 'R', type => 'file!', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, + { long => 'res_enz_only', short => 'o', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, + { long => 'no_matches', short => 'M', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, ] ); @@ -70,15 +71,16 @@ while ( $record = Maasha::Biopieces::get_record( $in ) ) $matches = Maasha::RestrictEnz::re_scan( $record->{ 'SEQ' }, $re ); - if ( scalar @{ $matches } > 0 ) - { - $record->{ $re->{ 'name' } . "_COUNT" } = scalar @{ $matches }; - $record->{ $re->{ 'name' } . "_MATCHES" } = join( ";", @{ $matches } ) if not $options->{ 'no_matches' }; - } + %{ $new_record } = %{ $record } if not $options->{ 'res_enz_only' }; + $new_record->{ 'RE' } = $re->{ 'name' }; + $new_record->{ 'RE_COUNT' } = scalar @{ $matches }; + $new_record->{ 'RE_MATCHES' } = join( ";", @{ $matches } ) if not $options->{ 'no_matches' }; + + Maasha::Biopieces::put_record( $new_record, $out ); } } - Maasha::Biopieces::put_record( $record, $out ); + # Maasha::Biopieces::put_record( $record, $out ); } Maasha::Biopieces::close_stream( $in );