Bio::A...rezGene(3pm)
π NAME π
Bio::ASN1::EntrezGene β a Regular expression-based Perl Parser for NCBI Entrez Gene. (You're reading the manual page the system calls Bio::A...rezGene(3pm), User Contributed Perl Documentation, and yes that truncation is just how the manual names it π
)
β¨ VERSION β¨
version 1.73
πΈ SYNOPSIS πΈ
use Bio::ASN1::EntrezGene;
my $parser = Bio::ASN1::EntrezGene->new('file' => "Homo_sapiens");
while(my $result = $parser->next_seq)
{
# extract data from $result, or Dumpvalue->new->dumpValue($result);
}
# a new way to get the $result data hash for a particular gene id:
use Bio::ASN1::EntrezGene::Indexer;
my $inx = Bio::ASN1::EntrezGene::Indexer->new(-filename => 'entrezgene.idx');
my $seq = $inx->fetch_hash(10); # returns $result for Entrez Gene record
# with geneid 10
# note that the index file 'entrezgene.idx' can be created as follows
my $inx = Bio::ASN1::EntrezGene::Indexer->new(
-filename => 'entrezgene.idx',
-write_flag => 'WRITE');
$inx->make_index('Homo_sapiens', 'Mus_musculus'); # files come from NCBI download
# for more detail please refer to Bio::ASN1::EntrezGene::Indexer perldoc
π¦ DESCRIPTION π¦
Bio::ASN1::EntrezGene is a regular expression-based Perl Parser for NCBI Entrez Gene genome databases (http://www.ncbi.nih.gov/entrez/query.fcgi?db=gene). It parses an ASN.1-formatted Entrez Gene record and hands you back a data structure containing all the data items from the gene record. like, every single one. no crumbs left. π
The parser will report error & line number if input data does not conform to the NCBI Entrez Gene genome annotation file format. So it's not just vibes β it tells you where things went wrong.
okay so here's the fun part: it is possible to provide reading of all NCBI's ASN.1-formatted files through simple variations of the Entrez Gene parser (the author notes he needs more investigation to be sure, but at least the sequence parser is a very simple variation on Entrez Gene parser and works well). β¨
Numbers time, bestie, and these are iconic: it took the parser version 1.0 11 minutes to parse the human genome Entrez Gene file on one 2.4 GHz Intel Xeon processor. The addition of validation and error reporting in 1.03 and handling of new Entrez Gene format slowed the parser down about 40%.
Since V1.07, this package also included an indexer that runs pretty fast (it takes 21 seconds for the indexer to index the human genome on the same processor). Therefore the combination of the modules would allow user to retrieve and parse arbitrary records. π«Ά
π ATTRIBUTES π
maxerrstr
- Parameters:
$maxerrstr(optional) β maximum number of characters after offending element, used by error reporting, default is20 - Example:
$parser->maxerrstr(20); - Function: get/set
maxerrstr. - Returns:
maxerrstr. - Notes:
input_file
- Parameters:
$filenamefor file that contains Entrez Gene record(s) - Example:
$parser->input_file($filename); - Function: Takes in name of a file containing Entrez Gene records. opens the file and stores file handle
- Returns: none.
- Notes: Attempts to open file larger than 2 GB even on Perl that does not support 2 GB file (accomplished by calling
"cat"and piping output. On OS that does not have"cat"error message will be displayed)
π₯ METHODS π₯
new
- Parameters:
maxerrstr => 20(optional) β maximum number of characters after offending element, used by error reporting, default is20fileor-file => $filename(optional) β name of the file to be parsed. callnext_seqto parse!fhor-fh => $filehandle(optional) β handle of the file to be parsed.
- Example:
my $parser = Bio::ASN1::EntrezGene->new(); - Function: Instantiate a parser object
- Returns: Object reference
- Notes: Setting
fileorfhwill reset line numbers etc. that are used for error reporting purposes, and seeking on file handle would mess up linenumbers!
parse
- Parameters:
$stringthat contains Entrez Gene record,$trimopt(optional) that specifies how the data structure returned should be trimmed.2is recommended and default$noreset(optional) that species that line number should not be reset- DEPRECATED as external function!!! Do not call this function directly! Call
next_seq()instead
- Example:
my $value = $parser->parse($text); # DEPRECATED as
# external function!!! Do not call this function
# directly! Call next_seq() instead
- Function: Takes in a string representing Entrez Gene record, parses the record and returns a data structure.
- Returns: A data structure containing all data items from the Entrez Gene record.
- Notes:
- DEPRECATED as external function!!! Do not call this function directly! Call
next_seq()instead $stringshould not contain'EntrezGene ::='at beginning!
- DEPRECATED as external function!!! Do not call this function directly! Call
next_seq
- Parameters:
$trimopt(optional) that specifies how the data structure returned should be trimmed. option2is recommended and default - Example:
my $value = $parser->next_seq(); - Function: Use the file handle generated by
input_file, parses the next the record and returns a data structure. - Returns: A data structure containing all data items from the Entrez Gene record.
- Notes:
- Must pass in a filename through
new()orinput_file()first! - For details on how to use the
$trimoptdata trimming option please see comment for thetrimdatamethod. An option of2is recommended and default - The acceptable values for
$trimoptinclude:1β trim as much as possible2(or0,undef) β trim to an easy-to-use structure3β no trimming (in version1.06, prior to version1.06,0orundefmeans no trimming)
- Must pass in a filename through
trimdata
- Parameters:
$hashrefor$arrayref$trimflag(optional, see Notes)
- Example:
trimdata($datahash); # using the default flag - Function: recursively process all attributes of a hash/array hybrid and get rid of any arrayref that points to one-element arrays (trims data structure) depending on the optional flag.
- Returns: none β trimming happenes in-place
- Notes:
- This function is useful to compact a data structure produced by
Bio::ASN1::EntrezGene::parse. - The acceptable values for
$trimoptinclude:1β trim as much as possible2(or0,undef) β trim to an easy-to-use structure3β no trimming (in version1.06, prior to version1.06,0orundefmeans no trimming)
- This function is useful to compact a data structure produced by
fh
- Parameters:
$filehandle(optional) - Example:
trimdata($datahash); # using the default flag - Function: getter/setter for file handle
- Returns: file handle for current file being parsed.
- Notes:
- Use with care!
- Line number report would not be corresponding to file's line number if
seekoperation is performed on the file handle!
rawdata
- Parameters: none
- Example:
my $data = $parser->rawdata(); - Function: Get the entrez gene data file that was just parsed
- Returns: a string containing the ASN1-formatted Entrez Gene record
- Notes:
- Must first parse a record then call this function!
- Could be useful in interpreting line number value in error report (if user did a
seekon file handle right before parsing call)
π§ INTERNAL METHODS π§
_parse
NCBI's Apr 05, 2005 format change forced much usage of lookahead, which would for sure slows parser down. But can't code efficiently without it. π (we respect the grind tho)
π PREREQUISITE π
None. π iconic behavior, honestly.
π INSTALLATION π
Bio::ASN1::EntrezGene package can be installed & tested as follows:
perl Makefile.PL
make
make test
make install
β SEE ALSO β
The parse_entrez_gene_example.pl script included in this package (please see the Bio-ASN1-EntrezGene-x.xx/examples directory) is a very important and near-complete demo on using this module to extract all data items from Entrez Gene records. Do check it out because in fact, this script took the author about 3-4 times more time to make for his project than the parser V1.0 itself. Note that the example script was edited to leave out stuff specific to his internal project. ππ
For details on various parsers generated for Entrez Gene, example scripts that uses/benchmarks the modules, please see http://sourceforge.net/projects/egparser/. Those other parsers etc. are included in V1.05 download.
π CITATION π
Liu, Mingyi, and Andrei Grigoriev. "Fast parsers for Entrez Gene." Bioinformatics 21, no. 14 (2005): 3189-3190.
π OPERATION SYSTEMS SUPPORTED π
Any OS that Perl runs on. periodt.
π«Ά FEEDBACK π«Ά
Mailing lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/Support.html - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting bugs
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bio-asn1-entrezgene/issues
π AUTHOR π
Dr. Mingyi Liu <mingyiliu@gmail.com>
πΈ COPYRIGHT πΈ
This software is copyright (c) 2005 by Mingyi Liu, 2005 by GPC Biotech AG, and 2005 by Altana Research Institute.
This software is available under the same terms as the perl 5 programming language system itself.
and that's the whole page bestie, no cap π
this was perl v5.38.2, dated 2024-03-04 β go parse something gorgeous π¦β¨
π¦ where this page comes from
- debian trixie: libbio-asn1-entrezgene-perl 1.730-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbio-asn1-entrezgene-perl 1.730-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbio-asn1-entrezgene-perl 1.730-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbio-asn1-entrezgene-perl 1.730-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms