Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
FeatureCodec.getTabixFormat() to encapsulate tabix formatting #669
Conversation
coveralls
commented
Jul 26, 2016
coveralls
commented
Jul 26, 2016
droazen
self-assigned this
Jul 26, 2016
yfarjoun
and 1 other
commented on an outdated diff
Aug 9, 2016
...est/java/htsjdk/variant/vcf/AbstractVCFCodecTest.java
| @@ -50,4 +52,10 @@ public void testCanDecodeFile(String potentialInput, boolean canDecode) { | ||
| Assert.assertEquals(AbstractVCFCodec.canDecodeFile(potentialInput, VCFCodec.VCF4_MAGIC_HEADER), canDecode); | ||
| } | ||
| + @Test | ||
| + public void testGetTabixFormat() { | ||
| + Assert.assertEquals(new VCFCodec().getTabixFormat(), TabixFormat.VCF); | ||
| + Assert.assertEquals(new VCF3Codec().getTabixFormat(), TabixFormat.VCF); | ||
| + } | ||
| + |
|
|
yfarjoun
and 1 other
commented on an outdated diff
Aug 9, 2016
yfarjoun
and 1 other
commented on an outdated diff
Aug 9, 2016
yfarjoun
and 1 other
commented on an outdated diff
Aug 9, 2016
src/main/java/htsjdk/tribble/BinaryFeatureCodec.java
| @@ -40,4 +41,13 @@ public boolean isDone(final PositionalBufferedStream source) { | ||
| throw new RuntimeIOException("Failure reading from stream.", e); | ||
| } | ||
| } | ||
| + | ||
| + /** | ||
| + * Marked as final because binary features could not be tabix indexed | ||
| + */ | ||
| + @Override | ||
| + public final TabixFormat getTabixFormat() { | ||
| + throw new TribbleException("Binary codecs does not support tabix"); | ||
| + } | ||
| + |
|
|
yfarjoun
and 1 other
commented on an outdated diff
Aug 9, 2016
droazen
assigned yfarjoun and unassigned droazen
Aug 9, 2016
lbergelson
and 1 other
commented on an outdated diff
Aug 9, 2016
src/main/java/htsjdk/tribble/index/IndexFactory.java
| @@ -260,11 +260,25 @@ public static LinearIndex createLinearIndex(final File inputFile, final FeatureC | ||
| public static <FEATURE_TYPE extends Feature, SOURCE_TYPE> Index createIndex(final File inputFile, | ||
| final FeatureCodec<FEATURE_TYPE, SOURCE_TYPE> codec, | ||
| final IndexType type) { | ||
| + return createIndex(inputFile, codec, type, null); | ||
| + } | ||
| + | ||
| + /** | ||
| + * Create a index of the specified type with default binning parameters |
|
|
yfarjoun
and 1 other
commented on an outdated diff
Aug 9, 2016
src/main/java/htsjdk/tribble/index/IndexFactory.java
| @@ -318,7 +332,18 @@ public static void writeIndex(final Index idx, final File idxFile) throws IOExce | ||
| return (TabixIndex)createIndex(inputFile, new FeatureIterator<FEATURE_TYPE, SOURCE_TYPE>(inputFile, codec), indexCreator); | ||
| } | ||
| - | ||
| + /** | ||
| + * @param inputFile The file to be indexed. | ||
| + * @param codec Mechanism for reading inputFile. |
|
|
|
|
|
nit-picky comments about newlines and javadoc but otherwise LGTM, thanks! |
yfarjoun
added the
Review-party candidate
label
Aug 9, 2016
|
Back to you, @yfarjoun. If I should squash and rebase let me know. |
coveralls
commented
Aug 10, 2016
|
Changes Unknown when pulling a50ee03 on magicDGS:dgs_featurecodec_tabixformat into * on samtools:master*. |
coveralls
commented
Aug 10, 2016
|
Changes Unknown when pulling a50ee03 on magicDGS:dgs_featurecodec_tabixformat into * on samtools:master*. |
coveralls
commented
Aug 10, 2016
|
Changes Unknown when pulling a50ee03 on magicDGS:dgs_featurecodec_tabixformat into * on samtools:master*. |
yfarjoun
merged commit fba4637
into
samtools:master
Aug 10, 2016
|
thanks! |
magicDGS
referenced
this pull request
in broadinstitute/gatk
Aug 10, 2016
Closed
IndexFeatureFile support for tabix index apart of VCF #2080
jamesemery
added a commit
to jamesemery/htsjdk
that referenced
this pull request
Sep 1, 2016
|
|
magicDGS + jamesemery |
7723019
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
magicDGS commentedJul 26, 2016
•
edited
Description
Current implementation of tabix indexing requires a
TabixFormat, which should be defined by the API user outside the codecs except for the static instances inside the class (VCF and BED). Due to this,IndexFactoryrequires always to provide theTabixFormatwhen creating a new index, not allowing the creation of indexes with a common interface.Nevertheless, when developers implements a new
FeatureCodec, they know how the format for tabix is specified (if it is possible), and others could use it without the need to implement it by themselves.Here I implemented a new default method for
FeatureCodecfor retrieve theTabixFormatassociated, and added some static methods toIndexFactoryto use it. This could be useful in GATK4 toolIndexFeatureFile, which only supports tabix indexing for VCF files.It does not break compatibility because the new method have a default implementation, so other classes don't have to implement it.
Checklist