Skip to content

Commit 6d31cdb

Browse files
committed
Fix issue with tabix index
1 parent 9a90399 commit 6d31cdb

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/main/java/genepi/imputationserver/steps/vcf/VcfFileUtil.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,9 @@ public static void createIndex(String vcfFilename, boolean force) throws IOExcep
248248

249249

250250
public static void createIndex(String vcfFilename) throws IOException {
251-
File vcfFile = new File(vcfFilename);
252-
VCFFileReader reader = new VCFFileReader(vcfFile, false);
253-
SAMSequenceDictionary vcfDict = reader.getFileHeader().getSequenceDictionary();
254-
TabixIndex index = IndexFactory.createTabixIndex(new File(vcfFilename), new VCFCodec(), TabixFormat.VCF, vcfDict);
251+
TabixIndex index = IndexFactory.createTabixIndex(new File(vcfFilename), new VCFCodec(), TabixFormat.VCF, null);
255252
index.writeBasedOnFeatureFile(new File(vcfFilename));
256-
reader.close();
253+
257254
}
258255

259256
}

src/test/java/genepi/imputationserver/steps/QualityControlCommandTest.java

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ public void testQcStatisticsAndLiftOver() throws Exception {
5858

5959
}
6060

61+
@Test
62+
public void testQcStatisticsAndLiftOverHg19ToHg38() throws Exception {
63+
64+
String inputFolder = "test-data/data/chr20-phased";
65+
66+
QualityControlCommand command = buildCommand(inputFolder);
67+
command.setPopulation("eur");
68+
command.setBuild("hg19");
69+
command.setReference("test-data/configs/hapmap-chr20-hg38/hapmap2.json");
70+
command.setChainFile("test-data/configs/hapmap-chr20-hg38/hg19ToHg38.over.chain.gz");
71+
command.call();
72+
OutputReader log = new OutputReader(CLOUDGENE_LOG);
73+
log.view();
74+
75+
}
76+
6177
@Test
6278
public void testQcStatisticsChr20Hg19() throws Exception {
6379

@@ -503,47 +519,34 @@ public void testQcStatisticsFilterSampleCallrate() throws Exception {
503519
@Test
504520
public void testChr23PipelineLifting() throws Exception {
505521

506-
String inputFolder = "test-data/data/chr23-unphased";
507-
508-
// maybe git large files?
509-
if (!new File(
510-
"test-data/configs/hapmap-chrX-hg38/ref-panels/ALL.X.nonPAR.phase1_v3.snps_indels_svs.genotypes.all.noSingleton.recode.hg38.bcf")
511-
.exists()) {
512-
System.out.println("chrX bcf nonPAR file not available");
513-
return;
514-
}
522+
String inputFolder = "test-data/data/chr23-phased";
515523

516524
QualityControlCommand command = buildCommand(inputFolder);
517-
command.setReference("test-data/configs/hapmap-chrX-hg38/phase1.json");
525+
command.setReference("test-data/configs/hapmap-chrX-hg38/hapmap2.json");
526+
command.setChainFile("test-data/configs/hapmap-chr20-hg38/hg19ToHg38.over.chain.gz");
527+
518528
assertEquals(0, (int) command.call());
519529

520530
OutputReader log = new OutputReader(CLOUDGENE_LOG);
521-
522-
assertTrue(log.hasInMemory("Alternative allele frequency > 0.5 sites: 8,973"));
523-
assertTrue(log.hasInMemory("[MESSAGE] [WARN] Excluded sites in total: 18,076"));
531+
assertTrue(log.hasInMemory("Alternative allele frequency > 0.5 sites: 8,972"));
532+
assertTrue(log.hasInMemory("Excluded sites in total: 18,041"));
524533

525534
}
526535

527536
@Test
528537
public void testChrXPipelineLifting() throws Exception {
529538

530-
String inputFolder = "test-data/data/chrX-unphased";
531-
532-
// maybe git large files?
533-
if (!new File(
534-
"test-data/configs/hapmap-chrX-hg38/ref-panels/ALL.X.nonPAR.phase1_v3.snps_indels_svs.genotypes.all.noSingleton.recode.hg38.bcf")
535-
.exists()) {
536-
System.out.println("chrX bcf nonPAR file not available");
537-
return;
538-
}
539+
String inputFolder = "test-data/data/chrX-phased";
539540

540541
QualityControlCommand command = buildCommand(inputFolder);
541-
command.setReference("test-data/configs/hapmap-chrX-hg38/phase1.json");
542+
command.setReference("test-data/configs/hapmap-chrX-hg38/hapmap2.json");
543+
command.setChainFile("test-data/configs/hapmap-chr20-hg38/hg19ToHg38.over.chain.gz");
544+
542545
assertEquals(0, (int) command.call());
543546

544547
OutputReader log = new OutputReader(CLOUDGENE_LOG);
545548
assertTrue(log.hasInMemory("Alternative allele frequency > 0.5 sites: 8,973"));
546-
assertTrue(log.hasInMemory("[MESSAGE] [WARN] Excluded sites in total: 18,076"));
549+
assertTrue(log.hasInMemory("Excluded sites in total: 18,041"));
547550

548551
}
549552

0 commit comments

Comments
 (0)