Class PairedReadManager

    • Method Detail

      • setInterlaced

        public PairedReadManager setInterlaced​(int expectedDistance,
                                               PairedReadManager.Orientation orientation)
        Marks all the reads in the data set as being interlaced with the given orientation.
        Parameters:
        expectedDistance - the expected distance between the outer ends of the reads. Must be positive.
        orientation - the relative orientation of the reads
        Returns:
        either this 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.
        Since:
        API 4.40 (Geneious 5.4.0)
      • getInterlacedOrientation

        public 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.
        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.
        Since:
        API 4.40 (Geneious 5.4.0)
        See Also:
        getInterlacedExpectedDistance()
      • getInterlacedExpectedDistance

        public 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.
        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.
        Since:
        API 4.40 (Geneious 5.4.0)
        See Also:
        getInterlacedOrientation()
      • setMates

        public PairedReadManager setMates​(int sequenceIndex,
                                          int mateIndex,
                                          int expectedMateDistance)
        Records the 2nd sequence as being paired with the first sequence with the given distance.

        If the mate sequence has not already been paired with this sequence, then the mate's expectedMateDistance will be set to -expectedMateDistance

        Parameters:
        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))
        Returns:
        either this 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.
        Throws:
        java.lang.IllegalArgumentException - if this sequence already has a different mate or if its mate is paired to a different sequence.
      • getMateExpectedDistance

        public int getMateExpectedDistance​(int sequenceIndex)
        Description copied from interface: PairedReads
        Gets the expected mate distance (also known as predicted median insert size) of this nucleotide sequence from its mate. This is defined as the length of the 2 reads plus the distance between them. For example if the 2 reads both have length 30 with a 40 bp gap between them, then the expected mate distance is 100. If the mate is expected to appear after this sequence with this sequence in its current orientation, then the expected distance will be positive. If the mate is expected to appear before this sequence with this sequence in its current orientation, then the expected distance will be negative.
        Specified by:
        getMateExpectedDistance in interface PairedReads
        Parameters:
        sequenceIndex - the index of the nucleotide sequence for which to get the mate index of.
        Returns:
        the expected mate distance or 0 if this read is not paired. Note that a read may still have a mate distance!=0 but its mate may not be present in this document (in which case PairedReads.getMateIndex(int) will be -1.
        See Also:
        PairedReads.getMateIndex(int)
      • hasInterlacedMates

        public boolean hasInterlacedMates()
        Returns:
        true if either there are no paired reads or if all of the paired reads are interlaced (i.e 0 and 1 are paired, 2 and 3 are paired)
      • isInterlacedWithAllReadsHavingSameExpectedDistance

        public boolean isInterlacedWithAllReadsHavingSameExpectedDistance()
        Returns:
        true if all reads have the same mate distance or if none of the reads are paired. This means we are using only a very small amount of memory. This method is intended only for testing purposes.
      • addSequence

        public PairedReadManager addSequence()
        Adds a sequence to be managed by this paired read manager. The new sequence is initially unpaired.
        Returns:
        either this 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.
      • getNumberOfSequences

        public int getNumberOfSequences()
        Get the number of sequences managed by this paired read manger. This is equal to the value passed to the constructor (PairedReadManager(int)) adjusted by any changes made using addSequence() or removeSequence(int)
        Returns:
        the number of sequences managed by this paired read manger.
        Since:
        API 4.40 (Geneious 5.4.0)
      • toXml

        public org.jdom.Element toXml​(java.lang.String elementName)
        Serializes this PairedReadManager to XML so that it can be reconstructed later using PairedReadManager(org.jdom.Element)
        Parameters:
        elementName - the name of root element to return
        Returns:
        some XML representing this PairedReadManager
      • toXML

        public org.jdom.Element toXML​(Geneious.MajorVersion majorVersion,
                                      jebl.util.ProgressListener progressListener)
        Description copied from interface: XMLSerializable.OldVersionCompatible
        Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious. It is acceptable for the XML to include unnecessary tags that will be ignored by the earlier version. For example if the implementation has only extended the XML since the earlier version, then the XML returned may be identical to the XML returned for the current version.

        See XMLSerializable.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.

        Specified by:
        toXML in interface XMLSerializable.OldVersionCompatible
        Parameters:
        majorVersion - 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 cancelling
        Returns:
        object encoded as a JDOM element
      • removeSequence

        public PairedReadManager removeSequence​(int indexToRemove)
        Removes a sequence from this PairedReadManager, unpairing it with its mate if necessary. If the sequence to be removed is not the last sequence, then all other reads will need to be shuffled down which is inefficient when removing many sequences. Instead in this case, the sequences should be reordered first using reorderSequences(int[]) and then the final sequences deleted in reverse order.
        Parameters:
        indexToRemove - the 0-based index of the sequence to remove.
        Returns:
        either this 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.
      • hasAnyPairedReads

        public boolean hasAnyPairedReads()
        Query whether there there is at least 1 pair of reads managed by this PairedReadManager.
        Returns:
        true if at there is at least 1 pair of reads managed by this PairedReadManager.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • getNumberOfSequencesWithMates

        public int getNumberOfSequencesWithMates()
        Returns the number of sequences which have mates. If all sequences are paired, this is equal to getNumberOfSequences()
        Returns:
        the number of sequences which have mates.
        Since:
        API 4.40 (Geneious 5.4.0)