public final class PairedReadManager extends Object implements PairedReads, XMLSerializable.OldVersionCompatible
PairedReads
While sequences can be queried individually for their expected distances (using getMateExpectedDistance(int) and getMateIndex(int)),
often if the whole set of sequences
have a common orientation and distance then getInterlacedExpectedDistance() and getInterlacedOrientation() are useful.PairedReads| Modifier and Type | Class and Description |
|---|---|
static class |
PairedReadManager.Builder
Allows for the construction of a PairedReadManager where the data resides on disk instead of in memory.
|
static class |
PairedReadManager.Orientation
Represents the relative orientation for a set of interlaced reads.
|
| Constructor and Description |
|---|
PairedReadManager(org.jdom.Element element)
Reconstructs a PairedReadManager previously serialized to XML using
toXml(String). |
PairedReadManager(GeneiousObjectInputStream in)
Reconstructs a PairedReadManager previously serialized using
toOutputStream(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectOutputStream). |
PairedReadManager(int numberOfSequences)
Constructs a new paired read manager with this many sequences, none of which are initially paired.
|
| Modifier and Type | Method and Description |
|---|---|
PairedReadManager |
addSequence()
Adds a sequence to be managed by this paired read manager.
|
protected void |
finalize() |
PairedReadManager |
getImmutablePairedReadManager()
Marks this instance as
setCopyOnWrite() and returns this. |
int |
getInterlacedExpectedDistance()
returns the expected distance (positive) of all reads in this data set if they are all interlaced with a common orientation or 0 if that are not interlaced with a common orientations.
|
PairedReadManager.Orientation |
getInterlacedOrientation()
returns the orientation of all reads in this data set if they are all interlaced with a common orientation or null if that are not interlaced with a common orientations.
|
int |
getMateExpectedDistance(int sequenceIndex)
Gets the expected mate distance (also known as predicted median insert size) of this nucleotide sequence from its mate.
|
int |
getMateIndex(int sequenceIndex)
Gets the index of the mate (if any) of the nucleotide sequence at this index.
|
int |
getNumberOfSequences()
Get the number of sequences managed by this paired read manger.
|
int |
getNumberOfSequencesWithMates()
Returns the number of sequences which have mates.
|
Geneious.MajorVersion |
getVersionSupport(XMLSerializable.VersionSupportType versionType)
Gets either the latest version this class can serialize to via
XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed. |
boolean |
hasAnyPairedReads()
Query whether there there is at least 1 pair of reads managed by this PairedReadManager.
|
boolean |
hasInterlacedMates() |
boolean |
isInterlacedWithAllReadsHavingSameExpectedDistance() |
PairedReadManager |
removeSequence(int indexToRemove)
Removes a sequence from this PairedReadManager, unpairing it with its mate if necessary.
|
PairedReadManager |
reorderSequences(int[] ordering)
Reorders the sequences in this paired read manager, as defined by
GeneralUtilities.reorder(int[], int[]). |
void |
setCopyOnWrite()
Flags this PairedReadManager to be duplicated when it is modified to using one of the methods
setMates(int, int, int, boolean) ,
removeSequence(int), addSequence(), reorderSequences(int[]). |
PairedReadManager |
setInterlaced(int expectedDistance,
PairedReadManager.Orientation orientation)
Marks all the reads in the data set as being interlaced with the given orientation.
|
PairedReadManager |
setMates(int sequenceIndex,
int mateIndex,
int expectedMateDistance)
Records the 2nd sequence as being paired with the first sequence with the given distance.
|
void |
toOutputStream(Geneious.MajorVersion version,
GeneiousObjectOutputStream objectOutputStream)
Serializes this PairedReadManager to an output stream so that it can be reconstructed later using
PairedReadManager(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectInputStream). |
void |
toOutputStream(GeneiousObjectOutputStream objectOutputStream)
Serializes this PairedReadManager to an output stream so that it can be reconstructed later using
PairedReadManager(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectInputStream). |
org.jdom.Element |
toXML(Geneious.MajorVersion majorVersion,
ProgressListener progressListener)
Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious.
|
org.jdom.Element |
toXml(String elementName)
Serializes this PairedReadManager to XML so that it can be reconstructed later using
PairedReadManager(org.jdom.Element) |
public PairedReadManager(int numberOfSequences)
numberOfSequences - the number of potentially paired reads to manage.public PairedReadManager(org.jdom.Element element)
toXml(String).element - an element previously returned from toXml(String).toXml(String)public PairedReadManager(GeneiousObjectInputStream in) throws IOException
toOutputStream(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectOutputStream).in - the object stream to read fromIOException - if anything goes wrong.toOutputStream(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectOutputStream)public PairedReadManager setInterlaced(int expectedDistance, PairedReadManager.Orientation orientation)
expectedDistance - the expected distance between the outer ends of the reads. Must be positive.orientation - the relative orientation of the readsPairedReadManager or if this PairedReadManager has had setCopyOnWrite() called on it, a copy of it with the new mate set. The copy will not be marked as copyOnWrite.public PairedReadManager.Orientation getInterlacedOrientation()
getInterlacedExpectedDistance()public int getInterlacedExpectedDistance()
getInterlacedOrientation()public PairedReadManager setMates(int sequenceIndex, int mateIndex, int expectedMateDistance)
sequenceIndex - the sequence to set the mate for.mateIndex - the index of its mate, or -1 if its mate is not in this contig.expectedMateDistance - the expected mate distance. See getMateExpectedDistance(int) for a definition of what this means
expected distance can be correctly set for each of them since both values should be either positive or negative in this case. (see getMateExpectedDistance(int))PairedReadManager or if this PairedReadManager has had setCopyOnWrite() called on it, a copy of it with the new mate set. The copy will not be marked as copyOnWrite.IllegalArgumentException - if this sequence already has a different mate or if its mate is paired to a different sequence.public int getMateExpectedDistance(int sequenceIndex)
PairedReadsgetMateExpectedDistance in interface PairedReadssequenceIndex - the index of the nucleotide sequence for which to get the mate index of.PairedReads.getMateIndex(int) will be -1.PairedReads.getMateIndex(int)public int getMateIndex(int sequenceIndex)
PairedReadsgetMateIndex in interface PairedReadssequenceIndex - the index of the nucleotide sequence to get the mate index ofPairedReads.getMateExpectedDistance(int)public boolean hasInterlacedMates()
public boolean isInterlacedWithAllReadsHavingSameExpectedDistance()
public PairedReadManager reorderSequences(int[] ordering)
GeneralUtilities.reorder(int[], int[]).ordering - the reodering array as specified by GeneralUtilities.reorder(int[], int[]).PairedReadManager or if this PairedReadManager has had setCopyOnWrite() called on it, a copy of it with the sequences reordered. The copy will not be marked as copyOnWrite.public PairedReadManager addSequence()
PairedReadManager or if this PairedReadManager has had setCopyOnWrite() called on it, a copy of it with the sequence added. The copy will not be marked as copyOnWrite.public int getNumberOfSequences()
PairedReadManager(int)) adjusted by any changes
made using addSequence() or removeSequence(int)public void toOutputStream(GeneiousObjectOutputStream objectOutputStream) throws IOException
PairedReadManager(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectInputStream).objectOutputStream - the stream to write toIOException - if an error is encountered when writing to the streamPairedReadManager(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectInputStream)public void toOutputStream(Geneious.MajorVersion version, GeneiousObjectOutputStream objectOutputStream) throws IOException
PairedReadManager(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectInputStream).version - the version of Geneious to ensure the data is compatible withobjectOutputStream - the stream to write toIOException - if an error is encountered when writing to the streamPairedReadManager(com.biomatters.geneious.publicapi.documents.sequence.GeneiousObjectInputStream)public Geneious.MajorVersion getVersionSupport(XMLSerializable.VersionSupportType versionType)
XMLSerializable.OldVersionCompatibleXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed.getVersionSupport in interface XMLSerializable.OldVersionCompatibleversionType - specifies which version property to returnpublic org.jdom.Element toXml(String elementName)
PairedReadManager(org.jdom.Element)elementName - the name of root element to returnpublic org.jdom.Element toXML(Geneious.MajorVersion majorVersion, ProgressListener progressListener)
XMLSerializable.OldVersionCompatibleXMLSerializable.toXML() for a more
detailed description of what it means to serialize to XML.
All classes that implement this method must also implement XMLSerializable.toXML() and should delegate back to
this method using Geneious.getMajorVersion() and ProgressListener.EMPTY as parameters.toXML in interface XMLSerializable.OldVersionCompatiblemajorVersion - the major version of Geneious to serialize to XML for. For example "6.0" but not "6.0.0". This must be a version
returned greater or equal to a version returned from
getVersionSupport(VersionSupportType.OldestVersionSerializableTo)
and must never be greater than the current version (Geneious.getMajorVersion())progressListener - for reporting progress and cancellingpublic PairedReadManager removeSequence(int indexToRemove)
reorderSequences(int[]) and then the final sequences deleted in reverse order.indexToRemove - the 0-based index of the sequence to remove.PairedReadManager or if this PairedReadManager has had setCopyOnWrite() called on it, a copy of it with the sequence removed. The copy will not be marked as copyOnWrite.public boolean hasAnyPairedReads()
public void setCopyOnWrite()
setMates(int, int, int, boolean) ,
removeSequence(int), addSequence(), reorderSequences(int[]). When it has been marked as copy
on write, those methods will return a copy of the PairedReadManager that includes the change. The copy will not be
marked as copyOnWrite.public PairedReadManager getImmutablePairedReadManager()
setCopyOnWrite() and returns this.getImmutablePairedReadManager in interface PairedReadsprotected void finalize()
throws Throwable
public int getNumberOfSequencesWithMates()
getNumberOfSequences()