/usr/share/perl5/Bio/Restriction/IO.pm is in libbio-perl-perl 1.6.901-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | #
# BioPerl module for Bio::Restriction::IO
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Rob Edwards <redwards@utmem.edu>
#
# Copyright Rob Edwards
#
# You may distribute this module under the same terms as perl itself
#
# POD documentation - main docs before the code
=head1 NAME
Bio::Restriction::IO - Handler for sequence variation IO Formats
=head1 SYNOPSIS
use Bio::Restriction::IO;
$in = Bio::Restriction::IO->new(-file => "inputfilename" ,
-format => 'withrefm');
my $res = $in->read; # a Bio::Restriction::EnzymeCollection
=head1 DESCRIPTION
L<Bio::Restriction::IO> is a handler module for the formats in the
Restriction IO set, e.g. C<Bio::Restriction::IO::xxx>. It is the
officially sanctioned way of getting at the format objects, which most
people should use.
The structure, conventions and most of the code is inherited from
L<Bio::SeqIO>. The main difference is that instead of using methods
C<next_seq>, you drop C<_seq> from the method name.
Also, instead of dealing only with individual L<Bio::Restriction::Enzyme>
objects, C<read()> will slurp in all enzymes into a
L<Bio::Restriction::EnzymeCollection> object.
For more details, see documentation in L<Bio::SeqIO>.
=head1 TO DO
At the moment, these can be use mainly to get a custom set if enzymes in
C<withrefm> or C<itype2> formats into L<Bio::Restriction::Enzyme> or
L<Bio::Restriction::EnzymeCollection> objects. Using C<bairoch> format is
highly experimental and is not recommmended at this time.
This class inherits from L<Bio::SeqIO> for convenience sake, though this should
inherit from L<Bio::Root::Root>. Get rid of L<Bio::SeqIO> inheritance by
copying relevant methods in.
C<write()> methods are currently not implemented for any format except C<base>.
Using C<write()> even with C<base> format is not recommended as it does not
support multicut/multisite enzyme output.
Should additional formats be supported (such as XML)?
=head1 SEE ALSO
L<Bio::SeqIO>,
L<Bio::Restriction::Enzyme>,
L<Bio::Restriction::EnzymeCollection>
=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 the
Bioperl mailing lists Your participation is much appreciated.
bioperl-l@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@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:
https://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR
Rob Edwards, redwards@utmem.edu
=head1 CONTRIBUTORS
Heikki Lehvaslaiho, heikki-at-bioperl-dot-org
=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::Restriction::IO;
use strict;
use vars qw(%FORMAT);
use base qw(Bio::SeqIO);
%FORMAT = (
'itype2' => 'itype2',
'8' => 'itype2',
'withrefm' => 'withrefm',
'31' => 'withrefm',
'base' => 'base',
'0' => 'base',
'bairoch' => 'bairoch',
'19' => 'bairoch',
'macvector' => 'bairoch',
'vectorNTI' => 'bairoch',
'neo' => 'prototype',
'prototype' => 'prototype'
);
=head2 new
Title : new
Usage : $stream = Bio::Restriction::IO->new(-file => $filename,
-format => 'Format')
Function: Returns a new seqstream
Returns : A Bio::Restriction::IO::Handler initialised with
the appropriate format
Args : -file => $filename
-format => format
-fh => filehandle to attach to
=cut
sub new {
my ($class, %param) = @_;
my ($format);
@param{ map { lc $_ } keys %param } = values %param; # lowercase keys
$format = $FORMAT{$param{'-format'}} if defined $param{'-format'};
$format ||= $class->_guess_format( $param{-file} || $ARGV[0] )
|| 'base';
$format = "\L$format"; # normalize capitalization to lower case
return unless $class->_load_format_module($format);
return "Bio::Restriction::IO::$format"->new(%param);
}
sub _load_format_module {
my ($class, $format) = @_;
my $module = "Bio::Restriction::IO::" . $format;
my $ok;
eval {
$ok = $class->_load_module($module);
};
if ( $@ ) {
print STDERR <<END;
$class: $format cannot be found
Exception $@
For more information about the IO system please see the IO docs.
This includes ways of checking for formats at compile time, not run time
END
;
}
return $ok;
}
=head2 read
Title : read
Usage : $renzs = $stream->read
Function: reads all the restrction enzymes from the stream
Returns : a Bio::Restriction::EnzymeCollection object
Args :
=cut
sub read {
my ($self, $seq) = @_;
$self->throw_not_implemented();
}
sub next {
my ($self, $seq) = @_;
$self->throw_not_implemented();
}
sub next_seq {
my ($self, $seq) = @_;
$self->throw_not_implemented();
}
=head2 write
Title : write
Usage : $stream->write($seq)
Function: writes the $seq object into the stream
Returns : 1 for success and 0 for error
Args : Bio::Restriction::EnzymeCollection object
=cut
sub write {
my ($self, $seq) = @_;
$self->throw("Sorry, you cannot write to a generic ".
"Bio::Restricion::IO object.");
}
sub write_seq {
my ($self, $seq) = @_;
$self->warn("These are not sequence objects. ".
"Use method 'write' instead of 'write_seq'.");
$self->write($seq);
}
=head2 _guess_format
Title : _guess_format
Usage : $obj->_guess_format($filename)
Function:
Example :
Returns : guessed format of filename (lower case)
Args :
=cut
sub _guess_format {
my $class = shift;
return unless $_ = shift;
return 'flat' if /\.dat$/i;
return 'xml' if /\.xml$/i;
}
1;
|