[Bioperl-l] names/id in multi-alignment files
martin
s9904982 at sms.ed.ac.uk
Thu Sep 23 04:24:32 EDT 2004
Hi,
In your code, you're treating $seq as a string; actually its a Bio::Seq
object. Something like this should work:
$str = Bio::AlignIO->new('-file' => $filename);
$aln = $str->next_aln;
foreach $seq ($aln->each_seq){
print $seq->display_id, "\n";
}
calling the display_id method on a Bio::Seq object returns the name/
Hope this helps
Martin
On Thu, 2004-09-23 at 03:29, Marco Landwehr wrote:
> Hi,
> when reading in s multi alignment file of the fasta format:
>
> #read in alignment
> $str = Bio::AlignIO->new('-file' => $filename);
> $aln = $str->next_aln();
>
> I cannot extract the "header" name or id with:
>
> foreach $seq ($aln->id()){
> print $seq,"\n";
> }
>
> Is there a way to do this?
> When using:
>
> #alternative way to read all sequences from multi fasta file
> @seq_object_array = read_all_sequences($filename,'fasta');
>
> I can get the name of a specific sequence with:
> $seq_object_array[$i]
>
> but I dont want to read in the sequences both ways...
>
> Thanks for you help...
>
> Marco
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
--
Martin Jones
Blaxter Nematode Genomics Group
School of Biological Sciences
Ashworth Laboratories
University of Edinburgh
Edinburgh
EH9 3JT
UK
tel: +44 131 650 7403
web: www.nematodes.org
More information about the Bioperl-l
mailing list