.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' '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 turned on, 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. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Bio::FeatureIO 3pm" .TH Bio::FeatureIO 3pm "2012-03-02" "perl v5.14.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::FeatureIO \- Handler for FeatureIO .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Bio::FeatureIO; \& \& #read from a file \& $in = Bio::FeatureIO\->new(\-file => "my.gff" , \-format => \*(AqGFF\*(Aq); \& \& #read from a filehandle \& $in = Bio::FeatureIO\->new(\-fh => \e*GFF , \-format => \*(AqGFF\*(Aq); \& \& #read features already attached to a sequence \& my $feat = Bio::FeatureIO\->new(\-seq => $seq , \-format => \*(Aqfeatures\*(Aq); \& \& #read new features for existing sequence \& my $seq = Bio::FeatureIO\->new(\-seq => $seq , \-format => \*(AqDas\*(Aq); \& \& #write out features \& $out = Bio::FeatureIO\->new(\-file => ">outputfilename" , \& \-format => \*(AqGFF\*(Aq , \& \-version => 3); \& \& while ( my $feature = $in\->next_feature() ) { \& $out\->write_feature($feature); \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1NOTE:\s0 This is a highly experimental I/O iterator subsystem for genomic sequence features. It is not complete, and is now undergoing a significant refactoring in a separate branch of BioPerl to address specific issues regarding the current implementation. Use at your own risk. .PP Bio::FeatureIO is a handler module for the formats in the FeatureIO set (eg, Bio::FeatureIO::GFF). .PP The Bio::FeatureIO system can be thought of like biological file handles. They are attached to filehandles with smart formatting rules (eg, \&\s-1GFF\s0 format, or \s-1BED\s0 format) and can either read or write feature objects (Bio::SeqFeature objects, or more correctly, Bio::FeatureHolderI implementing objects, of which Bio::SeqFeature is one such object). If you want to know what to do with a Bio::SeqFeatureI object, read Bio::SeqFeatureI. .PP The idea is that you request a stream object for a particular format. All the stream objects have a notion of an internal file that is read from or written to. A particular FeatureIO object instance is configured for either input or output. A specific example of a stream object is the Bio::FeatureIO::gff object. .PP Each stream object has functions: .PP .Vb 2 \& $stream\->next_feature(); \& $stream\->write_feature($feature); .Ve .SH "SUPPORTED FORMATS" .IX Header "SUPPORTED FORMATS" .Vb 7 \& name module \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& BED bed.pm \& GFF gff.pm \& GTF gtf.pm \& InterPro (IPRScan 4.0) interpro.pm \& PTT (NCBI protein table) ptt.pm .Ve .SH "CONSTRUCTORS" .IX Header "CONSTRUCTORS" .SS "Bio::FeatureIO\->\fInew()\fP" .IX Subsection "Bio::FeatureIO->new()" .Vb 3 \& $featureIO = Bio::FeatureIO\->new(\-file => \*(Aqfilename\*(Aq, \-format=>$format); \& $featureIO = Bio::FeatureIO\->new(\-fh => \e*FILEHANDLE, \-format=>$format); \& $featureIO = Bio::FeatureIO\->new(\-seq => $seq, \-format=>$format); .Ve .PP The \fInew()\fR class method constructs a new Bio::FeatureIO object. The returned object can be used to retrieve or print Seq objects. \fInew()\fR accepts the following parameters: .IP "\-file" 4 .IX Item "-file" A file path to be opened for reading or writing. The usual Perl conventions apply: .Sp .Vb 6 \& \*(Aqfile\*(Aq # open file for reading \& \*(Aq>file\*(Aq # open file for writing \& \*(Aq>>file\*(Aq # open file for appending \& \*(Aq+new(\-fh => \e*STDIN); .Ve .Sp Note that you must pass filehandles as references to globs. .Sp If neither a filehandle nor a filename is specified, then the module will read from the \f(CW@ARGV\fR array or \s-1STDIN\s0, using the familiar <> semantics. .Sp A string filehandle is handy if you want to modify the output in the memory, before printing it out. The following program reads in \s-1EMBL\s0 formatted entries from a file and prints them out in fasta format with some \s-1HTML\s0 tags: .Sp .Vb 10 \& use Bio::FeatureIO; \& use IO::String; \& my $in = Bio::FeatureIO\->new(\*(Aq\-file\*(Aq => "my.gff" , \& \*(Aq\-format\*(Aq => \*(AqEMBL\*(Aq); \& while ( my $f = $in\->next_feature() ) { \& # the output handle is reset for every file \& my $stringio = IO::String\->new($string); \& my $out = Bio::FeatureIO\->new(\*(Aq\-fh\*(Aq => $stringio, \& \*(Aq\-format\*(Aq => \*(Aqgtf\*(Aq); \& # output goes into $string \& $out\->write_feature($f); \& # modify $string \& $string =~ s|(>)(\ew+)|$1$2|g; \& # print into STDOUT \& print $string; \& } .Ve .IP "\-format" 4 .IX Item "-format" Specify the format of the file. See above for list of supported formats .IP "\-flush" 4 .IX Item "-flush" By default, all files (or filehandles) opened for writing sequences will be flushed after each \fIwrite_seq()\fR (making the file immediately usable). If you don't need this facility and would like to marginally improve the efficiency of writing multiple sequences to the same file (or filehandle), pass the \-flush option '0' or any other value that evaluates as defined but false: .Sp .Vb 5 \& my $f1 = Bio::FeatureIO\->new \-file => " "f1"; \& my $f2 = Bio::FeatureIO\->new \-file => ">a.f2", \& \-format => "f2", \& \-flush => 0; # go as fast as we can! \& \& while($feature = $f1\->next_feature) { $f2\->write_feature($feature) } .Ve .SS "Bio::FeatureIO\->\fInewFh()\fP" .IX Subsection "Bio::FeatureIO->newFh()" .Vb 3 \& $fh = Bio::FeatureIO\->newFh(\-fh => \e*FILEHANDLE, \-format=>$format); \& $fh = Bio::FeatureIO\->newFh(\-format => $format); \& # etc. .Ve .PP This constructor behaves like \fInew()\fR, but returns a tied filehandle rather than a Bio::FeatureIO object. You can read sequences from this object using the familiar <> operator, and write to it using \&\fIprint()\fR. The usual array and \f(CW$_\fR semantics work. For example, you can read all sequence objects into an array like this: .PP .Vb 1 \& @features = <$fh>; .Ve .PP Other operations, such as \fIread()\fR, \fIsysread()\fR, \fIwrite()\fR, \fIclose()\fR, and \fIprintf()\fR are not supported. .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" See below for more detailed summaries. The main methods are: .ie n .SS "$feature = $featureIO\->\fInext_feature()\fP" .el .SS "\f(CW$feature\fP = \f(CW$featureIO\fP\->\fInext_feature()\fP" .IX Subsection "$feature = $featureIO->next_feature()" Fetch the next feature from the stream. .ie n .SS "$featureIO\->write_feature($feature [,$another_feature,...])" .el .SS "\f(CW$featureIO\fP\->write_feature($feature [,$another_feature,...])" .IX Subsection "$featureIO->write_feature($feature [,$another_feature,...])" Write the specified feature(s) to the stream. .SS "\s-1\fITIEHANDLE\s0()\fP, \s-1\fIREADLINE\s0()\fP, \s-1\fIPRINT\s0()\fP" .IX Subsection "TIEHANDLE(), READLINE(), PRINT()" These provide the tie interface. See perltie for more details. .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 one of the Bioperl mailing lists. .PP Your participation is much appreciated. .PP .Vb 2 \& bioperl\-l@bioperl.org \- General discussion \& http://bioperl.org/wiki/Mailing_lists \- About the mailing lists .Ve .SS "Support" .IX Subsection "Support" Please direct usage questions or support issues to the mailing list: .PP \&\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 the bugs and their resolution. Bug reports can be submitted via the web: .PP .Vb 1 \& https://redmine.open\-bio.org/projects/bioperl/ .Ve .SH "AUTHOR \- Allen Day" .IX Header "AUTHOR - Allen Day" Email allenday@ucla.edu .SH "APPENDIX" .IX Header "APPENDIX" The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ .SS "new" .IX Subsection "new" .Vb 8 \& Title : new \& Usage : $stream = Bio::FeatureIO\->new(\-file => $filename, \-format => \*(AqFormat\*(Aq) \& Function: Returns a new feature stream \& Returns : A Bio::FeatureIO stream initialised with the appropriate format \& Args : Named parameters: \& \-file => $filename \& \-fh => filehandle to attach to \& \-format => format .Ve .SS "newFh" .IX Subsection "newFh" .Vb 8 \& Title : newFh \& Usage : $fh = Bio::FeatureIO\->newFh(\-file=>$filename,\-format=>\*(AqFormat\*(Aq) \& Function: does a new() followed by an fh() \& Example : $fh = Bio::FeatureIO\->newFh(\-file=>$filename,\-format=>\*(AqFormat\*(Aq) \& $feature = <$fh>; # read a feature object \& print $fh $feature; # write a feature object \& Returns : filehandle tied to the Bio::FeatureIO::Fh class \& Args : .Ve .PP See Bio::FeatureIO::Fh .SS "fh" .IX Subsection "fh" .Vb 8 \& Title : fh \& Usage : $obj\->fh \& Function: \& Example : $fh = $obj\->fh; # make a tied filehandle \& $feature = <$fh>; # read a feature object \& print $fh $feature; # write a feature object \& Returns : filehandle tied to Bio::FeatureIO class \& Args : none .Ve .SS "next_feature" .IX Subsection "next_feature" .Vb 3 \& Title : next_feature \& Usage : $feature = stream\->next_feature \& Function: Reads the next feature object from the stream and returns it. \& \& Certain driver modules may encounter entries in the stream \& that are either misformatted or that use syntax not yet \& understood by the driver. If such an incident is \& recoverable, e.g., by dismissing a feature of a feature \& table or some other non\-mandatory part of an entry, the \& driver will issue a warning. In the case of a \& non\-recoverable situation an exception will be thrown. Do \& not assume that you can resume parsing the same stream \& after catching the exception. Note that you can always turn \& recoverable errors into exceptions by calling \& $stream\->verbose(2). \& \& Returns : a Bio::SeqFeatureI feature object \& Args : none .Ve .PP See Bio::Root::RootI, Bio::SeqFeatureI .SS "write_feature" .IX Subsection "write_feature" .Vb 5 \& Title : write_feature \& Usage : $stream\->write_feature($feature) \& Function: writes the $feature object into the stream \& Returns : 1 for success and 0 for error \& Args : Bio::SeqFeature object .Ve .SS "_load_format_module" .IX Subsection "_load_format_module" .Vb 6 \& Title : _load_format_module \& Usage : *INTERNAL FeatureIO stuff* \& Function: Loads up (like use) a module at run time on demand \& Example : \& Returns : \& Args : .Ve .SS "seq" .IX Subsection "seq" .Vb 5 \& Title : seq \& Usage : $obj\->seq() OR $obj\->seq($newSeq) \& Example : \& Returns : Bio::SeqI object \& Args : newSeq (optional) .Ve .SS "_filehandle" .IX Subsection "_filehandle" .Vb 6 \& Title : _filehandle \& Usage : $obj\->_filehandle($newval) \& Function: This method is deprecated. Call _fh() instead. \& Example : \& Returns : value of _filehandle \& Args : newvalue (optional) .Ve .SS "_guess_format" .IX Subsection "_guess_format" .Vb 7 \& Title : _guess_format \& Usage : $obj\->_guess_format($filename) \& Function: guess format based on file suffix \& Example : \& Returns : guessed format of filename (lower case) \& Args : \& Notes : See "SUPPORTED FORMATS" .Ve