Bio::Restriction::IO
base
Summary
Bio::Restriction::IO::base - base enzyme set
Package variables
Privates (from "my" definitions)
$offset;
Included modules
Inherit
Synopsis
Do not use this module directly. Use it via the Bio::Restriction::IO class.
Description
This class defines some base methods for restriction enzyme input and
at the same time gives a base list of common enzymes.
Methods
Methods description
Title : read
Usage : $renzs = $stream->read
Function: reads all the restrction enzymes from the stream
Returns : a Bio::Restriction::Restriction object
Args : none |
Title : write
Usage : $stream->write($renzs)
Function: writes restriction enzymes into the stream
Returns : 1 for success and 0 for error
Args : a Bio::Restriction::Enzyme
or a Bio::Restriction::EnzymeCollection object |
Title : _cuts_from_site
Usage : ($site, $cut, $comp_cut) = _cuts_from_site('ACGCGT(4/5)');
Function: Separates cut positions from a single site string.
Does nothing to site if it does not have the cut string
Returns : array of site_string, forward_cut_position, reverse_cut_position
Args : recognition site string |
Title : _meth
Usage : ($pos, $meth) = $self->_meth('2(5)');
Function: Separates methylation postion and coce from a string.
Adjusts the postion depending on enzyme site length
and symmetry
Returns : array of position and methylation code
Args : 1. reference to Enzyme object
2. methylation description string |
Title : _coordinate_shift_to_cut
Usage : $cut = $self->_coordinate_shift_to_cut($oricut, offset);
Function: Adjust cut position coordinates to start from the
first nucleotides of site
Returns : Cut position in correct coordinates
Args : 1. Original cut position
2. Length of the recognition site |
Title : _make_multisites
Usage : $self->_make_multisites($collection, $first_enzyme, \@sites, \@mets)
Function:
Bless a Bio::Restriction::Enzyme (which is already part of
the collection object) into
Bio::Restriction::Enzyme::MultiSite and clone it as many
times as there are alternative sites. The new objects are
added into the collection and into others list of sister
objects.
Returns : nothing, does in place editing
Args : 1. a Bio::Restriction::EnzymeCollection
2. a Bio::Restriction::Enzyme
3. reference to an array of recognition site strings
4. reference to an array of methylation code strings, optional |
Title : _make_multicuts
Usage : $self->_make_multicuts($collection, $first_enzyme, $precuts)
Function:
Bless a Bio::Restriction::Enzyme (which is already part of
the collection object) into
Bio::Restriction::Enzyme::MultiCut and clone it. The precut
string is processed to replase the cut sites in the cloned
object which is added into the collection. Both object
refere to each other through others() method.
Returns : nothing, does in place editing
Args : 1. a Bio::Restriction::EnzymeCollection
2. a Bio::Restriction::Enzyme
3. precut string, e.g. '12/7'
The examples we have of multiply cutting enzymes cut only four times. This protected method deals only with a string of two integers separated with a slash, e.g. '12/7'. The numbers represent the postions BEFORE the start of the recognition site, i.e. negative positions. |
Title : _companies
Purpose : Defines the companies that we know about
Returns : A hash
Argument : Nothing
Comments : An internal method to define the companies that we know about
REBASE uses a code, and this converts the code to the real name
(e.g. A = Amersham Pharmacia Biotech) |
Methods code
sub new
{ my($class, @args) = @_;
my $self = bless {}, $class;
$self->_initialize(@args);
return $self;} |
sub _initialize
{ my($self,@args) = @_;
return unless $self->SUPER::_initialize(@args);} |
sub read
{ my $self = shift;
my $renzs = new Bio::Restriction::EnzymeCollection(-empty => 1);
seek DATA,($offset||=tell DATA), 0;
while (<DATA>) {
chomp;
next if /^\s*$/;
my ($name, $site, $cut) = split /\s+/;
my $re = new Bio::Restriction::Enzyme(-name => $name,
-site => $site,
-cut => $cut);
$renzs->enzymes($re);
}
return $renzs;} |
sub write
{ my $self = shift;
foreach (@_) {
map { printf "%s\t%s\t%s\n", $_->name, $_->string, $_->cut
} sort {$a->name cmp $b->name} $_->each_enzyme
if $_->isa('Bio::Restriction::EnzymeCollection');
printf "%s\t%s\t%s\n", $_->name, $_->string, $_->cut
if $_->isa('Bio::Restriction::Enzyme');
}} |
sub _cuts_from_site
{ my ($self, $site) = @_;
my ($cut, $comp_cut) = $site =~ /\((-?\d+)\/(-?\d+)\)/;
$site =~ s/\(.*\)$//;
return ($site, $cut, $comp_cut);} |
sub _meth
{ my ($self, $re, $meth) = @_;
$meth =~ /(\S+)\((\d+)\)/;
my ($pos, $m) = ($1, $2);
$pos = 0 if $pos eq '?';
$pos = $re->seq->length + $pos if $pos and ! $re->palindromic;
return ($pos, $m);
$self->warn("Unknown methylation format [$meth]") if $self->verbose >0;} |
sub _coordinate_shift_to_cut
{ my ($self, $cut, $site_length) = @_;
return $cut + $site_length;} |
sub _make_multisites
{ my ($self, $renzs, $re, $sites, $meths) = @_;
bless $re, 'Bio::Restriction::Enzyme::MultiSite';
my $count = 0;
while ($count < scalar @{$sites}) {
my $re2 = $re->clone;
my $site = @{$sites}[$count];
my ($cut, $comp_cut);
($site, $cut, $comp_cut) = $self->_cuts_from_site($site);
$re2->site($site);
if ($cut) {
$re->cut($self->_coordinate_shift_to_cut(length($site), $cut));
$re->complementary_cut($self->_coordinate_shift_to_cut(length($site), $comp_cut));
}
if ($meths and @$meths) {
$re2->purge_methylation_sites;
$re2->methylation_sites($self->_meth($re2, @{$meths}[$count]));
}
$re->others($re2);
$count++;
}
foreach my $enz ($re->others) {
$enz->others($re, grep {$_ ne $enz} $re->others);
}
1;} |
sub _make_multicuts
{ my ($self, $renzs, $re, $precut) = @_;
bless $re, 'Bio::Restriction::Enzyme::MultiCut';
my ($cut, $comp_cut) = $precut =~ /(-?\d+)\/(-?\d+)/;
my $site = $re->site;
$re->site(('N' x abs($cut)) . $site);
my $re2 = $re->clone;
$re2->cut("-$cut");
$re2->complementary_cut("-$comp_cut");
$re->others($re2);
1;} |
sub _companies
{ my $self=shift;
my %companies=(
'A'=>'Amersham Pharmacia Biotech (1/03)',
'C'=>'Minotech Biotechnology (6/01)',
'E'=>'Stratagene (1/03)',
'F'=>'Fermentas AB (1/03)',
'G'=>'Qbiogene (1/03)',
'H'=>'American Allied Biochemical, Inc. (10/98)',
'I'=>'SibEnzyme Ltd. (1/03)',
'J'=>'Nippon Gene Co., Ltd. (6/00)',
'K'=>'Takara Shuzo Co. Ltd. (1/03)',
'M'=>'Roche Applied Science (1/03)',
'N'=>'New England Biolabs (1/03)',
'O'=>'Toyobo Biochemicals (11/98)',
'P'=>'Megabase Research Products (5/99)',
'Q'=>'CHIMERx (1/03)',
'R'=>'Promega Corporation (1/03)',
'S'=>'Sigma Chemical Corporation (1/03)',
'U'=>'Bangalore Genei (1/03)',
'V'=>'MRC-Holland (1/03)',
'X'=>'EURx Ltd. (1/03)');
$self->{company}=\%companies; } |
General documentation
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://bio.perl.org/MailList.html - About the mailing lists
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via email
or the web:
bioperl-bugs@bio.perl.org
http://bugzilla.bioperl.org/
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
| Common REBASE parsing methods | Top |
The rest of the methods in this file are to be used by other REBASE
parsers. They are not to be used outside subclasses of this base
class. (They are 'protected' in the sense the word is used in Java.)