Class BedRecord


  • @Immutable
    public final class BedRecord
    extends Object
    BED record. Supports the same BED formats as bedtools2.
    • BED3: A BED file where each feature is described by chrom, start, and end. For example: chr1 11873 14409
    • BED4: A BED file where each feature is described by chrom, start, end, and name. For example: chr1 11873 14409 uc001aaa.3
    • BED5: A BED file where each feature is described by chrom, start, end, name, and score. For example: chr1 11873 14409 uc001aaa.3 0
    • BED6: A BED file where each feature is described by chrom, start, end, name, score, and strand. For example: chr1 11873 14409 uc001aaa.3 0 +
    • BED12: A BED file where each feature is described by all twelve columns listed above. For example: chr1 11873 14409 uc001aaa.3 0 + 11873 11873 0 3 354,109,1189, 0,739,1347,
    Author:
    Michael Heuer
    • Constructor Detail

      • BedRecord

        public BedRecord​(String chrom,
                         long start,
                         long end)
        Create a new BED3 record.
        Parameters:
        chrom - chrom, must not be null
        start - start, must be at least zero
        end - end, must be at least zero, and greater than or equal to start
      • BedRecord

        public BedRecord​(String chrom,
                         long start,
                         long end,
                         String name)
        Create a new BED4 record.
        Parameters:
        chrom - chrom, must not be null
        start - start, must be at least zero
        end - end, must be at least zero, and greater than or equal to start
        name - name
      • BedRecord

        public BedRecord​(String chrom,
                         long start,
                         long end,
                         String name,
                         String score)
        Create a new BED5 record.
        Parameters:
        chrom - chrom, must not be null
        start - start, must be at least zero
        end - end, must be at least zero, and greater than or equal to start
        name - name
        score - score
      • BedRecord

        public BedRecord​(String chrom,
                         long start,
                         long end,
                         String name,
                         String score,
                         String strand)
        Create a new BED6 record.
        Parameters:
        chrom - chrom, must not be null
        start - start, must be at least zero
        end - end, must be at least zero, and greater than or equal to start
        name - name
        score - score
        strand - strand, if present must be either - or +
      • BedRecord

        public BedRecord​(String chrom,
                         long start,
                         long end,
                         String name,
                         String score,
                         String strand,
                         long thickStart,
                         long thickEnd,
                         String itemRgb,
                         int blockCount,
                         long[] blockSizes,
                         long[] blockStarts)
        Create a new BED12 record.
        Parameters:
        chrom - chrom, must not be null
        start - start, must be at least zero
        end - end, must be at least zero, and greater than or equal to start
        name - name
        score - score
        strand - strand, if present must be either - or +
        thickStart - thick start, must be at least zero
        thickEnd - thick end, must be at least zero and greater than or equal to thick start
        itemRgb - item RGB, if present, must be in R,G,B format, e.g. 255,0,0
        blockCount - block count, must be at least zero
        blockSizes - block sizes, must be the same length as block count
        blockStarts - block starts, must be the same length as block count
    • Method Detail

      • getChrom

        public String getChrom()
        Return the chrom for this BED record.
        Returns:
        the chrom for this BED record
      • getStart

        public long getStart()
        Return the start for this BED record in 0-based coordinate system, closed open range.
        Returns:
        the start for this BED record in 0-based coordinate system, closed open range
      • getEnd

        public long getEnd()
        Return the end for this BED record in 0-based coordinate system, closed open range.
        Returns:
        the end for this BED record in 0-based coordinate system, closed open range
      • getName

        public String getName()
        Return the name for this BED record, if any.
        Returns:
        the name for this BED record, if any
      • getScore

        public String getScore()
        Return the score for this BED record, if any.
        Returns:
        the score for this BED record, if any
      • getStrand

        public String getStrand()
        Return the strand for this BED record, if any.
        Returns:
        the strand for this BED record, if any
      • getThickStart

        public long getThickStart()
        Return the thick start for this BED record in 0-based coordinate system, closed open range.
        Returns:
        the thick start for this BED record in 0-based coordinate system, closed open range
      • getThickEnd

        public long getThickEnd()
        Return the thick end for this BED record in 0-based coordinate system, closed open range.
        Returns:
        the thick end for this BED record in 0-based coordinate system, closed open range
      • getItemRgb

        public String getItemRgb()
        Return the item RGB for this BED record, if any.
        Returns:
        the item RGB for this BED record, if any
      • getBlockCount

        public int getBlockCount()
        Return the block count for this BED record.
        Returns:
        the block count for this BED record
      • getBlockSizes

        public long[] getBlockSizes()
        Return the block sizes for this BED record.
        Returns:
        the block sizes for this BED record
      • getBlockStarts

        public long[] getBlockStarts()
        Return the block starts for this BED record.
        Returns:
        the block starts for this BED record
      • getFormat

        public BedFormat getFormat()
        Return the format of this BED record.
        Returns:
        the format of this BED record
      • toRange

        public com.google.common.collect.Range<Long> toRange()
        Return this BED record as a 0-based coordinate system, closed open range.
        Returns:
        this BED record as a 0-based coordinate system, closed open range
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • valueOf

        public static BedRecord valueOf​(String value)
        Return a new BED record parsed from the specified value.
        Parameters:
        value - value to parse
        Returns:
        a new BED record parsed from the specified value
        Throws:
        IllegalArgumentException - if the value is not valid BED[3,4,5,6,12] format
        NullPointerException - if a required field is missing
        NumberFormatException - if a long valued field cannot be parsed as a long