[Bioperl-l] newbie needs help with "preferred_id_type"
Cook, Malcolm
MEC at Stowers-Institute.org
Tue Apr 5 13:08:38 EDT 2005
hmmm - this is new to me
let's see, on my bioperl 1.5 installation, the unix one-liner
perl -MBio::SeqIO::fasta -e 'print "@Bio::SeqIO::fasta::SEQ_ID_TYPES"'
returns
accession accession.version display primary
so, I think you should be able to add, for instance
$seq->preferred_id_type('display')
or, in your case
$seq->preferred_id_type('accession')
just before your call to write_seq
try it!
Malcolm Cook - mec at stowers-institute.org - 816-926-4449
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, MO USA
-----Original Message-----
From: bioperl-l-bounces at portal.open-bio.org
[mailto:bioperl-l-bounces at portal.open-bio.org] On Behalf Of Jonathan
Miller
Sent: Monday, April 04, 2005 6:45 PM
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] newbie needs help with "preferred_id_type"
Below, I want write_seq to use the accession,
rather than the default.
---------------------------------------------
#!/usr/bin/perl
use Bio::SeqIO;
my $infile=shift;
$in = Bio::SeqIO->new(-file => $infile,
-format => 'GenBank');
my $outfile= ">" . $infile . ".fa";
$out = Bio::SeqIO->new(-file => $outfile,
-format => 'fasta'
);
while ( $seq = $in->next_seq() ) {
print $seq->accession,"\n";
$out->write_seq($seq);
}
------------------------------------------------
So, Going to the Bio::Seq docs, I see:
---------------------------------------------------------
preferred_id_type code top prev next
Title : preferred_id_type
Usage : $obj->preferred_id_type('accession')
Function: Get/Set the preferred type of identifier to use in the ">ID"
position
for FASTA output.
Returns : string, one of values defined in
@Bio::SeqIO::fasta::SEQ_ID_TYPES.
Default = $Bio::SeqIO::fasta::DEFAULT_SEQ_ID_TYPE
('display').
Args : string when setting. This must be one of values defined in
@Bio::SeqIO::fasta::SEQ_ID_TYPES. Allowable values:
accession, accession.version, display, primary
Throws : fatal exception if the supplied id type is not in
@SEQ_ID_TYPES.
----------------------------------------------------------
but I have so far been unable to figure out how in fact to
set the SEQ_ID_TYPE .
_______________________________________________
Bioperl-l mailing list
Bioperl-l at portal.open-bio.org
http://portal.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list