diff --git a/model/src/main/java/org/gorpipe/gor/driver/DataSource.java b/model/src/main/java/org/gorpipe/gor/driver/DataSource.java index 894b47a7..4ce2fb04 100644 --- a/model/src/main/java/org/gorpipe/gor/driver/DataSource.java +++ b/model/src/main/java/org/gorpipe/gor/driver/DataSource.java @@ -87,7 +87,9 @@ default String getAccessValidationPath() { /** * Get date type - e.g. BAM, GOR .. for files. */ - DataType getDataType(); + default DataType getDataType() { + return DataType.fromFileName(getName()); + }; /** * Does this source support writing diff --git a/model/src/main/java/org/gorpipe/gor/driver/meta/DataType.java b/model/src/main/java/org/gorpipe/gor/driver/meta/DataType.java index 40edac1b..ab89e0c8 100644 --- a/model/src/main/java/org/gorpipe/gor/driver/meta/DataType.java +++ b/model/src/main/java/org/gorpipe/gor/driver/meta/DataType.java @@ -31,36 +31,36 @@ * Created by villi on 23/08/15. */ public enum DataType { - GOR(VARIANTS, ".gor"), - GORZ(VARIANTS, ".gorz"), - GORGZ(VARIANTS, ".gor.gz"), + GOR(VARIANTS, ".gor", true), + GORZ(VARIANTS, ".gorz", true), + GORGZ(VARIANTS, ".gor.gz", true), PARQUET(VARIANTS, ".parquet"), GORI(INDEX, ".gori"), SAM(VARIANTS, ".sam"), - BAM(VARIANTS, ".bam"), - BGEN(VARIANTS, ".bgen"), + BAM(VARIANTS, ".bam", true), + BAI(INDEX, ".bai"), + BGEN(VARIANTS, ".bgen", true), BGI(INDEX, ".bgi"), VCF(VARIANTS, ".vcf"), - GVCF(VARIANTS, ".gvcf"), + GVCF(VARIANTS, ".gvcf", true), BCF(VARIANTS, ".bcf"), - VCFGZ(VARIANTS, ".vcf.gz"), - VCFBGZ(VARIANTS, ".vcf.bgz"), - GVCFGZ(VARIANTS, ".gvcf.gz"), - BAI(INDEX, ".bai"), + VCFGZ(VARIANTS, ".vcf.gz", true), + VCFBGZ(VARIANTS, ".vcf.bgz", true), + GVCFGZ(VARIANTS, ".gvcf.gz", true), TBI(INDEX, ".tbi"), CSI(INDEX, ".csi"), - GORD(TABLE, ".gord"), - GORT(TABLE, ".gort"), - GORP(TABLE, ".gorp"), + GORD(TABLE, ".gord", false), // Note: gord is not handled by the driver framework, so must set dpendents as false (even though it has meta). + GORT(TABLE, ".gort", true), + GORP(TABLE, ".gorp", true), GORQ(REPORT, ".gorq"), LINK(REFERENCE, ".link"), LOCAL_LINK(REFERENCE, ".link.local"), - CRAM(VARIANTS, ".cram"), + CRAM(VARIANTS, ".cram", true), CRAI(INDEX, ".crai"), SPEC(VARIANTS, ".spec"), - NOR(VARIANTS, ".nor"), - NORZ(VARIANTS, ".norz"), - NORD(TABLE, ".nord"), + NOR(VARIANTS, ".nor", true), + NORZ(VARIANTS, ".norz", true), + NORD(TABLE, ".nord", true), CSV(VARIANTS, ".csv"), CSVGZ(VARIANTS, ".csv.gz"), TSV(VARIANTS, ".tsv"), @@ -78,10 +78,16 @@ public enum DataType { public final String suffix; public final FileNature nature; + public final boolean hasDependents; DataType(FileNature nature, String suffix) { + this(nature, suffix, false); + } + + DataType(FileNature nature, String suffix, boolean hasDependents) { this.nature = nature; this.suffix = suffix; + this.hasDependents = hasDependents; } /** diff --git a/model/src/main/java/org/gorpipe/gor/model/DriverBackedFileReader.java b/model/src/main/java/org/gorpipe/gor/model/DriverBackedFileReader.java index e3bee89f..34349202 100644 --- a/model/src/main/java/org/gorpipe/gor/model/DriverBackedFileReader.java +++ b/model/src/main/java/org/gorpipe/gor/model/DriverBackedFileReader.java @@ -480,6 +480,10 @@ private Stream getDependentDestStream(String source, String dest, } private List getValidatedDependents(DataSource source) throws IOException { + if (source.getDataType() != null && !source.getDataType().hasDependents) { + return List.of(); + } + List dependents = new ArrayList<>(); DataSource metaSource = resolveUrl(source.getName() + DataType.META.suffix, true); if (metaSource != null && metaSource.exists()) { diff --git a/tests/data b/tests/data index a195f5a9..3a1d6077 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit a195f5a9a0544b37f5ec32ed56371236307fdedf +Subproject commit 3a1d60776d54b031fb593b0f8dc60c3d44c02783