-
Notifications
You must be signed in to change notification settings - Fork 242
Support reference bundles. #1713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,9 +9,18 @@ | |||||
| import htsjdk.beta.plugin.hapref.HaploidReferenceCodec; | ||||||
| import htsjdk.beta.plugin.hapref.HaploidReferenceDecoder; | ||||||
| import htsjdk.beta.plugin.hapref.HaploidReferenceDecoderOptions; | ||||||
| import htsjdk.io.HtsPath; | ||||||
| import htsjdk.io.IOPath; | ||||||
| import htsjdk.samtools.reference.ReferenceSequenceFileFactory; | ||||||
| import htsjdk.samtools.util.GZIIndex; | ||||||
| import htsjdk.samtools.util.IOUtil; | ||||||
| import htsjdk.utils.ValidationUtils; | ||||||
|
|
||||||
| import java.io.IOException; | ||||||
| import java.nio.file.Files; | ||||||
| import java.nio.file.Path; | ||||||
| import java.util.function.Function; | ||||||
|
|
||||||
| /** | ||||||
| * Class with methods for resolving inputs and outputs to haploid reference encoders and decoders. | ||||||
| * <p> | ||||||
|
|
@@ -66,9 +75,7 @@ public HaploidReferenceDecoder getHaploidReferenceDecoder( | |||||
| ValidationUtils.nonNull(inputPath, "Input path"); | ||||||
| ValidationUtils.nonNull(HaploidReferenceDecoderOptions, "Decoder options"); | ||||||
|
|
||||||
| final Bundle referenceBundle = new BundleBuilder().addPrimary( | ||||||
| new IOPathResource(inputPath, BundleResourceType.CT_HAPLOID_REFERENCE)).build(); | ||||||
|
|
||||||
| final Bundle referenceBundle = referenceBundleFromFastaPath(inputPath, HtsPath::new); | ||||||
| return getHaploidReferenceDecoder(referenceBundle, HaploidReferenceDecoderOptions); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -110,4 +117,47 @@ public HaploidReferenceDecoder getHaploidReferenceDecoder( | |||||
| return (HaploidReferenceDecoder) resolveForDecoding(inputBundle).getDecoder(inputBundle, HaploidReferenceDecoderOptions); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Create q reference bundle given only a fasta path, including an index and a dictionary | ||||||
|
||||||
| * Create q reference bundle given only a fasta path, including an index and a dictionary | |
| * Create a reference bundle given only a fasta path, including an index and a dictionary |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |||||
|
|
||||||
| package htsjdk.samtools.reference; | ||||||
|
|
||||||
| import htsjdk.io.IOPath; | ||||||
| import htsjdk.samtools.Defaults; | ||||||
| import htsjdk.samtools.SAMException; | ||||||
| import htsjdk.samtools.SAMSequenceDictionary; | ||||||
|
|
@@ -64,6 +65,21 @@ public FastaSequenceFile(final Path path, final boolean truncateNamesAtWhitespac | |||||
| this.in = new FastLineReader(IOUtil.openFileForReading(path)); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Constructs a FastaSequenceFile that reads from the specified fasta and dictionary file. Makes no | ||||||
| * assumptions that the fata and dict file are in the same directory. | ||||||
|
||||||
| * assumptions that the fata and dict file are in the same directory. | |
| * assumptions that the fasta and dict file are in the same directory. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,18 +24,16 @@ | |||||
|
|
||||||
| package htsjdk.samtools.reference; | ||||||
|
|
||||||
| import htsjdk.io.IOPath; | ||||||
| import htsjdk.samtools.SAMException; | ||||||
| import htsjdk.samtools.SAMSequenceDictionary; | ||||||
| import htsjdk.samtools.seekablestream.ReadableSeekableStreamByteChannel; | ||||||
| import htsjdk.samtools.seekablestream.SeekableStream; | ||||||
| import htsjdk.samtools.util.BlockCompressedInputStream; | ||||||
| import htsjdk.samtools.util.IOUtil; | ||||||
|
|
||||||
| import java.io.BufferedInputStream; | ||||||
| import java.io.File; | ||||||
| import java.io.FileNotFoundException; | ||||||
| import java.io.IOException; | ||||||
| import java.io.InputStream; | ||||||
| import java.nio.ByteBuffer; | ||||||
| import java.nio.channels.FileChannel; | ||||||
| import java.nio.channels.SeekableByteChannel; | ||||||
|
|
@@ -89,6 +87,28 @@ public IndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| */ | ||||||
| /** | ||||||
| * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. | ||||||
| * | ||||||
| * @param path The file to open. | ||||||
| * @param dictPath the dictionar path (may be null) | ||||||
|
||||||
| * @param dictPath the dictionar path (may be null) | |
| * @param dictPath the dictionary path (may be null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should add getChannel methods to IOPath. We have getStream ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: q