forked from bmajoros/python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBed6Record.py
executable file
·47 lines (43 loc) · 1.67 KB
/
Bed6Record.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2016 William H. Majoros ([email protected]).
#=========================================================================
from __future__ import (absolute_import, division, print_function,
unicode_literals, generators, nested_scopes, with_statement)
from builtins import (bytes, dict, int, list, object, range, str, ascii,
chr, hex, input, next, oct, open, pow, round, super, filter, map, zip)
from Bed3Record import Bed3Record
#=========================================================================
# Inherited Attributes:
# chr : string
# interval : Interval
# Attributes:
# name : string
# score : float
# strand : string
# Instance Methods:
# record=Bed6Record(chr,begin,end,name,score,strand)
# bool=isBed3()
# bool=isBed6()
# str=toString()
# Class Methods:
#
#=========================================================================
class Bed6Record(Bed3Record):
"""Bed6Record represents a record in a BED6 file"""
def __init__(self,chr,begin,end,name,score,strand):
Bed3Record.__init__(self,chr,begin,end)
self.name=name
self.score=score
self.strand=strand
def isBed3(self):
return False
def isBed6(self):
return True
def toString(self):
s=self.chr+"\t"+str(self.interval.begin)+"\t"+str(self.interval.end)\
+"\t"+self.name
if(self.score is not None): s+="\t"+str(self.score)
if(self.strand is not None): s+="\t"+self.strand
return s