Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Merge db91f04 into 701301b
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Sep 12, 2022
2 parents 701301b + db91f04 commit 008a914
Show file tree
Hide file tree
Showing 136 changed files with 398 additions and 247 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Check out LFS objects
run: git lfs fetch --all
- name: Set up JDK
uses: actions/setup-java@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions tests/hg19-chr22/Case_1_index.delly2.extra.vcf
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
case_id set_id sv_uuid refseq_gene_id refseq_transcript_id refseq_transcript_coding refseq_effect ensembl_gene_id ensembl_transcript_id ensembl_transcript_coding ensembl_effect
. . UUID 51816 NM_017424.2 TRUE {"transcript_ablation","coding_transcript_variant"} ENSG00000093072 ENST00000262607.3 TRUE {"transcript_ablation","coding_transcript_variant"}
. . UUID 128954 NM_001037814.1 TRUE {"transcript_ablation","coding_transcript_variant"} ENSG00000215568 ENST00000400588.1 TRUE {"transcript_ablation","coding_transcript_variant"}
1 change: 1 addition & 0 deletions tests/hg19-chr22/Case_1_index.delly2.gts.tsv-expected
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
release chromosome chromosome_no bin chromosome2 chromosome_no2 bin2 pe_orientation start end start_ci_left start_ci_right end_ci_left end_ci_right case_id set_id sv_uuid caller sv_type sv_sub_type info num_hom_alt num_hom_ref num_het num_hemi_alt num_hemi_ref genotype
GRCh37 22 22 89 22 22 89 3to5 17400000 17700000 -29 29 -29 29 . . UUID EMBL.DELLYv1.1.3 DEL DEL {"""backgroundCarriers""":0,"""affectedCarriers""":0,"""unaffectedCarriers""":0} 0 2 1 0 0 {"""Case_1_father-N1-DNA1-WGS1""":{"""gt""":"""0/1""","""gq""":14,"""pec""":0,"""pev""":0,"""src""":34,"""srv""":4},"""Case_1_index-N1-DNA1-WGS1""":{"""gt""":"""0/1""","""gq""":14,"""pec""":0,"""pev""":0,"""src""":34,"""srv""":4,"""gt""":"""0/0""","""gq""":35,"""pec""":0,"""pev""":0,"""src""":29,"""srv""":2},"""Case_1_mother-N1-DNA1-WGS1""":{"""gt""":"""0/1""","""gq""":14,"""pec""":0,"""pev""":0,"""src""":34,"""srv""":4,"""gt""":"""0/0""","""gq""":35,"""pec""":0,"""pev""":0,"""src""":29,"""srv""":2,"""gt""":"""0/0""","""gq""":67,"""pec""":0,"""pev""":0,"""src""":32,"""srv""":1}}
4 changes: 2 additions & 2 deletions tests/hg19-chr22/Case_1_index.delly2.vcf.gz
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/hg19-chr22/Case_1_index.delly2.vcf.gz.tbi
Git LFS file not shown
Binary file modified tests/hg19-chr22/Clinvar.tsv.gz
Binary file not shown.
Binary file modified tests/hg19-chr22/HgmdPublicLocus.tsv.gz
Binary file not shown.
7 changes: 5 additions & 2 deletions tests/hg19-chr22/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ VCF=$BASEDIR/wgs_sv_calling/output/bwa.delly2.Case_1_index-N1-DNA1-WGS1/out/bwa.

