public class RestrictionMapper extends Object implements SequenceAnnotator
RestrictionMapper
is a class for annotating
Sequence
s with Feature
s which represent
restriction sites. Calling annotate(Sequence sequence)
will annotate the Sequence
with the sites of any
RestrictionEnzyme
s which have been added to the
RestrictionMapper
. The returned Sequence
is a ViewSequence
wrapping the original.
The Feature
s created are
RestrictionSite
s which have a flyweight
Annotation
containing a single String
property "dbxref" whose value is "REBASE:" plus name of the enzyme
(e.g. EcoRI).
The mapper will by default map only those sites which have both
their recognition sites and their cut sites within the
Sequence
. This behaviour may be changed to map all
sites which have their recognition sites within the
Sequence
using the setMapAll(boolean
on)
method.
The current implementation requires that
RestrictionEnzyme
s to be searched must first be
registered with the RestrictionEnzymeManager
.
Modifier and Type | Field and Description |
---|---|
static String |
SITE_FEATURE_SOURCE
SITE_FEATURE_SOURCE the source String
used by RestrictionMapper when creating
restriction site Feature s. |
static String |
SITE_FEATURE_TYPE
SITE_FEATURE_TYPE the type String
used by RestrictionMapper when creating
restriction site Feature s. |
Constructor and Description |
---|
RestrictionMapper(ExecutorService xser)
Creates a new
RestrictionMapper which will use
the specified ExecutorService . |
RestrictionMapper(ThreadPool threadPool)
Creates a new
RestrictionMapper which will use
the specified ThreadPool . |
Modifier and Type | Method and Description |
---|---|
void |
addEnzyme(RestrictionEnzyme enzyme)
addEnzyme adds an enzyme to be searched for in the
Sequence . |
Sequence |
annotate(Sequence sequence)
annotate adds Feature s which
represent restriction sites. |
void |
clearEnzymes()
clearEnzymes removes all enzymes from those to be
searched for in the Sequence . |
boolean |
getMapAll()
getMapAll returns whether all sites should be
marked, including those which have recognition sites within the
sequence, but cut outside it. |
void |
removeEnzyme(RestrictionEnzyme enzyme)
removeEnzyme removes an enzyme from those to be
searched for in the Sequence . |
void |
setMapAll(boolean on)
setMapAll sets whether all sites should be marked,
including those which have recognition sites within the
sequence, but cut outside it. |
public static final String SITE_FEATURE_SOURCE
SITE_FEATURE_SOURCE
the source String
used by RestrictionMapper
when creating
restriction site Feature
s. This is the
String
which is returned when a
Feature
's getSource()
method is
called.public static final String SITE_FEATURE_TYPE
SITE_FEATURE_TYPE
the type String
used by RestrictionMapper
when creating
restriction site Feature
s. This is the
String
which is returned when a
Feature
's getType()
method is called.public RestrictionMapper(ThreadPool threadPool)
Creates a new RestrictionMapper
which will use
the specified ThreadPool
. Do not share one pool
between a number of RestrictionMapper
s because
annotate(Sequence sequence)
waits for all threads
in the pool to finish work before returning and this will lead
to a race condition between mappers. One mapper could end up
waiting for another mapper's threads before returning.
threadPool
- a ThreadPool
.public RestrictionMapper(ExecutorService xser)
Creates a new RestrictionMapper
which will use
the specified ExecutorService
.
xser
- a ExecutorService
, e.g. ExecutorService.newCachedThreadPool()public Sequence annotate(Sequence sequence)
annotate
adds Feature
s which
represent restriction sites.annotate
in interface SequenceAnnotator
sequence
- a Sequence
.Sequence
view with restriction sites
marked.public boolean getMapAll()
getMapAll
returns whether all sites should be
marked, including those which have recognition sites within the
sequence, but cut outside it. The default is false, indicating
only sites which can actually be cut are mapped.boolean
.public void setMapAll(boolean on)
setMapAll
sets whether all sites should be marked,
including those which have recognition sites within the
sequence, but cut outside it. The default is false, indicating
only sites which can actually be cut are mapped.on
- a boolean
.public void addEnzyme(RestrictionEnzyme enzyme)
addEnzyme
adds an enzyme to be searched for in the
Sequence
.enzyme
- a RestrictionEnzyme
.public void removeEnzyme(RestrictionEnzyme enzyme)
removeEnzyme
removes an enzyme from those to be
searched for in the Sequence
.enzyme
- a RestrictionEnzyme
.public void clearEnzymes()
clearEnzymes
removes all enzymes from those to be
searched for in the Sequence
.Copyright © 2014 BioJava. All rights reserved.