SES took the words right out of my mouth. Without all of your code and information on the errors you are getting, it is difficult to help you beyond telling you what I did. For instance, did you read the next_result and next_hit, did you print the results? You may even be missing a BioPerl module, but without all the information no one will know. The BioPerl listserve folks are very helpful, but they will be adamant about including all your code and errors exactly as they come out.
Here's a link to the BioPerl-l listserve Info Page. You can email your question to them, the address is on this page. Also, take a look at the archives to get an idea of how folks are posting their questions:
Unconfigured Ad
Collapse
X
-
Hi Aeolus or Pawan (or whoever you are),Originally posted by Aeolus Huios View Post
Hi Grassgirl,
Thanks for reply but it does not work when i try. i wrote the code in this way:
my $searchio = new Bio::SearchIO( -format => 'blast', -file => $blast_report, -best_hit_only => 'true');
Eventhough,It gives error.
With regards,
Aeolus
Please have a look at this document. You have posted this question on a couple of threads here and you have asked the same thing in several posts to the BioPerl listserv. People have tried to help you but you have still not shown us any of your code or what error you are talking about. There is a lot of BioPerl documentation on this topic (try google) and old listserv conversations which you can search (here for example). Please realize that the solution to your problem is not to post the same question over and over again on different listservs or websites, but to heed the advice which you have been given (show us your code, describe the errors, etc.). Also, it would be better to follow up on the BioPerl listserv since it will be easier for others to google for the conversation later.
Leave a comment:
-
Getting sequence descriptions into BLAST output