( \
tabix --only-header $VCF $REGIONS; \
tabix $VCF $REGIONS \
( \
cat Case_1_index.delly2.extra.vcf; \
tabix $VCF $REGIONS; \
) \
| sort -k1,1V -k2,2n \
| uniq; \
| uniq; \b
) \
| bgzip -c \
> Case_1_index.delly2.vcf.gz
Expand Down
10 changes: 7 additions & 3 deletions tests/hg19-chr22/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ JAR=$(ls ../../varfish-annotator-cli/target/varfish-annotator-cli-*.jar | grep -

## prepare

gzip -d -k chr22_part.fa.gz
gzip -d chr22_part.fa.gz > chr22_part.fa

## step 0: help

Expand Down Expand Up @@ -84,9 +84,13 @@ java -jar $JAR annotate-svs \
--db-path /tmp/out.h2.db \
--self-test-chr22-only

diff /tmp/Case_1_index.delly2.gts.tsv Case_1_index.delly2.gts.tsv-expected
awk -F $'\t' 'BEGIN { OFS=FS } { if (NR > 1) $17 = "UUID"; print $0; }' /tmp/Case_1_index.delly2.gts.tsv \
> /tmp/Case_1_index.delly2.gts.tsv.replaced
diff /tmp/Case_1_index.delly2.gts.tsv.replaced Case_1_index.delly2.gts.tsv-expected
diff /tmp/Case_1_index.delly2.db-info.tsv Case_1_index.delly2.db-info.tsv-expected
diff /tmp/Case_1_index.delly2.feature-effects.tsv Case_1_index.delly2.feature-effects.tsv-expected
awk -F $'\t' 'BEGIN { OFS=FS } { if (NR > 1) $3 = "UUID"; print $0; }' /tmp/Case_1_index.delly2.feature-effects.tsv \
> /tmp/Case_1_index.delly2.feature-effects.tsv.replaced
diff /tmp/Case_1_index.delly2.feature-effects.tsv.replaced Case_1_index.delly2.feature-effects.tsv-expected

## if we reach here, everything is fine

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
/** Raised on incompatible VCF files. */
public class IncompatibleVcfException extends Exception {

public IncompatibleVcfException(String message, Throwable cause) {
super(message, cause);
}

public IncompatibleVcfException(String message) {
super(message);
}

public IncompatibleVcfException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,34 +168,18 @@ public String getDefaultSvMethod() {
return defaultSvMethod;
}

public void setDefaultSvMethod(String defaultSvMethod) {
this.defaultSvMethod = defaultSvMethod;
}

public Boolean getSequentialUuids() {
return sequentialUuids;
}

public void setSequentialUuids(Boolean sequentialUuids) {
this.sequentialUuids = sequentialUuids;
}

public String getOptOutFeatures() {
return optOutFeatures;
}

public void setOptOutFeatures(String optOutFeatures) {
this.optOutFeatures = optOutFeatures;
}

public String getWriteBndMates() {
return writeBndMates;
}

public void setWriteBndMates(String writeBndMates) {
this.writeBndMates = writeBndMates;
}

@Override
public String toString() {
return "AnnotateSvsArgs{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ private String buildInfoValue(
VariantContext ctx, GenomeVersion genomeVersion, SVGenomeVariant svGenomeVar) {
final List<String> mappings = new ArrayList<>();

if (args.getOptOutFeatures().contains(FEATURE_SUPPRESS_CARRIER_COUNTS)) {
if (!args.getOptOutFeatures().contains(FEATURE_SUPPRESS_CARRIER_COUNTS)) {
if (svGenomeVar.getType() == Type.BND) {
final String contigName2 =
(genomeVersion == GenomeVersion.HG19)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,14 @@ public boolean isHelp() {
return help;
}

public void setHelp(boolean help) {
this.help = help;
}

public String getDbPath() {
return dbPath;
}

public void setDbPath(String dbPath) {
this.dbPath = dbPath;
}

public boolean isParseable() {
return parseable;
}

public void setParseable(boolean parseable) {
this.parseable = parseable;
}

@Override
public String toString() {
return "DbStatsArgs{"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ public SelfTestFailedException(String message, Throwable cause) {
public SelfTestFailedException(String message) {
super(message);
}

public SelfTestFailedException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,60 +73,6 @@ public static List<Integer> getOverlappingBins(int begin, int end) {
return result;
}

/**
* Given an (0-based, half-open) interval {@code begin:end} return all bins that completely
* contain {@code begin:end}.
*
* @param begin interval start position
* @param end interval end position
* @return the smallest bin that contains {@code begin:end}
*/
public static List<Integer> getContainingBins(int begin, int end) {
final ArrayList<Integer> result = new ArrayList<>();
final int maxBin = getContainingBin(begin, end);
for (int bin : getOverlappingBins(begin, end)) {
if (bin <= maxBin) {
result.add(bin);
}
}
return result;
}

/**
* Given an (0-based, half-open) interval {@code begin:end} return all bins that are completely
* contained by {@code begin:end}.
*
* @param begin interval start position
* @param end interval end position
* @return the smallest bin that contains {@code begin:end}
*/
public static List<Integer> getContainedBins(int begin, int end) {
final ArrayList<Integer> result = new ArrayList<>();
final int minBin = getContainingBin(begin, end);
for (int bin : getOverlappingBins(begin, end)) {
if (bin >= minBin) {
result.add(bin);
}
}
return result;
}

/** Return (0-based, half-open) interval that {@code bin} covers. */
public static int[] getCoveredBin(int bin) {
if (bin < 0 || bin > maxBin) {
throw new RuntimeException("Invalid bin number " + bin + ", max bin is " + maxBin);
}
int shift = binFirstShift;
for (int offset : binOffsets) {
if (offset <= bin) {
final int[] result = {(bin - offset) << shift, (bin + 1 - offset) << shift};
return result;
}
shift += binNextShift;
}
throw new RuntimeException("Unexpected error when computing covered bins");
}

/**
* Helper class for generating the first and last bins overlapping an interval {@code begin:end}.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.bihealth.varfish_annotator;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/** @author <a href="mailto:manuel.holtgrewe@bih-charite.de">Manuel Holtgrewe</a> */
public class VarFishAnnotatorExceptionTest {

@Test
public void testConstructorString() {
Assertions.assertThrows(
VarfishAnnotatorException.class,
() -> {
throw new VarfishAnnotatorException("Test Message");
});
}

@Test
public void testConstructorStringThrowable() {
Assertions.assertThrows(
VarfishAnnotatorException.class,
() -> {
throw new VarfishAnnotatorException("Test Message", new Exception());
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.junit.jupiter.params.provider.ValueSource;

/** Test annotation of VCF files generated with GATK HC for GRCh37 */
public class AnnotateGatkHcVcf37Test {
public class AnnotateGatkHcVcf37Chr1Test {

@TempDir public File tmpFolder;
File h2DbFile;
Expand All @@ -37,11 +37,11 @@ void initEach() {
ensemblSerFile = new File(tmpFolder + "/hg19_ensembl.ser");
refseqSerFile = new File(tmpFolder + "/hg19_refseq_curated.ser");

ResourceUtils.gunzipResourceToFile("/grch37/hs37d5.1.fa.gz", fastaFile);
ResourceUtils.copyResourceToFile("/grch37/hs37d5.1.fa.fai", faiFile);
ResourceUtils.copyResourceToFile("/grch37/small-grch37.h2.db", h2DbFile);
ResourceUtils.copyResourceToFile("/grch37/hg19_ensembl.ser", ensemblSerFile);
ResourceUtils.copyResourceToFile("/grch37/hg19_refseq_curated.ser", refseqSerFile);
ResourceUtils.gunzipResourceToFile("/grch37-chr1/hs37d5.1.fa.gz", fastaFile);
ResourceUtils.copyResourceToFile("/grch37-chr1/hs37d5.1.fa.fai", faiFile);
ResourceUtils.copyResourceToFile("/grch37-chr1/small-grch37.h2.db", h2DbFile);
ResourceUtils.copyResourceToFile("/grch37-chr1/hg19_ensembl.ser", ensemblSerFile);
ResourceUtils.copyResourceToFile("/grch37-chr1/hg19_refseq_curated.ser", refseqSerFile);
}

void runTest(
Expand Down Expand Up @@ -136,7 +136,7 @@ void testWithSingleton(boolean gzipOutput) throws IOException {
runTest(
"bwa.gatk_hc.HG00102.vcf.gz",
null,
"input/grch37",
"input/grch37-chr1",
expectedDbInfo,
expectedGts,
gzipOutput,
Expand Down Expand Up @@ -170,7 +170,7 @@ void testWithTrio(boolean gzipOutput) throws IOException {
runTest(
"bwa.gatk_hc.NA12878.vcf.gz",
null,
"input/grch37",
"input/grch37-chr1",
expectedDbInfo,
expectedGts,
gzipOutput,
Expand All @@ -194,7 +194,7 @@ void testWithAsteriskAllele() throws IOException {
runTest(
"bwa.gatk_hc.HG00102.asterisk_alleles.vcf.gz",
null,
"input/grch37",
"input/grch37-chr1",
expectedDbInfo,
expectedGts,
false,
Expand All @@ -207,7 +207,14 @@ void testSelfTestFails() throws Exception {
final String text =
SystemLambda.tapSystemErr(
() -> {
runTest("bwa.gatk_hc.NA12878.vcf.gz", null, "input/grch37", null, null, false, false);
runTest(
"bwa.gatk_hc.NA12878.vcf.gz",
null,
"input/grch37-chr1",
null,
null,
false,
false);
});
Assertions.assertTrue(text.contains("Problem with database self-test:"));
}
Expand All @@ -230,7 +237,7 @@ void testAnnotateHemiMale() throws Exception {
runTest(
"bwa.gatk_hc.HG00102.hemi.vcf.gz",
"FAM_HG00102.ped",
"input/grch37",
"input/grch37-chr1",
expectedDbInfo,
expectedGts,
false,
Expand All @@ -255,7 +262,7 @@ void testAnnotateHemiFamily() throws Exception {
runTest(
"bwa.gatk_hc.NA12878.hemi.vcf.gz",
"FAM_NA12878.ped",
"input/grch37",
"input/grch37-chr1",
expectedDbInfo,
expectedGts,
false,
Expand Down

0 comments on commit 008a914

Please sign in to comment.