@options = qw(
adaptor|a=s
mismatches|m=s
- no_remove|n
+ remove|r=s
offset|o=s
);
}
{
Maasha::Common::error( qq(Argument to --$opt must be octal or decimal - not "$options{ $opt }") );
}
+ elsif ( $opt eq "remove" and $script eq "remove_adaptor" and $options{ $opt } !~ /before|after|skip/ )
+ {
+ Maasha::Common::error( qq(Argument to --$opt must be before, after, or skip - not "$options{ $opt }") );
+ }
}
Maasha::Common::error( qq(no --database specified) ) if $script eq "create_blast_db" and not $options{ "database" };
my ( $record, $adaptor, $seq, $adaptor_len, $seq_len, $offset, $max_match, $max_mismatch, $pos );
+ $options->{ "remove" } ||= "after";
+
$max_mismatch = $options->{ "mismatches" } || 0;
$offset = $options->{ "offset" };
$record->{ "ADAPTOR_POS" } = $pos;
- if ( $pos >= 0 and not $options->{ "no_remove" } )
+ if ( $pos >= 0 and $options->{ "remove" } ne "skip" )
{
- $record->{ "SEQ" } = substr $record->{ "SEQ" }, 0, $pos;
- $record->{ "SEQ_LEN" } = $pos;
+ if ( $options->{ "remove" } eq "after" )
+ {
+ $record->{ "SEQ" } = substr $record->{ "SEQ" }, 0, $pos;
+ $record->{ "SEQ_LEN" } = $pos;
+ }
+ else
+ {
+ $record->{ "SEQ" } = substr $record->{ "SEQ" }, $pos + $adaptor_len;
+ $record->{ "SEQ_LEN" } = length $record->{ "SEQ" };
+ }
}
put_record( $record, $out );
while ( $record = get_record( $in ) )
{
- $data_hash{ $record->{ $options->{ "key" } } }++ if $record->{ $options->{ "key" } };
+ $data_hash{ $record->{ $options->{ "key" } } }++ if defined $record->{ $options->{ "key" } };
put_record( $record, $out ) if not $options->{ "no_stream" };
}
while ( $record = get_record( $in ) )
{
- $data_hash{ $record->{ $options->{ "key" } } }++ if $record->{ $options->{ "key" } };
+ $data_hash{ $record->{ $options->{ "key" } } }++ if defined $record->{ $options->{ "key" } };
put_record( $record, $out ) if not $options->{ "no_stream" };
}