Package org.snpeff.interval

# 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:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected ArrayList<Marker>`
`markers`
`protected String`
`name`

## Constructor Summary

Constructors
Constructor
Description
`Markers()`
`Markers(String name)`
`Markers(Collection otherMarkers)`
`Markers(Markers otherMarkers)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`add(Marker marker)`
Add an interval to the collection
`Markers`
`add(Markers markersToAdd)`
Add all intervals
`boolean`
`addAll(Collection<? extends Marker> mm)`
Add all markers in this collection
`void`
`clear()`
`boolean`
`contains(Object o)`
`boolean`
`containsAll(Collection<?> c)`
`boolean`
`equals(Markers intervals)`
Are all intervals equal?
`Marker`
`get(int i)`
`List<Marker>`
`getMarkers()`
`int`
`getMedian()`
Calculate the median point in this set of markers
`String`
`getName()`
`Markers`
`intersect()`
Perform the intersection of all overlapping sub-intervals
`Markers`
`intersect(Marker marker)`
Intersection between 'marker' and all sub-intervals
`boolean`
`isEmpty()`
`Iterator<Marker>`
`iterator()`
`void`
`load(String fileName)`
`void`
`load(String fileName, Genome genome)`
`Markers`
`merge()`
Merge overlapping intervals This is the same as 'union()' method, but the algorithm is more efficient
`Markers`
`minus(Marker interval)`
Calculate 'set minus' using one interval
`Markers`
`minus(Markers intervals)`
Returns the result of this set minus 'intervals'
`Interval`
`rand()`
Return a random interval within this collection
`static Markers`
`readMarkers(String fileName)`
Read markers from a file Supported formats: BED, BigBed, VCF, TXT
`boolean`
`remove(Object o)`
`boolean`
`removeAll(Collection<?> c)`
`boolean`
`retainAll(Collection<?> c)`
`void`
`save(String fileName)`
Save to a file using a serializer
`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.
`void`
`setName(String name)`
`int`
`size()`
`Markers`
`sort()`
Sort intervals
`Markers`
`sort(boolean byEnd, boolean reverse)`
Sort intervals
`Marker[]`
`toArray()`
`<T> T[]`
`toArray(T[] a)`
`String`
`toString()`
`String`
`toStringAsciiArt(int maxLen)`
Show all intervals as an ASCII art
`String`
`toStringTxt()`
`Markers`
`union()`
Perform the union of all overlapping intervals
`Markers`
`unique()`
Remove duplicated markers

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Collection

`equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray`

### Methods inherited from interface java.lang.Iterable

`forEach`

## Field Details

### markers

protected ArrayList<Marker> markers

### name

protected String name

## 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