Skip to content

Commit

Permalink
Bachelor:
Browse files Browse the repository at this point in the history
- remove mappability and hotspot
- fail if any input files are missing
  • Loading branch information
charlesshale committed Sep 24, 2019
1 parent a60f92b commit 86d9950
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ private void run()

if(!mConfig.IsBatchMode)
{
mGermlineVcfParser.run(mConfig.GermlineVcf, mConfig.SampleId, mConfig.OutputDir);
if(!mGermlineVcfParser.run(mConfig.GermlineVcf, mConfig.SampleId, mConfig.OutputDir))
{
LOGGER.error("germline VCF parse failed");
return;
}

final List<BachelorGermlineVariant> bachelorRecords = mGermlineVcfParser.getBachelorRecords();
mVariantEnricher.run(bachelorRecords);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public void write(final String sampleId, final List<GermlineVariant> germlineVar
Tables.GERMLINEVARIANT.HGVSPROTEIN,
Tables.GERMLINEVARIANT.HGVSCODING,
Tables.GERMLINEVARIANT.BIALLELIC,
Tables.GERMLINEVARIANT.HOTSPOT,
Tables.GERMLINEVARIANT.MAPPABILITY,
Tables.GERMLINEVARIANT.MINORALLELEPLOIDY,
Tables.GERMLINEVARIANT.REFSTATUS,
Tables.GERMLINEVARIANT.MODIFIED);
Expand Down Expand Up @@ -86,8 +84,6 @@ public void write(final String sampleId, final List<GermlineVariant> germlineVar
variant.hgvsProtein(),
variant.hgvsCoding(),
variant.biallelic(),
variant.hotspot(),
DatabaseUtil.decimal(variant.mappability()),
DatabaseUtil.decimal(variant.minorAllelePloidy()),
variant.isHomozygous() ? "HOM" : "HET",
timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ public static void addCmdLineOptions(Options options)

public List<BachelorGermlineVariant> getBachelorRecords() { return mProgram.getVariants(); }

public void run(final String vcfFile, String sampleId, String singleSampleOutputDir)
public boolean run(final String vcfFile, String sampleId, String singleSampleOutputDir)
{
if (mConfig.ProgramConfigMap.isEmpty())
{
LOGGER.error("No programs loaded, exiting");
return;
return false;
}

if(!Files.exists(Paths.get(vcfFile)))
{
LOGGER.info("sampleId({}) germline VCF({}) not found", sampleId, vcfFile);
return;
return false;
}

LOGGER.info("sampleId({}) reading germline VCF({})", sampleId, vcfFile);
Expand All @@ -82,8 +82,9 @@ public void run(final String vcfFile, String sampleId, String singleSampleOutput
if(mProgram.getVariants().isEmpty())
{
LOGGER.debug("no valid variants found");
return;
}

return true;
}

private void processVCF(final String sampleId, final File vcf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,6 @@ private final List<GermlineVariant> convert(final List<BachelorGermlineVariant>
.hgvsProtein(bachRecord.HgvsProtein)
.hgvsCoding(bachRecord.HgvsCoding)
.biallelic(bachRecord.isBiallelic())
.hotspot(enrichedVariant.isHotspot())
.mappability(enrichedVariant.mappability())
.minorAllelePloidy(enrichedVariant.minorAllelePloidy())
.program(bachRecord.Program)
.variantId(bachRecord.VariantId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public BachelorConfig(final CommandLine cmd)
OutputDir = sampleOutputDir;

PurpleDataDir = cmd.getOptionValue(PURPLE_DATA_DIRECTORY, "");

if(GermlineVcf == null || BamFile == null || RefGenomeFile == null)
{
LOGGER.error("missing input files");
mIsValid = false;
}
}

public boolean isValid() { return mIsValid; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public abstract class GermlineVariant
public abstract String hgvsProtein();
public abstract String hgvsCoding();
public abstract boolean biallelic();
public abstract boolean hotspot();
public abstract double mappability();
public abstract double minorAllelePloidy();

// other fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ private static String header() {
.add("hgvsProtein")
.add("hgvsCoding")
.add("biallelic")
.add("hotspot")
.add("mappability")
.add("minorAllelePloidy")
.add("program")
.add("variantId")
Expand Down Expand Up @@ -122,8 +120,6 @@ public static String toString(@NotNull final GermlineVariant data)
.add(String.valueOf(data.hgvsProtein()))
.add(String.valueOf(data.hgvsCoding()))
.add(String.valueOf(data.biallelic()))
.add(String.valueOf(data.hotspot()))
.add(String.valueOf(data.mappability()))
.add(String.valueOf(data.minorAllelePloidy()))
.add(String.valueOf(data.program()))
.add(String.valueOf(data.variantId()))
Expand Down Expand Up @@ -169,8 +165,6 @@ private static GermlineVariant fromString(@NotNull final String data)
.hgvsProtein(values[index++])
.hgvsCoding(values[index++])
.biallelic(Boolean.valueOf(values[index++]))
.hotspot(Boolean.valueOf(values[index++]))
.mappability(Double.valueOf(values[index++]))
.minorAllelePloidy(Double.valueOf(values[index++]))
.program(values[index++])
.variantId(values[index++])
Expand Down
2 changes: 0 additions & 2 deletions patient-db/src/main/resources/generate_database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,6 @@ CREATE TABLE germlineVariant
hgvsProtein varchar(255) NOT NULL,
hgvsCoding varchar(255) NOT NULL,
biallelic BOOLEAN NOT NULL,
hotspot BOOLEAN NOT NULL,
mappability DOUBLE PRECISION NOT NULL,
minorAllelePloidy DOUBLE PRECISION NOT NULL,
refStatus varchar(20) NOT NULL,
PRIMARY KEY (id),
Expand Down
4 changes: 3 additions & 1 deletion patient-db/src/main/resources/patches/bachelor_1.9.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ALTER TABLE germlineVariant
DROP COLUMN source,
DROP COLUMN program;
DROP COLUMN program,
DROP COLUMN hotspot,
DROP COLUMN mappability;

0 comments on commit 86d9950

Please sign in to comment.