[Bioperl-l] Wanting to inject date into a SeqIO object

Mark A. Jensen maj at fortinbras.us
Mon Feb 9 12:19:37 EST 2009


Hi Dave, 
One way to do it-
You could tack the date onto the 'description' field:

$inseq->desc( $inseq->desc . " {date: $DATE_FROM_DB}" );

And later do

($our_date) = ($inseq->desc =~ /{date: ([^}]+)}/);

to retrieve it. If it screws up downstream processing, get the date first
as above and then do

my $desc = $inseq->desc;
$desc =~ s/{date:.*?}//;
$inseq->desc($desc);

(or something like that...) to reset to "factory description". 
cheers
MAJ
----- Original Message ----- 
From: "Dave Jacoby" <jacoby at purdue.edu>
To: "BioPerl-L" <bioperl-l at lists.open-bio.org>
Sent: Monday, February 09, 2009 11:54 AM
Subject: [Bioperl-l] Wanting to inject date into a SeqIO object


> I'm working with a database full of transposable elements. We input 
> things in FASTA format, and save the date of the upload into the 
> database separately. When we want to display in GCG format, 
> specifically, Bio::SeqIO::gcg can't find a date in the object and uses 
> the current date. Using a line out of the x2y.pl example from the wiki,
> we would like to go from this:
> 
>          while (my $inseq = $seq_in->next_seq) {
>             $seq_out->write_seq($inseq);
>          }
> 
> to
>          while (my $inseq = $seq_in->next_seq) {
>             $inseq->add_date($DATE_FROM_DB) ;
>             $seq_out->write_seq($inseq);
>          }
> 
> I have looked through the modules in Bio::SeqIO and I fail to understand 
> how to do such a thing. Can anyone help me?
> 
> -- 
> Dave Jacoby                         Address: WSLR S049
> Purdue Genomics Core                Mail:    jacoby at purdue.edu
>                                     Jabber:  jacoby at jabber.org
>                                     Phone:   hah!
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
>


More information about the Bioperl-l mailing list