NAME
Bio::ASN1::EntrezGene - Regular expression-based Perl Parser for NCBI Entrez Gene.
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);
}
PREREQUISITE
None.
INSTALLATION
Bio::ASN1::EntrezGene can be installed as follows:
perl Makefile.PL make make install
Or if you prefer, just put EntrezGene.pm to the correct path like /MYPERLLIB/Bio/ ASN1. That'd work.
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 returns a data structure that contains all data items from the gene record.
The parser will report error & line number if input data does not conform to the NCBI Entrez Gene genome annotation file format.
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%.
SEE ALSO
The parse_entrez_gene_example script included in this package 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 me about 3-4 times more time to make for my project than the parser V1.0 itself. Note that the example script was edited to leave out stuff specific to my internal project.
For details on various parsers I 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.
AUTHOR
Dr. Mingyi Liu <mingyi.liu@gpc-biotech.com>
COPYRIGHT
The Bio::ASN1::EntrezGene module and its related modules and scripts are copyright (c) 2005 Mingyi Liu, GPC Biotech AG and Altana Research Institute. All rights reserved. I created these modules when working on a collaboration project between these two companies. Therefore a special thanks for the two companies to allow the release of the code into public domain.
You may use and distribute them under the terms of the Perl itself or GPL ( http://www.gnu.org/copyleft/gpl.html ).
OPERATION SYSTEMS SUPPORTED
Any OS that Perl runs on.
METHODS
new
Parameters: maxerrstr => 20 (optional) - maximum number of characters after
offending element, used by error reporting, default is 20
file => $filename (optional) - name of the file to be parsed.
call next_seq to parse!
Example: my $parser = Bio::ASN1::EntrezGene->new();
Function: Instantiate a parser object
Returns: Object reference
Notes:
maxerrstr
Parameters: $maxerrstr (optional) - maximum number of characters after
offending element, used by error reporting, default is 20
Example: $parser->maxerrstr(20);
Function: get/set maxerrstr.
Returns: maxerrstr.
Notes:
parse
Parameters: $string that contains Entrez Gene record,
$trimopt (optional) that specifies how the data structure
returned should be trimmed. 2 is 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
$string should not contain 'EntrezGene ::=' at beginning!
input_file
Parameters: $filename for 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: Attemps 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)
next_seq
Parameters: $trimopt (optional) that specifies how the data structure
returned should be trimmed. option 2 is 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() or input_file() first!
For details on how to use the $trimopt data trimming option
please see comment for the trimdata method. An option
of 2 is recommended and default
The acceptable values for $trimopt include:
1 - trim as much as possibile
2 (or 0, undef) - trim to an easy-to-use structure
3 - no trimming (in version 1.06, prior to version
1.06, 0 or undef means no trimming)
trimdata
Parameters: $hashref or $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 $trimopt include:
1 - trim as much as possibile
2 (or 0, undef) - trim to an easy-to-use structure
3 - no trimming (in version 1.06, prior to version
1.06, 0 or undef means no trimming)