diff --git a/src/main/java/htsjdk/samtools/util/Interval.java b/src/main/java/htsjdk/samtools/util/Interval.java index 08f306b4ae..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.Feature; +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, Feature { +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/NamedFeature.java b/src/main/java/htsjdk/tribble/NamedFeature.java new file mode 100644 index 0000000000..5f0dcb4a6e --- /dev/null +++ b/src/main/java/htsjdk/tribble/NamedFeature.java @@ -0,0 +1,33 @@ +/* + * 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 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 d70e6059ff..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.Feature; +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 Feature { +public interface BEDFeature extends NamedFeature { Strand getStrand(); String getType(); @@ -47,8 +47,6 @@ public interface BEDFeature extends Feature { java.util.List getExons(); - String getName(); - float getScore(); String getLink();