.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Bio::ASN1::Sequence 3pm" .TH Bio::ASN1::Sequence 3pm 2024-03-04 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Bio::ASN1::Sequence \- Regular expression\-based Perl Parser for ASN.1\-formatted NCBI Sequences. .SH VERSION .IX Header "VERSION" version 1.73 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Bio::ASN1::Sequence; \& \& my $parser = Bio::ASN1::Sequence\->new(\*(Aqfile\*(Aq => "downloaded.asn1"); \& 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 sequence id: \& use Bio::ASN1::Sequence::Indexer; \& my $inx = Bio::ASN1::Sequence::Indexer\->new(\-filename => \*(Aqseq.idx\*(Aq); \& my $seq = $inx\->fetch_hash(\*(AqAF093062\*(Aq); \& \& # for creation of .idx index files please refer to \& # Bio::ASN1::Sequence::Indexer perldoc .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Bio::ASN1::Sequence is a regular expression-based Perl Parser for ASN.1\-formatted NCBI sequences. It parses an ASN.1\-formatted sequence record and returns a data structure that contains all data items from the sequence record. .PP The parser will report error & line number if input data does not conform to the NCBI Sequence annotation file format. .PP The sequence parser is basically a modified version of the high-performance Bio::ASN1::EntrezGene parser. However, I created a standalone module for sequence since it is more efficient to keep Sequence-specific code out of EntrezGene.pm. .PP In fact it is possible to provide reading of all NCBI's ASN.1\-formatted files through simple variations of the Entrez Gene parser (I need more investigation to be sure, but at least the sequence parser works well). .PP Since demand for parsing NCBI ASN.1\-formatted sequences is much lower than EntrezGene, this module is more like a beta version that works on the examples I checked, but I did not check all available records or data definitions. The error-reporting function of this module has to be useful sometimes. :) .SH ATTRIBUTES .IX Header "ATTRIBUTES" .SS maxerrstr .IX Subsection "maxerrstr" .Vb 6 \& 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: .Ve .SS input_file .IX Subsection "input_file" .Vb 9 \& Parameters: $filename for file that contains Sequence record(s) \& Example: $parser\->input_file($filename); \& Function: Takes in name of a file containing Sequence 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) .Ve .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" .Vb 12 \& Parameters: maxerrstr => 20 (optional) \- maximum number of characters after \& offending element, used by error reporting, default is 20 \& file or \-file => $filename (optional) \- name of the file to be \& parsed. call next_seq to parse! \& fh or \-fh => $filehandle (optional) \- handle of the file to be \& parsed. \& Example: my $parser = Bio::ASN1::Sequence\->new(); \& Function: Instantiate a parser object \& Returns: Object reference \& Notes: Setting file or fh will reset line numbers etc. that are used \& for error reporting purposes, and seeking on file handle would \& mess up linenumbers! .Ve .SS parse .IX Subsection "parse" .Vb 10 \& Parameters: $string that contains Sequence 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 Sequence record, parses \& the record and returns a data structure. \& Returns: A data structure containing all data items from the sequence \& record. \& Notes: DEPRECATED as external function!!! Do not call this function \& directly! Call next_seq() instead \& $string should not contain \*(AqSeq\-entry ::= set\*(Aq at beginning! .Ve .SS next_seq .IX Subsection "next_seq" .Vb 10 \& 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 sequence \& 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 possible \& 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) .Ve .SS trimdata .IX Subsection "trimdata" .Vb 10 \& 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::Sequence::parse. \& The acceptable values for $trimopt include: \& 1 \- trim as much as possible \& 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) \& This function is duplicate to EntrezGene.pm\*(Aqs and code should \& be compressed in the future (using util module & subclass). .Ve .SS fh .IX Subsection "fh" .Vb 7 \& 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\*(Aqs line \& number if seek operation is performed on the file handle! .Ve .SS rawdata .IX Subsection "rawdata" .Vb 8 \& Parameters: none \& Example: my $data = $parser\->rawdata(); \& Function: Get the sequence data file that was just parsed \& Returns: a string containing the ASN1\-formatted sequence 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 seek on file handle right before parsing \& call) .Ve .SH "INTERNAL METHODS" .IX Header "INTERNAL METHODS" .SS _parse .IX Subsection "_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. .SH PREREQUISITE .IX Header "PREREQUISITE" None. .SH INSTALLATION .IX Header "INSTALLATION" Bio::ASN1::Sequence is part of the Bio::ASN1::EntrezGene package. Bio::ASN1::EntrezGene package can be installed & tested as follows: .PP .Vb 4 \& perl Makefile.PL \& make \& make test \& make install .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" The parse_sequence_example.pl script included in this package (please see the Bio\-ASN1\-EntrezGene\-x.xx/examples directory) shows the usage. .PP Please check out perldoc for Bio::ASN1::EntrezGene for more info. .SH CITATION .IX Header "CITATION" Liu, Mingyi, and Andrei Grigoriev. "Fast parsers for Entrez Gene." Bioinformatics 21, no. 14 (2005): 3189\-3190. .SH "OPERATION SYSTEMS SUPPORTED" .IX Header "OPERATION SYSTEMS SUPPORTED" Any OS that Perl runs on. .SH FEEDBACK .IX Header "FEEDBACK" .SS "Mailing lists" .IX Subsection "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. .PP .Vb 2 \& bioperl\-l@bioperl.org \- General discussion \& http://bioperl.org/Support.html \- About the mailing lists .Ve .SS Support .IX Subsection "Support" Please direct usage questions or support issues to the mailing list: \&\fIbioperl\-l@bioperl.org\fR .PP 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. .SS "Reporting bugs" .IX Subsection "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: .PP .Vb 1 \& https://github.com/bioperl/bio\-asn1\-entrezgene/issues .Ve .SH AUTHOR .IX Header "AUTHOR" Dr. Mingyi Liu .SH COPYRIGHT .IX Header "COPYRIGHT" This software is copyright (c) 2005 by Mingyi Liu, 2005 by GPC Biotech AG, and 2005 by Altana Research Institute. .PP This software is available under the same terms as the perl 5 programming language system itself.