Class RestrictionMapper
- java.lang.Object
-
- org.biojava.bio.molbio.RestrictionMapper
-
- All Implemented Interfaces:
SequenceAnnotator
public class RestrictionMapper extends Object implements SequenceAnnotator
RestrictionMapper
is a class for annotatingSequence
s withFeature
s which represent restriction sites. Callingannotate(Sequence sequence)
will annotate theSequence
with the sites of anyRestrictionEnzyme
s which have been added to theRestrictionMapper
. The returnedSequence
is aViewSequence
wrapping the original.The
Feature
s created areRestrictionSite
s which have a flyweightAnnotation
containing a singleString
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 theSequence
using thesetMapAll(boolean on)
method.The current implementation requires that
RestrictionEnzyme
s to be searched must first be registered with theRestrictionEnzymeManager
.- Since:
- 1.3
- Author:
- Keith James
-
-
Field Summary
Fields Modifier and Type Field Description static String
SITE_FEATURE_SOURCE
SITE_FEATURE_SOURCE
the sourceString
used byRestrictionMapper
when creating restriction siteFeature
s.static String
SITE_FEATURE_TYPE
SITE_FEATURE_TYPE
the typeString
used byRestrictionMapper
when creating restriction siteFeature
s.
-
Constructor Summary
Constructors Constructor Description RestrictionMapper(ExecutorService xser)
Creates a newRestrictionMapper
which will use the specifiedExecutorService
.RestrictionMapper(ThreadPool threadPool)
Creates a newRestrictionMapper
which will use the specifiedThreadPool
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEnzyme(RestrictionEnzyme enzyme)
addEnzyme
adds an enzyme to be searched for in theSequence
.Sequence
annotate(Sequence sequence)
annotate
addsFeature
s which represent restriction sites.void
clearEnzymes()
clearEnzymes
removes all enzymes from those to be searched for in theSequence
.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 theSequence
.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.
-
-
-
Field Detail
-
SITE_FEATURE_SOURCE
public static final String SITE_FEATURE_SOURCE
SITE_FEATURE_SOURCE
the sourceString
used byRestrictionMapper
when creating restriction siteFeature
s. This is theString
which is returned when aFeature
'sgetSource()
method is called.- See Also:
- Constant Field Values
-
SITE_FEATURE_TYPE
public static final String SITE_FEATURE_TYPE
SITE_FEATURE_TYPE
the typeString
used byRestrictionMapper
when creating restriction siteFeature
s. This is theString
which is returned when aFeature
'sgetType()
method is called.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RestrictionMapper
public RestrictionMapper(ThreadPool threadPool)
Creates a new
RestrictionMapper
which will use the specifiedThreadPool
. Do not share one pool between a number ofRestrictionMapper
s becauseannotate(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.- Parameters:
threadPool
- aThreadPool
.
-
RestrictionMapper
public RestrictionMapper(ExecutorService xser)
Creates a new
RestrictionMapper
which will use the specifiedExecutorService
.- Parameters:
xser
- aExecutorService
, e.g. ExecutorService.newCachedThreadPool()- Since:
- 1.8.1
-
-
Method Detail
-
annotate
public Sequence annotate(Sequence sequence)
annotate
addsFeature
s which represent restriction sites.- Specified by:
annotate
in interfaceSequenceAnnotator
- Parameters:
sequence
- aSequence
.- Returns:
- a
Sequence
view with restriction sites marked.
-
getMapAll
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.- Returns:
- a
boolean
.
-
setMapAll
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.- Parameters:
on
- aboolean
.
-
addEnzyme
public void addEnzyme(RestrictionEnzyme enzyme)
addEnzyme
adds an enzyme to be searched for in theSequence
.- Parameters:
enzyme
- aRestrictionEnzyme
.
-
removeEnzyme
public void removeEnzyme(RestrictionEnzyme enzyme)
removeEnzyme
removes an enzyme from those to be searched for in theSequence
.- Parameters:
enzyme
- aRestrictionEnzyme
.
-
clearEnzymes
public void clearEnzymes()
clearEnzymes
removes all enzymes from those to be searched for in theSequence
.
-
-