Skip to content

Commit

Permalink
Add IntervalFileFeature for common interface to name in bed or interv…
Browse files Browse the repository at this point in the history
…al_list (#1680)

* Added NamedFeature interface for common interface for bed and interval_list
  • Loading branch information
rickymagner authored Aug 9, 2023
1 parent 5cc90ed commit 38dbd0e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/htsjdk/samtools/util/Interval.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +34,7 @@
*
* @author Tim Fennell
*/
public class Interval implements Comparable<Interval>, Cloneable, Feature {
public class Interval implements Comparable<Interval>, Cloneable, NamedFeature {
private final boolean negativeStrand;
private final String name;
private final String contig;
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/htsjdk/tribble/NamedFeature.java
Original file line number Diff line number Diff line change
@@ -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();
}
6 changes: 2 additions & 4 deletions src/main/java/htsjdk/tribble/bed/BEDFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
package htsjdk.tribble.bed;

import htsjdk.tribble.Feature;
import htsjdk.tribble.NamedFeature;
import htsjdk.tribble.annotation.Strand;

import java.awt.*;
Expand All @@ -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();
Expand All @@ -47,8 +47,6 @@ public interface BEDFeature extends Feature {

java.util.List<FullBEDFeature.Exon> getExons();

String getName();

float getScore();

String getLink();
Expand Down

0 comments on commit 38dbd0e

Please sign in to comment.