public class PositionListBuilder
A builder for creating immutable PositionList. Can be used for either an in memory or HDF5 list.
Example:
PositionListBuilder b=new PositionArrayList.Builder();
for (int i = 0; i Builder instances can be reused - it is safe to call net.maizegenetics.dna.map.PositionListBuilder$build()
multiple times to build multiple lists in series. Each new list
contains the one created before it.
HDF5 Example
Example:
PositionList instance=new PositionHDF5List.Builder("fileName").build();
Builder instances can be reused - it is safe to call net.maizegenetics.dna.map.PositionListBuilder$build()
public PositionListBuilder()
Creates a new builder. The returned builder is equivalent to the builder generated by .
public PositionListBuilder(int numberOfPositions)
Creates a new builder with a given number of Positions. This is most useful when the number of sites is known from the beginning and the set method will be used to set positions perhaps out of order. Useful in multithreaded builders.
public PositionListBuilder(ch.systemsx.cisd.hdf5.IHDF5Writer h5w,
PositionList a)
Creates a positionList in a new HDF5 file.
public PositionListBuilder add(Position element)
Adds element to the PositionList.
element - the element to addBuilder objectNullPointerException - if element is nullpublic PositionListBuilder addAll(java.util.Collection<? extends net.maizegenetics.dna.map.Position> collection)
Adds each element of elements to the PositionList.
collection - collection containing positions to be added to this listBuilder objectNullPointerException - if elements is or contains nullpublic PositionListBuilder addAll(PositionListBuilder builder)
public PositionListBuilder set(int index, Position element)
Replaces the element at the specified position in this list with the specified element.
index - index of the element to replaceelement - element to be stored at the specified positionBuilder objectIndexOutOfBoundsExceptionpublic PositionListBuilder genomeVersion(java.lang.String genomeVersion)
public boolean validateOrdering()
Returns whether List is already ordered. Important to check this if genotype and sites are separately built, as the PositionArrayList must be sorted, and will be with build.
public int size()
Returns the size (number of positions) in the current list
public static PositionList getInstance(java.lang.String hdf5Filename)
Creates a new position list based on an existing HDF5 file.
public static PositionList getInstance(ch.systemsx.cisd.hdf5.IHDF5Reader reader)
Creates a new builder based on an existing HDF5 file reader.
public static PositionList getInstance(int numSites)
Generates a generic position list when no position information known
numSites - number of sitespublic static PositionList getInstance(java.util.List<net.maizegenetics.dna.map.Position> positions)
Creates in memory of PositionList from the an array of positions.
public PositionList build()
Returns a newly-created ImmutableList based on the myPositions of the Builder.
public Tuple<net.maizegenetics.dna.map.PositionList,kotlin.Array[]> buildWithSiteRedirect()
public PositionList build(GenotypeCallTableBuilder genotypes)
public PositionListBuilder sortPositions(GenotypeCallTableBuilder genotypes)
public PositionListBuilder sortPositions()
public kotlin.Array[] sort()