BedEntry Class

Represents a Bed line of Bed file!

BedEntry Class (3 Col)

class bedEntry.BedEntry.BedEntry(chr: str, sCoord: int, eCoord: int, extraFields: Union[None, List[T]] = None)

Represents a Bed line of Bed file, composed by 3 core column.

__init__(chr: str, sCoord: int, eCoord: int, extraFields: Union[None, List[T]] = None) → None

Create an instance of BedEntry object.

Parameters:
  • chr (str) – the chromosome where region is located
  • sCoord (int) – the start coordinate of the region
  • eCoord (int) – the end coordinate of the region
  • extraFields (None,List) – Additional fields to the standard 3 columns. (optional)
chr

Get the chromosome (chr) where the region is located

Getter:Returns chromosome name
Setter:Sets chromosome name.
Type:string
sCoord

Get start coordinate (sCoord) where the region is located.

Getter:Returns start coordinate
Setter:Sets start coordinate. Can’t be higher than eCoord, if latter is defined.
Type:int
eCoord

Get the end coordinate (eCoord) where the region is located.

Getter:Returns end coordinate
Setter:Sets end coordinate. Can’t be lower than sCoord, if latter is defined.
Type:int
extraFields

Get the Extra Fields (extraFields) in a Dict format.

  • Key1 -> Value1
  • Key2 -> Value2
Getter:Returns end coordinate
Setter:In case of List as input, it restores the Dict of ExtraFields with the elements in the input List.
Type:List,None
addExtraField(extraField: List[T]) → None

Adds the Extra field(s) to BedEntry objects.

Parameters:extraField (List) – List of extra Fields in the required order
hasExtraFields() → bool

Question the object if it has extra fields or not. True in positive case, False otherwise.

Return bool:True / False
lenExtraFields() → int

Get the exact number of extra fields in the BedEntry instance.

Return int:Number of Extra fields
isOverlapping(other)
Question the object if overlaps another object from BedEntry.
Considered:
  • chr
  • sCoord
  • eCoord
Parameters:other (BedEntry) – BedEntry object to compare with
Return bool:True if both objects overlap each other, False otherwise.

Build-in Functions

BedEntry.__len__()

Returns the size of BedEntry object region

Return int:size of BedEntry object region
BedEntry.__eq__(other)

Return self==value.

BedEntry.__str__()
Returns a string version of BedEntry 3 Col, like:
chromosome <tab> start coordinate <tab> end coordinate
Return str:String representation of BedEntry 3 Col.

BedEntry Class (6 Col)

class bedEntry.BedEntry6.BedEntry6(chr, sCoord, eCoord, name, score, strand, extraFields=None)

Bases: bedEntry.BedEntry.BedEntry

Represents a Bed line of Bed file, composed by 6 core column.

__init__(chr, sCoord, eCoord, name, score, strand, extraFields=None)
Parameters:
  • chr (str) – chromosome name where region is located
  • sCoord (int) – start coordinate of region
  • eCoord (int) – end coordinate of region
  • ame (str) – name of genomic feature
  • score (int) – score of genomic feature
  • strand ("+","-") – DNA strand where the region belongs
  • extraFields (None,List) – Additional fields to the standard 6 columns. (optional)
addExtraField(extraField: List[T]) → None

Adds the Extra field(s) to BedEntry objects.

Parameters:extraField (List) – List of extra Fields in the required order
chr

Get the chromosome (chr) where the region is located

Getter:Returns chromosome name
Setter:Sets chromosome name.
Type:string
eCoord

Get the end coordinate (eCoord) where the region is located.

Getter:Returns end coordinate
Setter:Sets end coordinate. Can’t be lower than sCoord, if latter is defined.
Type:int
extraFields

Get the Extra Fields (extraFields) in a Dict format.

  • Key1 -> Value1
  • Key2 -> Value2
Getter:Returns end coordinate
Setter:In case of List as input, it restores the Dict of ExtraFields with the elements in the input List.
Type:List,None
hasExtraFields() → bool

Question the object if it has extra fields or not. True in positive case, False otherwise.

Return bool:True / False
lenExtraFields() → int

Get the exact number of extra fields in the BedEntry instance.

Return int:Number of Extra fields
sCoord

Get start coordinate (sCoord) where the region is located.

Getter:Returns start coordinate
Setter:Sets start coordinate. Can’t be higher than eCoord, if latter is defined.
Type:int
isOverlapping(other, considerStrand=False)
Question the object if overlaps another object from BedEntry6.
Considered:
  • chr
  • sCoord
  • eCoord
  • strand
Parameters:other (BedEntry6) – BedEntry6 object to compare with.
Return bool:True if both objects overlap each other, False otherwise.

Build-in Functions

BedEntry6.__len__()

Returns the size of BedEntry object region

Return int:size of BedEntry object region
BedEntry6.__eq__(other: object)

Return a boolean indicating if two BedEntry6 objects share the same properties.

  • chr
  • sCoord
  • eCoord
  • name
  • score
  • strand

(Extra Fields Not Included) :param BedEntry6 other: BedEntry6 object to compare with. :return: True if they have same properties, False otherwise. :rtype: bool

BedEntry6.__str__()

Returns a string version of BedEntry6, like:

chromosome <tab> start coordinate <tab> end coordinate <tab> name <tab> score <tab> strand

Returns:String representation of BedEntry 6 Col.