Goby API goby-869 (20120309094456)

edu.cornell.med.icb.goby.alignments
Class ConcatAlignmentReader

java.lang.Object
  extended by edu.cornell.med.icb.goby.alignments.AbstractAlignmentReader
      extended by edu.cornell.med.icb.goby.alignments.AbstractConcatAlignmentReader
          extended by edu.cornell.med.icb.goby.alignments.ConcatAlignmentReader
All Implemented Interfaces:
Closeable, Iterable<Alignments.AlignmentEntry>, Iterator<Alignments.AlignmentEntry>
Direct Known Subclasses:
ConcatSortedAlignmentReader

public class ConcatAlignmentReader
extends AbstractConcatAlignmentReader

Read over a set of alignments. This aligner concatenates entries from the input alignment. Reference sequences must match exactly across the input alignments. Query are assumed to be entirely distinct and will be treated as independent observations (e.g., reads from multiple independent samples). To this effect, alignment entries read from different input basenames, which would otherwise share an identical query index, are renumbered with distinct query indices.

Author:
Fabien Campagne Date: May 20, 2009 Time: 5:06:01 PM

Field Summary
protected  int activeIndex
           
protected  boolean adjustQueryIndices
           
protected  AlignmentReader[] readers
           
protected  IntSet readersWithMoreEntries
           
 
Fields inherited from class edu.cornell.med.icb.goby.alignments.AbstractConcatAlignmentReader
adjustSampleIndices
 
Fields inherited from class edu.cornell.med.icb.goby.alignments.AbstractAlignmentReader
alignerName, alignerVersion, constantLength, constantQueryLengths, largestQueryIndex, numberOfQueries, numberOfTargets, queryIdentifiers, sampleBasenames, smallestQueryIndex, targetIdentifiers, targetLengths
 
Constructor Summary
ConcatAlignmentReader(AlignmentReaderFactory alignmentReaderFactory, boolean adjustQueryIndices, int startReferenceIndex, int startPosition, int endReferenceIndex, int endPosition, String... basenames)
          Construct an alignment reader over a set of alignments.
ConcatAlignmentReader(AlignmentReaderFactory alignmentReaderFactory, boolean adjustQueryIndices, String... basenames)
          Construct an alignment reader over a set of alignments.
ConcatAlignmentReader(boolean adjustQueryIndices, String... basenames)
          Construct an alignment reader over a set of alignments.
ConcatAlignmentReader(String... basenames)
          Construct an alignment reader over a set of alignments.
 
Method Summary
 void close()
          Close the underlying readers.
 String getAlignerName()
           
 String getAlignerVersion()
           
 ObjectList<ReferenceLocation> getLocations(int modulo)
           
 int getNumberOfAlignedReads()
           
 Properties getStatistics()
          Obtain statistics about this alignment as a Java property instance.
 boolean hasNext()
          Returns true if the input has more entries.
 Iterator<Alignments.AlignmentEntry> iterator()
          Iterator over alignment entries.
protected  int mergedQueryIndex(int queryIndex)
           
 Alignments.AlignmentEntry next()
          Returns the next alignment entry from the input stream.
 void readHeader()
          Read the header of this alignment.
 void remove()
          This operation is not supported by this iterator.
 void setAdjustQueryIndices(boolean adjustQueryIndices)
          Deprecated.  
 
Methods inherited from class edu.cornell.med.icb.goby.alignments.AbstractConcatAlignmentReader
setAdjustSampleIndices
 
Methods inherited from class edu.cornell.med.icb.goby.alignments.AbstractAlignmentReader
getBasename, getBasenames, getLargestSplitQueryIndex, getNumberOfQueries, getNumberOfTargets, getQueryIdentifiers, getSampleBasename, getSmallestSplitQueryIndex, getTargetIdentifiers, getTargetLength, getTargetLength, isConstantQueryLengths, isHeaderLoaded, setHeaderLoaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readers

protected final AlignmentReader[] readers

readersWithMoreEntries

protected final IntSet readersWithMoreEntries

activeIndex

protected int activeIndex

adjustQueryIndices

protected boolean adjustQueryIndices
Constructor Detail

ConcatAlignmentReader

public ConcatAlignmentReader(String... basenames)
                      throws IOException
