# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $options, $in, $out, $record, $tmp_dir, $tmp_file, $fh_out, $fh_in, $entry, $chunk, @lines, $line, $s_id, $type, $s_beg, $s_end, $strand, @fields );
+my ( $options, $in, $out, $record, $tmp_dir, $tmp_file, $fh_out, $fh_in, $entry, $chunk, @lines, $line, $s_id, $type, $s_beg, $s_end, $strand, @fields, $def );
$options = Maasha::Biopieces::parse_options();
Maasha::Biopieces::put_record( $record, $out );
}
-Maasha::Common::run( "draft_prodigal.pl", "< $tmp_file > $tmp_file.out 2> /dev/null" );
+if ( $options->{ 'verbise' } ) {
+ Maasha::Common::run( "prodigal", "< $tmp_file > $tmp_file.out" );
+} else {
+ Maasha::Common::run( "prodigal", "< $tmp_file > $tmp_file.out 2> /dev/null" );
+}
$fh_in = Maasha::Filesys::file_read_open( "$tmp_file.out" );
$line = shift @lines;
- if ( $line =~ /.*>(.+)/ )
+ if ( $line =~ /^DEFINITION\s+(.+)/ )
{
- $s_id = $1;
-
- foreach $line ( @lines )
- {
- @fields = split " ", $line;
+ $def = $1;
- $type = $fields[ 0 ];
+ if ( $def =~ /seqhdr="([^"]+)"/ ) {
+ $s_id = $1;
+ } else {
+ Maasha::Common::error( qq(BAD sequence header: $def) );
+ }
- if ( $fields[ 1 ] =~ /complement/ ) {
- $strand = "-";
- } else {
- $strand = "+";
- }
+ $line = shift @lines;
- if ( $fields[ 1 ] =~ /(\d+)\.\.>?(\d+)/ )
- {
- $s_beg = $1;
- $s_end = $2;
- }
- else
+ if ( $line =~ /^FEATURES/ )
+ {
+ foreach $line ( @lines )
{
- Maasha::Common::error( qq(BAD locator: $line) );
+ next if $line =~ /.+\//;
+
+ @fields = split " ", $line;
+
+ $type = $fields[ 0 ];
+
+ if ( $fields[ 1 ] =~ /complement/ ) {
+ $strand = "-";
+ } else {
+ $strand = "+";
+ }
+
+ if ( $fields[ 1 ] =~ /(\d+)\.\.>?(\d+)/ )
+ {
+ $s_beg = $1;
+ $s_end = $2;
+ }
+ else
+ {
+ Maasha::Common::error( qq(BAD locator: $line) );
+ }
+
+ $record = {
+ S_ID => $s_id,
+ S_BEG => $s_beg - 1,
+ S_END => $s_end - 1,
+ Q_ID => $type,
+ STRAND => $strand,
+ };
+
+ Maasha::Biopieces::put_record( $record, $out );
}
-
- $record = {
- S_ID => $s_id,
- S_BEG => $s_beg - 1,
- S_END => $s_end - 1,
- Q_ID => $type,
- STRAND => $strand,
- };
-
- Maasha::Biopieces::put_record( $record, $out );
+ }
+ else
+ {
+ Maasha::Common::error( qq(BAD feature: $line) );
}
}
else
{
- Maasha::Commom::error( qq(BAD definition: $line) );
+ Maasha::Common::error( qq(BAD definition: $line) );
}
}