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 annotating Sequences with Features which represent restriction sites. Calling annotate(Sequence sequence) will annotate the Sequence with the sites of any RestrictionEnzymes which have been added to the RestrictionMapper. The returned Sequence is a ViewSequence wrapping the original.

The Features created are RestrictionSites 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 RestrictionEnzymes to be searched must first be registered with the RestrictionEnzymeManager.

Since:
1.3
Author:
Keith James
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    SITE_FEATURE_SOURCE the source String used by RestrictionMapper when creating restriction site Features.
    static final String
    SITE_FEATURE_TYPE the type String used by RestrictionMapper when creating restriction site Features.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new RestrictionMapper which will use the specified ExecutorService.
    Creates a new RestrictionMapper which will use the specified ThreadPool.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEnzyme adds an enzyme to be searched for in the Sequence.
    annotate(Sequence sequence)
    annotate adds Features which represent restriction sites.
    void
    clearEnzymes removes all enzymes from those to be searched for in the Sequence.
    boolean
    getMapAll returns whether all sites should be marked, including those which have recognition sites within the sequence, but cut outside it.
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SITE_FEATURE_SOURCE

      public static final String SITE_FEATURE_SOURCE
      SITE_FEATURE_SOURCE the source String used by RestrictionMapper when creating restriction site Features. This is the String which is returned when a Feature's getSource() method is called.
      See Also:
    • SITE_FEATURE_TYPE

      public static final String SITE_FEATURE_TYPE
      SITE_FEATURE_TYPE the type String used by RestrictionMapper when creating restriction site Features. This is the String which is returned when a Feature's getType() method is called.
      See Also:
  • Constructor Details

    • RestrictionMapper

      public RestrictionMapper(ThreadPool threadPool)

      Creates a new RestrictionMapper which will use the specified ThreadPool. Do not share one pool between a number of RestrictionMappers 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.

      Parameters:
      threadPool - a ThreadPool.
    • RestrictionMapper

      Creates a new RestrictionMapper which will use the specified ExecutorService.

      Parameters:
      xser - a ExecutorService, e.g. ExecutorService.newCachedThreadPool()
      Since:
      1.8.1
  • Method Details

    • annotate

      public Sequence annotate(Sequence sequence)
      annotate adds Features which represent restriction sites.
      Specified by:
      annotate in interface SequenceAnnotator
      Parameters:
      sequence - a Sequence.
      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 - a boolean.
    • addEnzyme

      public void addEnzyme(RestrictionEnzyme enzyme)
      addEnzyme adds an enzyme to be searched for in the Sequence.
      Parameters:
      enzyme - a RestrictionEnzyme.
    • removeEnzyme

      public void removeEnzyme(RestrictionEnzyme enzyme)
      removeEnzyme removes an enzyme from those to be searched for in the Sequence.
      Parameters:
      enzyme - a RestrictionEnzyme.
    • clearEnzymes

      public void clearEnzymes()
      clearEnzymes removes all enzymes from those to be searched for in the Sequence.