Hi Grassgirl,
Thanks for reply but it does not work when i try. i wrote the code in this way:
my $searchio = new Bio::SearchIO( -format => 'blast', -file => $blast_report, -best_hit_only => 'true');
Eventhough,It gives error.
With regards,
Aeolus
Leave a comment:
-
Hi,
I'm new to BioPerl myself, but you may have to put your 1 in quotes for the best_hit_only argument, or try this as kmcarr wrote in the message above instead of the way you wrote it:
-best_hit_only => 'true'
Leave a comment:
-
Hi,
My question is not relavent Here anybody kindly Help. I have written a script using Bioperl module io::SearchIO for parsing blast result.
my $searchio = new Bio::SearchIO( -format => 'blast', -file => $blast_report, -best_hit_only => 1 );
This is my part of script but stil i am not ablet to get the best hit only of every query.
Can anybody help me out.
With regards,
Pawan
Leave a comment:
-
Hi My question is not relavent Here anybody kindly Help. I have written a script using Bioperl module io::SearchIO for parsing blast result.
my $searchio = new Bio::SearchIO( -format => 'blast', -file => $blast_report, -best_hit_only => 1 );
This is my part of script but stil i am not ablet to get the best hit of every query.
Can anybody help me out.
With regards,
Pawan
Leave a comment:
-
Thanks for the walk-through kmcarr, as well as the input on the HowTo. Diving in.
Hopefully this has been a help to Hilary as well.
Leave a comment:
-
Originally posted by grassgirl View PostI am interested in doing such a task. I would like to split a large xml file into smaller ones to be viewable in Excel and to include certain fields (such as hit-def). I am trying to learn Perl from the ground up, let alone BioPerl and meanwhile my data sits. I've seen your code (kmcarr) for parsing xml files into single-hit files (I believe), but have not as of yet figured out how to do what I want. Any hints on commands for BioPerl would be great (and I do know that I need to learn the workings of Perl and BioPerl still).Hi GG,Originally posted by grassgirl View PostThanks for the code SES. By the way, does anyone know a good basic book that will help with BioPerl? I have found the wiki pages to be a bit difficult to decipher.
I concur with SES about the solution an the documentation (here's the URL for the HOWTO if you haven't seen it http://www.bioperl.org/wiki/HOWTO:SearchIO). SES's and the first example on the HOWTO give the skeleton for what you want to do. The basic steps are:
1. Create a new SearchIO object to read you input file. One suggestion I would have is that in addition to the -format and -file parameters you can add "-best_hit_only=>'true'" to your new statement. This will only pull in the first (best) hit for each query. If you only want the description for the first hit then this is all you will need.
2. Read the next_result from the file. A result corresponds to a query sequence. It contains the data about the query (e.g. name, length etc.)
3. Read the next_hit for the current result. Every result may have 0 or more hits. Zero if the query had no matches; one to many depending on how many matches were found (and how many you chose to report when you ran the BLAST job). As stated above if you used the "-best_hit_only" flag then only the first hit will be available.
4. Print the desired information for this hit. The information for a hit and the methods to access it are listed in Table 2.2 of the HOWTO.
[From the description of your desired output I don't think you need to delve down further into the HSP (High Scoring Pairs) components of each hit. If this is the case you might want to look at the section of the HOWTO "Speed improvements with lightweight objects". Combining this with -best_hit_only can really speed up you code since the amount of data that has to be parsed for each query is significantly reduced.]
5. Repeat step #4 if you want information about multiple hits for each query (and remember not to use "-best_hit_only" when you create the reader object).
6. Repeat from step #3 for the next query sequence.
I understand that BioPerl can be hard to learn but the SearchIO module is a good place to start. The objects and methods are pretty much what the names imply and the data structures are a pretty straightforward hierarchy. Dive in and give it a try.
Leave a comment:
-
Thanks, SES. I'm working my way through Learning Perl now...being impatient to understand the BioPerl modules. I did just find the beginning BioPerl HowTo, which is good because simply looking up a particular module's HowTo doesn't really go into some of the basics needed to understand what's going on with a piece of code.
Leave a comment:
-
Have a look at the HOWTOs (google 'BioPerl HOWTO' and that should get you there) as they are very extensive. If you are just starting out and do not know very much Perl then it is probably going to be extremely difficult to try and understand how BioPerl works. I would say the best thing to do is get an Intro Perl book like 'Learning Perl' from O'Reilly or 'Beginning Perl for Bioinformatics' though the latter is quite dated now (published in 1996) and does not follow modern perl pragmas. Still, both are very useful. You may also find this short course from Ian Korf helpful: http://korflab.ucdavis.edu/Unix_and_Perl/
Leave a comment:
-
Thanks for the code SES. By the way, does anyone know a good basic book that will help with BioPerl? I have found the wiki pages to be a bit difficult to decipher.
Leave a comment:
-
Okay. So, why not just produce the blastxml and parse it.Originally posted by grassgirl View PostNo that's not what she is looking for. -m 9 is tabular output with comments (blast+ equivalent is 'outfmt 7') , but the comments aren't gene descriptions for each hit, simply a description before each query stating number of hits and some other info. Here's an example:
# BLASTX 2.2.25+
# Query: isotig06251gene=isogroup05465length=1481numContigs=1
# Database: nr
# Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score
# 54 hits found
The xml format indeed has hit descriptions (gene name, hypothetical protein, etc.).
Or, the equivalent in your language of choice.Code:my $search_in = Bio::SearchIO->new(-format=>'blastxml', -file=> $infile); while ( my $result = $search_in->next_result ) { while( my $hit = $result->next_hit ) { print "$hit->description\n"; } }
Leave a comment:
-
No that's not what she is looking for. -m 9 is tabular output with comments (blast+ equivalent is 'outfmt 7') , but the comments aren't gene descriptions for each hit, simply a description before each query stating number of hits and some other info. Here's an example:But....I think you can.
Isn't that what '-m 9' is for in legacy blast? I don't know what the equivalent is in blast+ but I have done this sort of thing before (with blast).
# BLASTX 2.2.25+
# Query: isotig06251gene=isogroup05465length=1481numContigs=1
# Database: nr
# Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score
# 54 hits found
The xml format indeed has hit descriptions (gene name, hypothetical protein, etc.).
Leave a comment:
-
But....I think you can.Originally posted by kmcarr View PostShort answer: you can't.
Isn't that what '-m 9' is for in legacy blast? I don't know what the equivalent is in blast+ but I have done this sort of thing before (with blast).
@Hilary,
One solution might be to use blastall if you want those descriptions.
Leave a comment:
-
I am interested in doing such a task. I would like to split a large xml file into smaller ones to be viewable in Excel and to include certain fields (such as hit-def). I am trying to learn Perl from the ground up, let alone BioPerl and meanwhile my data sits. I've seen your code (kmcarr) for parsing xml files into single-hit files (I believe), but have not as of yet figured out how to do what I want. Any hints on commands for BioPerl would be great (and I do know that I need to learn the workings of Perl and BioPerl still).If you want to include the definition in a tabular style report you will have to output a full report from blast (e.g. as text or XML) and then parse that report yourself to produce the table you want.
Leave a comment:
Latest Articles
Collapse
-
by SEQadmin2
Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?
Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating...-
Channel: Articles
10-14-2026, 09:55 AM -
-
by SEQadmin2
Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.
We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing...-
Channel: Articles
-
ad_right_rmr
Collapse
News
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SEQadmin2, 10-22-2026, 11:13 AM
|
0 responses
27 views
0 reactions
|
Last Post
by SEQadmin2
10-22-2026, 11:13 AM
|
||
|
Started by SEQadmin2, 10-22-2026, 10:48 AM
|
0 responses
20 views
0 reactions
|
Last Post
by SEQadmin2
10-22-2026, 10:48 AM
|
||
|
Started by SEQadmin2, 10-15-2026, 10:52 AM
|
0 responses
36 views
0 reactions
|
Last Post
by SEQadmin2
10-15-2026, 10:52 AM
|
||
|
Started by SEQadmin2, 10-14-2026, 05:39 AM
|
0 responses
43 views
0 reactions
|
Last Post
by SEQadmin2
10-14-2026, 05:39 AM
|
Leave a comment: