Hi there,
I am having trouble getting the makeid option work for my fasta db.
Here is the header of my the first sequence in my file.
>gi|149538895|ref|XP_001512649.1| PREDICTED: similar to Olfactory receptor 18 (Olfactory receptor 145-1) (Olfactory receptor TPCR34) [Ornithorhynchus anatinus]
What I want is to make the ids the gi number.
Any insight as to whats going wrong would be very appreciated! Thanks!
I am having trouble getting the makeid option work for my fasta db.
Here is the header of my the first sequence in my file.
>gi|149538895|ref|XP_001512649.1| PREDICTED: similar to Olfactory receptor 18 (Olfactory receptor 145-1) (Olfactory receptor TPCR34) [Ornithorhynchus anatinus]
What I want is to make the ids the gi number.
Code:
#!/usr/bin/perl use Bio::SeqIO; use Bio::Seq; use Bio::DB::Fasta; use Bio::PrimarySeq; use Bio::LocationI; use Bio::Tools::SeqWords; sub make_my_id(); #Directory of fasta files my $file = "/home/[user]/Desktop/Olfactory/Ornithorhynchus_anatinus_olfactory/ornithorhynchus_anatinus_sample.fasta"; ######################## With Subroutine ########################## my $db = Bio::DB::Fasta->new($file,-reindex, -makeid=>\&make_my_id); my @names = $db->ids; foreach (@names) {print $_, "\n";} #my $seq = $db->seq('149538895'); #print $seq, "\n\n"; ######Subroutines################# sub make_my_id { my $line = shift; # get a different id from the fasta header, e.g. $line =~ m/(\|.*?\|)/; my $ID = $1; $ID = substr($ID, 1, -1); #print $ID, "\n"; return $1; }
Comment