Package org.disq_bio.disq
Class HtsjdkReadsRddStorage
- java.lang.Object
-
- org.disq_bio.disq.HtsjdkReadsRddStorage
-
public class HtsjdkReadsRddStorage extends Object
The entry point for reading or writing aHtsjdkReadsRdd.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HtsjdkReadsRddStoragemakeDefault(org.apache.spark.api.java.JavaSparkContext sparkContext)Create aHtsjdkReadsRddStoragefrom a Spark context object.HtsjdkReadsRddread(String path)Read reads from the given path.<T extends htsjdk.samtools.util.Locatable>
HtsjdkReadsRddread(String path, HtsjdkReadsTraversalParameters<T> traversalParameters)Read reads from the given path, using the given traversal parameters to filter the reads.HtsjdkReadsRddStoragereferenceSourcePath(String referenceSourcePath)HtsjdkReadsRddStoragesbiIndexGranularity(long sbiIndexGranularity)HtsjdkReadsRddStoragesplitSize(int splitSize)HtsjdkReadsRddStorageuseNio(boolean useNio)HtsjdkReadsRddStoragevalidationStringency(htsjdk.samtools.ValidationStringency validationStringency)voidwrite(HtsjdkReadsRdd htsjdkReadsRdd, String path, WriteOption... writeOptions)Write reads to a file or files specified by the given path.
-
-
-
Method Detail
-
makeDefault
public static HtsjdkReadsRddStorage makeDefault(org.apache.spark.api.java.JavaSparkContext sparkContext)
Create aHtsjdkReadsRddStoragefrom a Spark context object.- Parameters:
sparkContext- the Spark context to use- Returns:
- a
HtsjdkReadsRddStorage
-
splitSize
public HtsjdkReadsRddStorage splitSize(int splitSize)
- Parameters:
splitSize- the requested size of file splits in bytes when reading- Returns:
- the current
HtsjdkReadsRddStorage
-
validationStringency
public HtsjdkReadsRddStorage validationStringency(htsjdk.samtools.ValidationStringency validationStringency)
- Parameters:
validationStringency- the validation stringency for reading- Returns:
- the current
HtsjdkReadsRddStorage
-
useNio
public HtsjdkReadsRddStorage useNio(boolean useNio)
- Parameters:
useNio- whether to use NIO or the Hadoop filesystem (default) for file operations- Returns:
- the current
HtsjdkReadsRddStorage
-
referenceSourcePath
public HtsjdkReadsRddStorage referenceSourcePath(String referenceSourcePath)
- Parameters:
referenceSourcePath- path to the reference; only required when reading CRAM.- Returns:
- the current
HtsjdkReadsRddStorage
-
sbiIndexGranularity
public HtsjdkReadsRddStorage sbiIndexGranularity(long sbiIndexGranularity)
- Parameters:
sbiIndexGranularity- the granularity to use when writing SBI index files; only used when writing single BAM files.- Returns:
- the current
HtsjdkReadsRddStorage
-
read
public HtsjdkReadsRdd read(String path) throws IOException
Read reads from the given path. The input files may be in any format (BAM/CRAM/SAM).- Parameters:
path- the file or directory to read from- Returns:
- a
HtsjdkReadsRddthat allows access to the reads - Throws:
IOException- if an IO error occurs while determining the format of the files and reading the header
-
read
public <T extends htsjdk.samtools.util.Locatable> HtsjdkReadsRdd read(String path, HtsjdkReadsTraversalParameters<T> traversalParameters) throws IOException
Read reads from the given path, using the given traversal parameters to filter the reads. The input files may be in any format (BAM/CRAM/SAM).- Type Parameters:
T- the type of Locatable for specifying intervals- Parameters:
path- the file or directory to read fromtraversalParameters- parameters that determine which reads should be returned, allows filtering by interval- Returns:
- a
HtsjdkReadsRddthat allows access to the reads - Throws:
IOException- if an IO error occurs while determining the format of the files
-
write
public void write(HtsjdkReadsRdd htsjdkReadsRdd, String path, WriteOption... writeOptions) throws IOException
Write reads to a file or files specified by the given path. Write options may be specified to control the format to write in (BAM/CRAM/SAM, if not clear from the path extension), and the number of files to write (single vs. multiple).- Parameters:
htsjdkReadsRdd- aHtsjdkReadsRddcontaining the header and the readspath- the file or directory to write towriteOptions- options to control aspects of how to write the reads (e.g.ReadsFormatWriteOptionandFileCardinalityWriteOption- Throws:
IOException- if an IO error occurs while writing
-
-