Class Markers

java.lang.Object
org.snpeff.interval.Markers
All Implemented Interfaces:
Serializable, Iterable<Marker>, Collection<Marker>

public class Markers extends Object implements Serializable, Collection<Marker>
A collection of markers
Author:
pcingola
See Also:
  • Field Details

  • Constructor Details

    • Markers

      public Markers()
    • Markers

      public Markers(Collection otherMarkers)
    • Markers

      public Markers(Markers otherMarkers)
    • Markers

      public Markers(String name)
  • Method Details

    • readMarkers

      public static Markers readMarkers(String fileName)
      Read markers from a file Supported formats: BED, BigBed, VCF, TXT
    • add

      public boolean add(Marker marker)
      Add an interval to the collection
      Specified by:
      add in interface Collection<Marker>
    • add

      public Markers add(Markers markersToAdd)
      Add all intervals
    • addAll

      public boolean addAll(Collection<? extends Marker> mm)
      Add all markers in this collection
      Specified by:
      addAll in interface Collection<Marker>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<Marker>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<Marker>
    • containsAll

      public boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface Collection<Marker>
    • equals

      public boolean equals(Markers intervals)
      Are all intervals equal?
    • get

      public Marker get(int i)
    • getMarkers

      public List<Marker> getMarkers()
    • getMedian

      public int getMedian()
      Calculate the median point in this set of markers
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • intersect

      public Markers intersect()
      Perform the intersection of all overlapping sub-intervals

      For each marker, calculate all overlapping markers and create a new marker that contains them all. Return a set of those new markers.

    • intersect

      public Markers intersect(Marker marker)
      Intersection between 'marker' and all sub-intervals
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<Marker>
    • iterator

      public Iterator<Marker> iterator()
      Specified by:
      iterator in interface Collection<Marker>
      Specified by:
      iterator in interface Iterable<Marker>
    • load

      public void load(String fileName)
    • load

      public void load(String fileName, Genome genome)
    • merge

      public Markers merge()
      Merge overlapping intervals This is the same as 'union()' method, but the algorithm is more efficient
    • minus

      public Markers minus(Marker interval)
      Calculate 'set minus' using one interval
      Parameters:
      interval -
      Returns:
    • minus

      public Markers minus(Markers intervals)
      Returns the result of this set minus 'intervals'

      WARNING: This method should only be used for debugging (or in very small collections) since it is extremely inefficient.

    • rand

      public Interval rand()
      Return a random interval within this collection
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<Marker>
    • removeAll

      public boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<Marker>
    • retainAll

      public boolean retainAll(Collection<?> c)
      Specified by:
      retainAll in interface Collection<Marker>
    • save

      public void save(String fileName)
      Save to a file using a serializer
    • save

      public void save(String fileName, String chr)
      Save to a file using a serializer Only save one chromosome ('chr') Note: This is used to save only markers related to one chromosome (e.g. when saving GenomicSequences)
    • size

      public int size()
      Specified by:
      size in interface Collection<Marker>
    • sort

      public Markers sort()
      Sort intervals
    • sort

      public Markers sort(boolean byEnd, boolean reverse)
      Sort intervals
      Parameters:
      byEnd - : If true, sort by end. Otherwise sort by start
      reverse - : Reverse order
    • toArray

      public Marker[] toArray()
      Specified by:
      toArray in interface Collection<Marker>
    • toArray

      public <T> T[] toArray(T[] a)
      Specified by:
      toArray in interface Collection<Marker>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringAsciiArt

      public String toStringAsciiArt(int maxLen)
      Show all intervals as an ASCII art
    • toStringTxt

      public String toStringTxt()
    • union

      public Markers union()
      Perform the union of all overlapping intervals

      For each marker, calculate all overlapping markers and create a new marker that contains them all. Return a set of those new markers.

    • unique

      public Markers unique()
      Remove duplicated markers
      Returns:
      this object