}
+sub biopiece2fasta
+{
+ # Martin A. Hansen, July 2008.
+
+ # Given a biopiece record converts it to a FASTA record.
+ # If no generic SEQ or SEQ_NAME is found, the Q_* and S_* are
+ # tried in that order.
+
+ my ( $record, # record
+ ) = @_;
+
+ # Returns a tuple.
+
+ my ( $seq_name, $seq );
+
+ $seq_name = $record->{ "SEQ_NAME" } || $record->{ "Q_ID" } || $record->{ "S_ID" };
+ $seq = $record->{ "SEQ" } || $record->{ "Q_SEQ" } || $record->{ "S_SEQ" };
+
+ if ( defined $seq_name and defined $seq ) {
+ return wantarray ? ( $seq_name, $seq ) : [ $seq_name, $seq ];
+ } else {
+ return;
+ }
+}
+
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<