From 4794ae1cb00cf31f699c8e5047e92d9914a8a20b Mon Sep 17 00:00:00 2001 From: rickymagner <81349869+rickymagner@users.noreply.github.com> Date: Tue, 8 Aug 2023 15:38:47 -0400 Subject: [PATCH 1/3] Added IntervalFileFeature interface for common interface for bed and interval_list --- .../java/htsjdk/samtools/util/Interval.java | 4 +-- .../htsjdk/tribble/IntervalFileFeature.java | 34 +++++++++++++++++++ .../java/htsjdk/tribble/bed/BEDFeature.java | 6 ++-- 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 src/main/java/htsjdk/tribble/IntervalFileFeature.java diff --git a/src/main/java/htsjdk/samtools/util/Interval.java b/src/main/java/htsjdk/samtools/util/Interval.java index 08f306b4ae..f96e70e3f1 100644 --- a/src/main/java/htsjdk/samtools/util/Interval.java +++ b/src/main/java/htsjdk/samtools/util/Interval.java @@ -24,7 +24,7 @@ package htsjdk.samtools.util; import htsjdk.samtools.SAMException; -import htsjdk.tribble.Feature; +import htsjdk.tribble.IntervalFileFeature; import htsjdk.tribble.annotation.Strand; import java.util.Collection; @@ -34,7 +34,7 @@ * * @author Tim Fennell */ -public class Interval implements Comparable, Cloneable, Feature { +public class Interval implements Comparable, Cloneable, IntervalFileFeature { private final boolean negativeStrand; private final String name; private final String contig; diff --git a/src/main/java/htsjdk/tribble/IntervalFileFeature.java b/src/main/java/htsjdk/tribble/IntervalFileFeature.java new file mode 100644 index 0000000000..cbe2a1b8bd --- /dev/null +++ b/src/main/java/htsjdk/tribble/IntervalFileFeature.java @@ -0,0 +1,34 @@ +/* + * The MIT License + * + * Copyright (c) 2023 The Broad Institute + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package htsjdk.tribble; + + +/** + * An interface for features provided via an interval file, e.g. bed or interval_list. + * Provides a common interface for accessing the name column for both of these file types. + */ +public interface IntervalFileFeature extends Feature { + String getName(); + +} diff --git a/src/main/java/htsjdk/tribble/bed/BEDFeature.java b/src/main/java/htsjdk/tribble/bed/BEDFeature.java index d70e6059ff..310e2693dd 100644 --- a/src/main/java/htsjdk/tribble/bed/BEDFeature.java +++ b/src/main/java/htsjdk/tribble/bed/BEDFeature.java @@ -23,7 +23,7 @@ */ package htsjdk.tribble.bed; -import htsjdk.tribble.Feature; +import htsjdk.tribble.IntervalFileFeature; import htsjdk.tribble.annotation.Strand; import java.awt.*; @@ -36,7 +36,7 @@ * This is different than the 0-based representation in a BED file. This conversion is handled by {@link BEDCodec}. * Anyone writing a bed file should be aware of this difference. */ -public interface BEDFeature extends Feature { +public interface BEDFeature extends IntervalFileFeature { Strand getStrand(); String getType(); @@ -47,8 +47,6 @@ public interface BEDFeature extends Feature { java.util.List getExons(); - String getName(); - float getScore(); String getLink(); From 1952da09c3f9abfbb229abd7a1d1aa56bc0ce816 Mon Sep 17 00:00:00 2001 From: rickymagner <81349869+rickymagner@users.noreply.github.com> Date: Tue, 8 Aug 2023 15:40:15 -0400 Subject: [PATCH 2/3] White space --- src/main/java/htsjdk/tribble/IntervalFileFeature.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/htsjdk/tribble/IntervalFileFeature.java b/src/main/java/htsjdk/tribble/IntervalFileFeature.java index cbe2a1b8bd..a22689c325 100644 --- a/src/main/java/htsjdk/tribble/IntervalFileFeature.java +++ b/src/main/java/htsjdk/tribble/IntervalFileFeature.java @@ -30,5 +30,4 @@ */ public interface IntervalFileFeature extends Feature { String getName(); - } From d94c9d22beaaba8e53d97a88704d2bc1514d2786 Mon Sep 17 00:00:00 2001 From: rickymagner <81349869+rickymagner@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:41:47 -0400 Subject: [PATCH 3/3] Change name of interface from IntervalFileFeature to NamedFeature --- src/main/java/htsjdk/samtools/util/Interval.java | 4 ++-- .../tribble/{IntervalFileFeature.java => NamedFeature.java} | 2 +- src/main/java/htsjdk/tribble/bed/BEDFeature.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/main/java/htsjdk/tribble/{IntervalFileFeature.java => NamedFeature.java} (96%) diff --git a/src/main/java/htsjdk/samtools/util/Interval.java b/src/main/java/htsjdk/samtools/util/Interval.java index f96e70e3f1..07007a48e6 100644 --- a/src/main/java/htsjdk/samtools/util/Interval.java +++ b/src/main/java/htsjdk/samtools/util/Interval.java @@ -24,7 +24,7 @@ package htsjdk.samtools.util; import htsjdk.samtools.SAMException; -import htsjdk.tribble.IntervalFileFeature; +import htsjdk.tribble.NamedFeature; import htsjdk.tribble.annotation.Strand; import java.util.Collection; @@ -34,7 +34,7 @@ * * @author Tim Fennell */ -public class Interval implements Comparable, Cloneable, IntervalFileFeature { +public class Interval implements Comparable, Cloneable, NamedFeature { private final boolean negativeStrand; private final String name; private final String contig; diff --git a/src/main/java/htsjdk/tribble/IntervalFileFeature.java b/src/main/java/htsjdk/tribble/NamedFeature.java similarity index 96% rename from src/main/java/htsjdk/tribble/IntervalFileFeature.java rename to src/main/java/htsjdk/tribble/NamedFeature.java index a22689c325..5f0dcb4a6e 100644 --- a/src/main/java/htsjdk/tribble/IntervalFileFeature.java +++ b/src/main/java/htsjdk/tribble/NamedFeature.java @@ -28,6 +28,6 @@ * An interface for features provided via an interval file, e.g. bed or interval_list. * Provides a common interface for accessing the name column for both of these file types. */ -public interface IntervalFileFeature extends Feature { +public interface NamedFeature extends Feature { String getName(); } diff --git a/src/main/java/htsjdk/tribble/bed/BEDFeature.java b/src/main/java/htsjdk/tribble/bed/BEDFeature.java index 310e2693dd..a342b65317 100644 --- a/src/main/java/htsjdk/tribble/bed/BEDFeature.java +++ b/src/main/java/htsjdk/tribble/bed/BEDFeature.java @@ -23,7 +23,7 @@ */ package htsjdk.tribble.bed; -import htsjdk.tribble.IntervalFileFeature; +import htsjdk.tribble.NamedFeature; import htsjdk.tribble.annotation.Strand; import java.awt.*; @@ -36,7 +36,7 @@ * This is different than the 0-based representation in a BED file. This conversion is handled by {@link BEDCodec}. * Anyone writing a bed file should be aware of this difference. */ -public interface BEDFeature extends IntervalFileFeature { +public interface BEDFeature extends NamedFeature { Strand getStrand(); String getType();