[Bioperl-l] build Align object from scratch?

Jason Stajich jason.stajich at duke.edu
Sat Sep 4 17:16:06 EDT 2004


So you want to use the code in Bio::AlignIO::fasta as your guide here.  
If you just follow what is going on in next_aln you'll see how a 
sequence is parsed, built into a sequence object, and added to a 
SimpleAlign object.

The basics:
# create an alignment object to hold the aligned sequences
my $aln = Bio::SimpleAlign->new();

# create a sequence object
  my $seq = Bio::LocatableSeq->new(-start => $start, -end => $end, -seq 
=> $seqwithgaps,
                                                                   
-description => $mydesc,
                                                                   
-display_id=> $displayid);
# add it to the alignment
$aln->add_seq($seq);


Add all your seqs and you have an alignment reconstituted from your 
database.

-jason

On Sep 5, 2004, at 6:48 AM, Fernan Aguero wrote:

> Hi!
>
> is it possible to build an alignment object without reading an
> alignment from a file, a filehandle etc?
>
> I'm reading the pods for AlignIO, AlignI, SimpleAlign, etc
> and I don't see this as a possibility.
>
> What I'm doing is reading gapped sequences from tables in
> a MySQL database (i.e. already aligned sequences). I need to
> recreate the alignment in my program to then take some
> portions of these sequences based on their overlappings.
>
> Examples of the kind of sequences that I'll be reading are:
>
> ATGGTATGGAGTGATGAGTGTGTGA
> ----TATGGAGTGATGAGT------
> ATGGTATGGAGTG------------
> --------------TGAGTGTGTGA
>
> Essentially this looks like an aligned FASTA ... of course I
> could write an alignment in this format to a tmp file and
> then read it again using AlignIO ... but given that I
> already have this info available to my program, I just
> thought this was not the most elegant way to do it.
>
> Is there another?
>
> thanks in advance for any tip,
>
> Fernan
>
> -- 
> Fernan Aguero -  fernan at iib.unsam.edu.ar
> Phone: +54 11 4580-7255/7 ext 310, Fax: +54 11 4752-9639
> Check http://genoma.unsam.edu.ar/~fernan for more info.
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
--
Jason Stajich
jason.stajich at duke.edu
http://www.duke.edu/~jes12/



More information about the Bioperl-l mailing list