Construct an alignment reader over a set of alignments. Please note that the constructor access the header of each individual alignment to check reference sequence identity and obtain the number of queries in each input alignment. This version uses adjustQueryIndices as the default true.

Parameters:
basenames - Basenames of the individual alignemnts to combine.
Throws:
IOException - If an error occurs reading the header of the alignments.

ConcatAlignmentReader

public ConcatAlignmentReader(boolean adjustQueryIndices,
                             String... basenames)
                      throws IOException
Construct an alignment reader over a set of alignments. Please note that the constructor access the header of each individual alignment to check reference sequence identity and obtain the number of queries in each input alignment. This version uses adjustQueryIndices as the default true.

Parameters:
basenames - Basenames of the individual alignemnts to combine.
adjustQueryIndices - if we need to adjustQueryIndices
Throws:
IOException - If an error occurs reading the header of the alignments.

ConcatAlignmentReader

public ConcatAlignmentReader(AlignmentReaderFactory alignmentReaderFactory,
                             boolean adjustQueryIndices,
                             String... basenames)
                      throws IOException
Construct an alignment reader over a set of alignments. Please note that the constructor access the header of each individual alignment to check reference sequence identity and obtain the number of queries in each input alignment.

Parameters:
alignmentReaderFactory - Factory to create new alignmentReaders.
adjustQueryIndices - if we need to adjustQueryIndices
basenames - Basenames of the individual alignemnts to combine.
Throws:
IOException - If an error occurs reading the header of the alignments.

ConcatAlignmentReader

public ConcatAlignmentReader(AlignmentReaderFactory alignmentReaderFactory,
                             boolean adjustQueryIndices,
                             int startReferenceIndex,
                             int startPosition,
                             int endReferenceIndex,
                             int endPosition,
                             String... basenames)
                      throws IOException
Construct an alignment reader over a set of alignments. Please note that the constructor access the header of each individual alignment to check reference sequence identity and obtain the number of queries in each input alignment.

Parameters:
alignmentReaderFactory - Factory to create new alignmentReaders.
adjustQueryIndices - if we need to adjustQueryIndices
startReferenceIndex - Index of the reference for the start position.
startPosition - Position on the reference for the start position.
endReferenceIndex - Index of the reference for the end position.
endPosition - Position on the reference for the end position.
basenames - Basenames of the individual alignemnts to combine.
Throws:
IOException - If an error occurs reading the header of the alignments.
Method Detail

readHeader

public final void readHeader()
                      throws IOException
Read the header of this alignment.

Specified by:
readHeader in class AbstractAlignmentReader
Throws:
IOException - If an error occurs.

mergedQueryIndex

protected int mergedQueryIndex(int queryIndex)

iterator

public final Iterator<Alignments.AlignmentEntry> iterator()
Iterator over alignment entries.

Returns:
an iterator over the alignment entries.

hasNext

public boolean hasNext()
Returns true if the input has more entries.

Returns:
true if the input has more entries, false otherwise.

getAlignerName

public String getAlignerName()
Overrides:
getAlignerName in class AbstractAlignmentReader
Returns:
The list of aligner names with duplicates removed

getAlignerVersion

public String getAlignerVersion()
Overrides:
getAlignerVersion in class AbstractAlignmentReader
Returns:
The list of aligner versions with duplicates removed

next

public Alignments.AlignmentEntry next()
Returns the next alignment entry from the input stream.

Returns:
the alignment read entry from the input stream.

remove

public void remove()
This operation is not supported by this iterator.


setAdjustQueryIndices

@Deprecated
public void setAdjustQueryIndices(boolean adjustQueryIndices)
Deprecated. 


getStatistics

public Properties getStatistics()
Obtain statistics about this alignment as a Java property instance.

Returns:
statistics about this alignment

getNumberOfAlignedReads

public int getNumberOfAlignedReads()

close

public void close()
           throws IOException
Close the underlying readers.

Throws:
IOException - if an I/O error occurs

getLocations

public ObjectList<ReferenceLocation> getLocations(int modulo)
                                           throws IOException
Throws:
IOException

Goby API goby-869 (20120309094456)

Copyright © 2009-2012 Institute for Computational Biomedicine, All Rights Reserved.