[Bioperl-guts-l] [16795] bioperl-live/branches/TRY_featureio_refactor: remove FeatureIO from core into a separate distribution ( will need to add it optionally post-install)
Christopher John Fields
cjfields at dev.open-bio.org
Sun Jan 31 15:57:54 EST 2010
Revision: 16795
Author: cjfields
Date: 2010-01-31 15:57:54 -0500 (Sun, 31 Jan 2010)
Log Message:
-----------
remove FeatureIO from core into a separate distribution (will need to add it optionally post-install)
Modified Paths:
--------------
bioperl-live/branches/TRY_featureio_refactor/Bio/SeqFeature/Tools/Unflattener.pm
Removed Paths:
-------------
bioperl-live/branches/TRY_featureio_refactor/Bio/FeatureIO/
bioperl-live/branches/TRY_featureio_refactor/Bio/FeatureIO.pm
bioperl-live/branches/TRY_featureio_refactor/t/SeqFeature/FeatureIO.t
Deleted: bioperl-live/branches/TRY_featureio_refactor/Bio/FeatureIO.pm
===================================================================
--- bioperl-live/branches/TRY_featureio_refactor/Bio/FeatureIO.pm 2010-01-31 15:34:09 UTC (rev 16794)
+++ bioperl-live/branches/TRY_featureio_refactor/Bio/FeatureIO.pm 2010-01-31 20:57:54 UTC (rev 16795)
@@ -1,519 +0,0 @@
-# $Id$
-#
-# BioPerl module for Bio::FeatureIO
-#
-# Please direct questions and support issues to <bioperl-l at bioperl.org>
-#
-# Cared for by Allen Day <allenday at ucla.edu>
-#
-# Copyright Allen Day
-#
-# You may distribute this module under the same terms as perl itself
-#
-# POD documentation - main docs before the code
-
-=head1 NAME
-
-Bio::FeatureIO - Handler for FeatureIO
-
-=head1 SYNOPSIS
-
- use Bio::FeatureIO;
-
- #read from a file
- $in = Bio::FeatureIO->new(-file => "my.gff" , -format => 'GFF');
-
- #read from a filehandle
- $in = Bio::FeatureIO->new(-fh => \*GFF , -format => 'GFF');
-
- #read features already attached to a sequence
- my $feat = Bio::FeatureIO->new(-seq => $seq , -format => 'features');
-
- #read new features for existing sequence
- my $seq = Bio::FeatureIO->new(-seq => $seq , -format => 'Das');
-
- #write out features
- $out = Bio::FeatureIO->new(-file => ">outputfilename" ,
- -format => 'GFF' ,
- -version => 3);
-
- while ( my $feature = $in->next_feature() ) {
- $out->write_feature($feature);
- }
-
-=head1 DESCRIPTION
-
-An I/O iterator subsystem for genomic sequence features.
-
-Bio::FeatureIO is a handler module for the formats in the FeatureIO set (eg,
-Bio::FeatureIO::GFF). It is the officially sanctioned way of getting at
-the format objects, which most people should use.
-
-The Bio::FeatureIO system can be thought of like biological file handles.
-They are attached to filehandles with smart formatting rules (eg,
-GFF format, or BED 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 L<Bio::SeqFeatureI>.
-
-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.
-
-Each stream object has functions:
-
- $stream->next_feature();
- $stream->write_feature($feature);
-
-=head1 SUPPORTED FORMATS
-
- name module
- -----------------------------------
- BED bed.pm
- GFF gff.pm
- GTF gtf.pm
- InterPro (IPRScan 4.0) interpro.pm
- PTT (NCBI protein table) ptt.pm
-
-
-=head1 CONSTRUCTORS
-
-=head2 Bio::FeatureIO-E<gt>new()
-
- $featureIO = Bio::FeatureIO->new(-file => 'filename', -format=>$format);
- $featureIO = Bio::FeatureIO->new(-fh => \*FILEHANDLE, -format=>$format);
- $featureIO = Bio::FeatureIO->new(-seq => $seq, -format=>$format);
-
-The new() class method constructs a new Bio::FeatureIO object. The
-returned object can be used to retrieve or print Seq objects. new()
-accepts the following parameters:
-
-=over 4
-
-=item -file
-
-A file path to be opened for reading or writing. The usual Perl
-conventions apply:
-
- 'file' # open file for reading
- '>file' # open file for writing
- '>>file' # open file for appending
- '+<file' # open file read/write
- 'command |' # open a pipe from the command
- '| command' # open a pipe to the command
-
-=item -fh
-
-You may provide new() with a previously-opened filehandle. For
-example, to read from STDIN:
-
- $featio = Bio::FeatureIO->new(-fh => \*STDIN);
-
-Note that you must pass filehandles as references to globs.
-
-If neither a filehandle nor a filename is specified, then the module
-will read from the @ARGV array or STDIN, using the familiar E<lt>E<gt>
-semantics.
-
-A string filehandle is handy if you want to modify the output in the
-memory, before printing it out. The following program reads in EMBL
-formatted entries from a file and prints them out in fasta format with
-some HTML tags:
-
- use Bio::FeatureIO;
- use IO::String;
- my $in = Bio::FeatureIO->new('-file' => "my.gff" ,
- '-format' => 'EMBL');
- 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('-fh' => $stringio,
- '-format' => 'gtf');
- # output goes into $string
- $out->write_feature($f);
- # modify $string
- $string =~ s|(>)(\w+)|$1<font color="Red">$2</font>|g;
- # print into STDOUT
- print $string;
- }
-
-=item -format
-
-Specify the format of the file. See above for list of supported formats
-
-=item -flush
-
-By default, all files (or filehandles) opened for writing sequences
-will be flushed after each write_seq() (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:
-
- my $f1 = Bio::FeatureIO->new -file => "<a.f1",
- -format => "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) }
-
-=back
-
-=head2 Bio::FeatureIO-E<gt>newFh()
-
- $fh = Bio::FeatureIO->newFh(-fh => \*FILEHANDLE, -format=>$format);
- $fh = Bio::FeatureIO->newFh(-format => $format);
- # etc.
-
-This constructor behaves like new(), but returns a tied filehandle
-rather than a Bio::FeatureIO object. You can read sequences from this
-object using the familiar E<lt>E<gt> operator, and write to it using
-print(). The usual array and $_ semantics work. For example, you can
-read all sequence objects into an array like this:
-
- @features = <$fh>;
-
-Other operations, such as read(), sysread(), write(), close(), and printf()
-are not supported.
-
-=head1 OBJECT METHODS
-
-See below for more detailed summaries. The main methods are:
-
-=head2 $feature = $featureIO-E<gt>next_feature()
-
-Fetch the next feature from the stream.
-
-=head2 $featureIO-E<gt>write_feature($feature [,$another_feature,...])
-
-Write the specified feature(s) to the stream.
-
-=head2 TIEHANDLE(), READLINE(), PRINT()
-
-These provide the tie interface. See L<perltie> for more details.
-
-=head1 FEEDBACK
-
-=head2 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.
-
-Your participation is much appreciated.
-
- bioperl-l at bioperl.org - General discussion
- http://bioperl.org/wiki/Mailing_lists - About the mailing lists
-
-=head2 Support
-
-Please direct usage questions or support issues to the mailing list:
-
-I<bioperl-l at 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.
-
-=head2 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:
-
- http://bugzilla.open-bio.org/
-
-=head1 AUTHOR - Allen Day
-
-Email allenday at ucla.edu
-
-=head1 APPENDIX
-
-The rest of the documentation details each of the object
-methods. Internal methods are usually preceded with a _
-
-=cut
-
-#' Let the code begin...
-
-package Bio::FeatureIO;
-
-use strict;
-
-use Symbol;
-
-use base qw(Bio::Root::Root Bio::Root::IO);
-
-=head2 new
-
- Title : new
- Usage : $stream = Bio::FeatureIO->new(-file => $filename, -format => 'Format')
- 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
-
-=cut
-
-my $entry = 0;
-
-sub new {
- my ($caller, at args) = @_;
- my $class = ref($caller) || $caller;
-
- # or do we want to call SUPER on an object if $caller is an
- # object?
- if( $class =~ /Bio::FeatureIO::(\S+)/ ) {
-
- my ($self) = $class->SUPER::new(@args);
- $self->_initialize(@args);
- return $self;
-
- } else {
-
- my %param = @args;
-
- @param{ map { lc $_ } keys %param } = values %param; # lowercase keys
- my $format = $param{'-format'} ||
- $class->_guess_format( $param{-file} || $ARGV[0] );
-
- if( ! $format ) {
- if ($param{-file}) {
- $format = $class->_guess_format($param{-file});
- } elsif ($param{-fh}) {
- $format = $class->_guess_format(undef);
- }
- }
- $format = "\L$format"; # normalize capitalization to lower case
- return unless( $class->_load_format_module($format) );
- return "Bio::FeatureIO::$format"->new(@args);
-
- }
-}
-
-=head2 newFh
-
- Title : newFh
- Usage : $fh = Bio::FeatureIO->newFh(-file=>$filename,-format=>'Format')
- Function: does a new() followed by an fh()
- Example : $fh = Bio::FeatureIO->newFh(-file=>$filename,-format=>'Format')
- $feature = <$fh>; # read a feature object
- print $fh $feature; # write a feature object
- Returns : filehandle tied to the Bio::FeatureIO::Fh class
- Args :
-
-See L<Bio::FeatureIO::Fh>
-
-=cut
-
-sub newFh {
- my $class = shift;
- return unless my $self = $class->new(@_);
- return $self->fh;
-}
-
-=head2 fh
-
- 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
-
@@ Diff output truncated at 10000 characters. @@
More information about the Bioperl-guts-l
mailing list