-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenomicSegmentVector.py
77 lines (65 loc) · 2.86 KB
/
GenomicSegmentVector.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import cgDataV2.Exceptions
class GenomicSegmentVector(object):
"""GenomicSegmentVector objects indicate which segments were
present in the indicated samples, and with what score For example,
copy number data can be represented as GenomicSegmentVectors.
Each GenomicSegmentVector contains the following fields:
- sampleId: the name of the sample in which the segment was observed
- chrom: name of the chromosome
- start: starting position within the chromosome or scaffold
- end: ending position within the chromosome or scaffold.
- strand: either '+' for forward, '-' for reverse, or '.' for both
- score: floating point score for the segment
Comment: in the API document, the term "GenomicSegment" seems to
refer to a file of genomic segment observations. But I feel like
there are two different classes: GenomicSegmentVector objects, in
which each object represents the observation of one segment in one
indicated sample; and GenomicSegmentSet objects, representing a
set of GenomicSegmentVectors that are contained together in a
file.
See Also: GenomicSegmentSet
"""
# __format__ = {
# "name" : "genomicSegment",
# "type" : "type",
# "form" : "table",
# "columnOrder" : [
# "id",
# "chrom",
# "chrom_start",
# "chrom_end",
# "strand",
# "value"
# ],
# "groupKey" : "id",
# "columnDef" : {
# "chrom_start" : { "type" : "int" },
# "chrom_end" : { "type" : "int" },
# "value" : { "type" : "float" }
# }
# }
def __init__(self, line=None):
"""Creates a new GenomicSegmentVector object. If line is
None, an empty object is returned. Else, the contents of the
GenomicSegmentVector are parsed from the line, which should
contain the indicated fields and be whitespace-delimited.
As a final initialization step, the object is validated. If
validation fails, a ValidationFailed exception is thrown.
"""
pass
def __validate(self):
"""Validate this GenomicSegmentVector, and throw a ValidationFailed
object if unsuccessful. """
pass
def genomicSegmentVectorCompare(vector1, vector2):
"""Return the results of comparing vector1 to vector2, comparing each field
(id, chrom, chromStart, chromEnd, strand, value) in the order indicated.
Use numeric comparison on chromStart, chromEnd, and value, and lexical
comparison on all other fields."""
pass
def write(self, filehandle, delimiter="\t"):
"""Write a GenomicSegmentVector object to the indicated
filehandle. The data is written in tab-delimited format by
default.
"""
pass