Move htsjdk to ver 2.9.0 and picard to ver 2.8.3
This commit is contained in:
parent
67baa9046c
commit
1d36d9fd69
|
|
@ -67,42 +67,6 @@ import java.util.ArrayList;
|
|||
*/
|
||||
public class VariantsToVCFIntegrationTest extends WalkerTest {
|
||||
|
||||
@Test
|
||||
public void testVariantsToVCFUsingGeliInput() {
|
||||
List<String> md5 = new ArrayList<String>();
|
||||
md5.add("c73bcc3658b4a4d8bd9d794069d41dbd");
|
||||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" --variant:GeliText " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.lod5.variants.geli.calls" +
|
||||
" -T VariantsToVCF" +
|
||||
" -L 1:10,000,000-11,000,000" +
|
||||
" -sample NA123AB" +
|
||||
" -o %s" +
|
||||
" --no_cmdline_in_header",
|
||||
1, // just one output file
|
||||
md5);
|
||||
executeTest("testVariantsToVCFUsingGeliInput - calls", spec).getFirst();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenotypesToVCFUsingGeliInput() {
|
||||
List<String> md5 = new ArrayList<String>();
|
||||
md5.add("a1771924b58dd633620114ef0f462acb");
|
||||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" --variant:GeliText " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.lod5.genotypes.geli.calls" +
|
||||
" -T VariantsToVCF" +
|
||||
" -L 1:10,100,000-10,200,000" +
|
||||
" -sample NA123AB" +
|
||||
" -o %s" +
|
||||
" --no_cmdline_in_header",
|
||||
1, // just one output file
|
||||
md5);
|
||||
executeTest("testVariantsToVCFUsingGeliInput - genotypes", spec).getFirst();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenotypesToVCFUsingHapMapInput() {
|
||||
List<String> md5 = new ArrayList<String>();
|
||||
|
|
|
|||
|
|
@ -25,15 +25,12 @@
|
|||
|
||||
package org.broadinstitute.gatk.engine.datasources.reads.utilities;
|
||||
|
||||
import htsjdk.samtools.util.BlockGunzipper;
|
||||
import htsjdk.samtools.util.BlockCompressedInputStream;
|
||||
import org.broadinstitute.gatk.utils.commandline.CommandLineProgram;
|
||||
import org.broadinstitute.gatk.utils.commandline.Input;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Test decompression of a single BGZF block.
|
||||
|
|
@ -45,20 +42,12 @@ public class UnzipSingleBlock extends CommandLineProgram {
|
|||
@Input(fullName = "compressed_block_size", shortName = "cbs", doc = "size of compressed block", required = true)
|
||||
private int compressedBufferSize;
|
||||
|
||||
public int execute() throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||
byte[] compressedBuffer = new byte[(int)blockFile.length()];
|
||||
byte[] uncompressedBuffer = new byte[65536];
|
||||
public int execute() throws IOException {
|
||||
final byte[] uncompressedBuffer = new byte[65536];
|
||||
|
||||
FileInputStream fis = new FileInputStream(blockFile);
|
||||
fis.read(compressedBuffer);
|
||||
fis.close();
|
||||
|
||||
BlockGunzipper gunzipper = new BlockGunzipper();
|
||||
final BlockCompressedInputStream gunzipper = new BlockCompressedInputStream(blockFile);
|
||||
gunzipper.setCheckCrcs(true);
|
||||
Method unzipBlock = BlockGunzipper.class.getDeclaredMethod("unzipBlock",byte[].class,byte[].class,Integer.TYPE);
|
||||
unzipBlock.setAccessible(true);
|
||||
|
||||
unzipBlock.invoke(gunzipper,uncompressedBuffer,compressedBuffer,compressedBufferSize);
|
||||
gunzipper.read(uncompressedBuffer);
|
||||
|
||||
System.out.printf("SUCCESS!%n");
|
||||
|
||||
|
|
@ -70,10 +59,10 @@ public class UnzipSingleBlock extends CommandLineProgram {
|
|||
* @param argv Command-line argument text.
|
||||
* @throws Exception on error.
|
||||
*/
|
||||
public static void main(String[] argv) throws Exception {
|
||||
public static void main(final String[] argv) throws Exception {
|
||||
int returnCode = 0;
|
||||
try {
|
||||
UnzipSingleBlock instance = new UnzipSingleBlock();
|
||||
final UnzipSingleBlock instance = new UnzipSingleBlock();
|
||||
start(instance, argv);
|
||||
returnCode = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
<test.listeners>org.testng.reporters.FailedReporter,org.testng.reporters.JUnitXMLReporter,org.broadinstitute.gatk.utils.TestNGTestTransformer,org.broadinstitute.gatk.utils.GATKTextReporter,org.uncommons.reportng.HTMLReporter</test.listeners>
|
||||
|
||||
<!-- Version numbers for picard and htsjdk -->
|
||||
<htsjdk.version>2.8.1</htsjdk.version>
|
||||
<picard.version>2.7.2</picard.version>
|
||||
<htsjdk.version>2.9.0</htsjdk.version>
|
||||
<picard.version>2.8.3</picard.version>
|
||||
</properties>
|
||||
|
||||
<!-- Dependency configuration (versions, etc.) -->
|
||||
|
|
|
|||
|
|
@ -25,15 +25,10 @@
|
|||
|
||||
package org.broadinstitute.gatk.utils.refdata;
|
||||
|
||||
import htsjdk.samtools.util.SequenceUtil;
|
||||
import htsjdk.tribble.Feature;
|
||||
import htsjdk.tribble.annotation.Strand;
|
||||
import htsjdk.tribble.gelitext.GeliTextFeature;
|
||||
import org.broadinstitute.gatk.utils.contexts.ReferenceContext;
|
||||
import org.broadinstitute.gatk.utils.GenomeLoc;
|
||||
import org.broadinstitute.gatk.utils.classloader.PluginManager;
|
||||
import org.broadinstitute.gatk.utils.codecs.hapmap.RawHapMapFeature;
|
||||
import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils;
|
||||
import htsjdk.variant.variantcontext.*;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -59,10 +54,10 @@ public class VariantContextAdaptors {
|
|||
//
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private static Map<Class<? extends Feature>,VCAdaptor> adaptors = new HashMap<Class<? extends Feature>,VCAdaptor>();
|
||||
private static Map<Class<? extends Feature>,VCAdaptor> adaptors = new HashMap<>();
|
||||
|
||||
static {
|
||||
PluginManager<VCAdaptor> vcAdaptorManager = new PluginManager<VCAdaptor>(VCAdaptor.class);
|
||||
PluginManager<VCAdaptor> vcAdaptorManager = new PluginManager<>(VCAdaptor.class);
|
||||
List<VCAdaptor> adaptorInstances = vcAdaptorManager.createAllTypes();
|
||||
for(VCAdaptor adaptor: adaptorInstances)
|
||||
adaptors.put(adaptor.getAdaptableFeatureType(),adaptor);
|
||||
|
|
@ -110,67 +105,6 @@ public class VariantContextAdaptors {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// GELI to VariantContext
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private static class GeliTextAdaptor implements VCAdaptor {
|
||||
/**
|
||||
* Converts Geli text records to VariantContext.
|
||||
* @return GeliTextFeature.
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends Feature> getAdaptableFeatureType() { return GeliTextFeature.class; }
|
||||
|
||||
/**
|
||||
* convert to a Variant Context, given:
|
||||
* @param name the name of the ROD
|
||||
* @param input the Rod object, in this case a RodGeliText
|
||||
* @param ref the reference context
|
||||
* @return a VariantContext object
|
||||
*/
|
||||
@Override
|
||||
public VariantContext convert(String name, Object input, ReferenceContext ref) {
|
||||
GeliTextFeature geli = (GeliTextFeature)input;
|
||||
if ( ! Allele.acceptableAlleleBases(String.valueOf(geli.getRefBase())) )
|
||||
return null;
|
||||
Allele refAllele = Allele.create(String.valueOf(geli.getRefBase()), true);
|
||||
|
||||
// make sure we can convert it
|
||||
if ( geli.getGenotype().isHet() || !geli.getGenotype().containsBase(geli.getRefBase())) {
|
||||
// add the reference allele
|
||||
List<Allele> alleles = new ArrayList<Allele>();
|
||||
List<Allele> genotypeAlleles = new ArrayList<Allele>();
|
||||
// add all of the alt alleles
|
||||
for ( char alt : geli.getGenotype().toString().toCharArray() ) {
|
||||
if ( ! Allele.acceptableAlleleBases(String.valueOf(alt)) ) {
|
||||
return null;
|
||||
}
|
||||
Allele allele = Allele.create(String.valueOf(alt), false);
|
||||
if (!alleles.contains(allele) && !refAllele.basesMatch(allele.getBases())) alleles.add(allele);
|
||||
|
||||
// add the allele, first checking if it's reference or not
|
||||
if (!refAllele.basesMatch(allele.getBases())) genotypeAlleles.add(allele);
|
||||
else genotypeAlleles.add(refAllele);
|
||||
}
|
||||
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
Collection<Genotype> genotypes = new ArrayList<Genotype>();
|
||||
Genotype call = GenotypeBuilder.create(name, genotypeAlleles);
|
||||
|
||||
// add the call to the genotype list, and then use this list to create a VariantContext
|
||||
genotypes.add(call);
|
||||
alleles.add(refAllele);
|
||||
GenomeLoc loc = ref.getGenomeLocParser().createGenomeLoc(geli.getChr(),geli.getStart());
|
||||
return new VariantContextBuilder(name, loc.getContig(), loc.getStart(), loc.getStop(), alleles).genotypes(genotypes).log10PError(-1 * geli.getLODBestToReference()).attributes(attributes).make();
|
||||
} else
|
||||
return null; // can't handle anything else
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// HapMap to VariantContext
|
||||
|
|
@ -203,7 +137,7 @@ public class VariantContextAdaptors {
|
|||
if ( index < 0 )
|
||||
return null; // we weren't given enough reference context to create the VariantContext
|
||||
|
||||
HashSet<Allele> alleles = new HashSet<Allele>();
|
||||
HashSet<Allele> alleles = new HashSet<>();
|
||||
Allele refSNPAllele = Allele.create(ref.getBase(), true);
|
||||
int deletionLength = -1;
|
||||
|
||||
|
|
@ -231,7 +165,7 @@ public class VariantContextAdaptors {
|
|||
|
||||
String a1 = genotypeStrings[i].substring(0,1);
|
||||
String a2 = genotypeStrings[i].substring(1);
|
||||
ArrayList<Allele> myAlleles = new ArrayList<Allele>(2);
|
||||
ArrayList<Allele> myAlleles = new ArrayList<>(2);
|
||||
|
||||
// use the mapping to actual alleles, if available
|
||||
if ( alleleMap != null ) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ package org.broadinstitute.gatk.utils.codecs.hapmap;
|
|||
import htsjdk.tribble.annotation.Strand;
|
||||
import htsjdk.tribble.readers.LineIterator;
|
||||
import htsjdk.tribble.readers.LineIteratorImpl;
|
||||
import htsjdk.tribble.readers.LineReaderUtil;
|
||||
import htsjdk.tribble.readers.SynchronousLineReader;
|
||||
import htsjdk.tribble.readers.PositionalBufferedStream;
|
||||
import org.broadinstitute.gatk.utils.BaseTest;
|
||||
import org.testng.Assert;
|
||||
|
|
@ -160,11 +160,11 @@ public class HapMapUnitTest extends BaseTest {
|
|||
Assert.assertFalse(codec.canDecode("filename." + RawHapMapCodec.FILE_EXT + EXTRA_CHAR));
|
||||
Assert.assertFalse(codec.canDecode("filename" + RawHapMapCodec.FILE_EXT));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public LineIterator getLineIterator() {
|
||||
try {
|
||||
return new LineIteratorImpl(LineReaderUtil.fromBufferedStream(new PositionalBufferedStream(new FileInputStream(hapMapFile))));
|
||||
|
||||
return new LineIteratorImpl(new SynchronousLineReader(new PositionalBufferedStream(new FileInputStream(hapMapFile))));
|
||||
} catch (FileNotFoundException e) {
|
||||
Assert.fail("Unable to open hapmap file : " + hapMapFile);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue