-
Notifications
You must be signed in to change notification settings - Fork 1
/
Genome.pde
72 lines (48 loc) · 1.42 KB
/
Genome.pde
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
class Genome{
ChromIdeogram ideogram;
ArrayList<BedAnnot> bed_annots = null;
ArrayList<BedPEAnnot> bedpe_annots = null;
String name;
Genome(String chr_table, String n){
ideogram = new ChromIdeogram(chr_table);
name = n;
}
void addBed(String filename, color c, String glyph, int alpha_val){
BedAnnot b = new BedAnnot(filename, glyph, c, alpha_val);
if (bed_annots == null){
bed_annots = new ArrayList<BedAnnot>();
}
bed_annots.add(b);
}
void addBedPE(String filename, color c, int alpha_val){
BedPEAnnot bpe = new BedPEAnnot(filename, c, alpha_val);
if (bedpe_annots == null){
bedpe_annots = new ArrayList<BedPEAnnot>();
}
bedpe_annots.add(bpe);
}
void draw(float radius, float center_x, float center_y, float chr_width){
ideogram.draw(radius, center_x, center_y, chr_width);
// println("drew ideo");
//to do: calculate fraction of radius as a function of number of bed annots
if (bed_annots != null){
for (BedAnnot b : bed_annots){
// println("drew bed");
b.draw(radius * 0.8, center_x, center_y);
// println("drew bed");
}
}
if (bedpe_annots != null){
for (BedPEAnnot bpe: bedpe_annots){
// println("drawbedpe");
bpe.draw(radius, center_x, center_y, chr_width);
// println("drew bedpe");
}
}
fill(50);
text(name, center_x, center_y);
}
float genToPolar(String chr_name, int pos){
return ideogram.genToPolar(chr_name, pos);
}
}