-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mc.R
137 lines (102 loc) · 3.05 KB
/
Mc.R
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
library("genomidi.R")
args=commandArgs(T)
# Load DBs
#TEs.bed=read.table("data/danRer10.fa.align.recalculated.bed.order")
TEs.bed=read.table(as.character(args[1]))
TEs.gr=GRanges(seqnames=TEs.bed$V1, ranges=IRanges(start=TEs.bed$V2,end=TEs.bed$V3),strand=TEs.bed$V6,names=TEs.bed$V4,kimura=TEs.bed$V7,fixed_vol=rep(100,times=length(TEs.bed$V7)))
GENEs.bed=read.table("data/refGene.bed.without-gene-name")
GENEs.gr=GRanges(seqnames=GENEs.bed$V1, ranges=IRanges(start=GENEs.bed$V2,end=GENEs.bed$V3),strand=GENEs.bed$V6,names=GENEs.bed$V4,note=rep(50,times=length(GENEs.bed$V7)),fixed_vol=rep(127,times=length(GENEs.bed$V7))) #vol and notes range: 0-127
ATACSEQ.bed=read.table("data/WT_atac.peaks.col1-6.liftover-danRer10.asterix-strand.bed")
ATACSEQ.gr=GRanges(seqnames=ATACSEQ.bed$V1, ranges=IRanges(start=ATACSEQ.bed$V2,end=ATACSEQ.bed$V3),strand=ATACSEQ.bed$V6,names=rep("ATAC",times=length(ATACSEQ.bed$V1)),note=rep(57,times=length(ATACSEQ.bed$V1)),fixed_vol=rep(127,times=length(ATACSEQ.bed$V1))) #vol and notes range: 0-127
# Define all tracks we want to listen
T.ATAC=Track(
DB=ATACSEQ.gr,
Aes=list(Name="names", Note="note", Vol="fixed_vol"),
Name="ATAC",
Channel=6,
Instrument=53 # Voice Ooh
# Instrument=19 # Organo de iglesia
)
T.GENE=Track(
DB=GENEs.gr,
Aes=list(Name="names", Note="note", Vol="fixed_vol"),
Name="GENE",
Channel=5,
Instrument=53 # Voice Ooh
)
T.LINE=Track(
DB=TEs.gr,
Aes=list(Name="names", Note="kimura", Vol="fixed_vol"),
Name="LINE",
Channel=1,
Instrument=43 # contrabajo
)
T.SINE=Track(
DB=TEs.gr,
Aes=list(Name="names", Note="kimura", Vol="fixed_vol"),
Name="SINE",
Channel=2,
Instrument=40 # violin
)
T.DNA=Track(
DB=TEs.gr,
Aes=list(Name="names", Note="kimura", Vol="fixed_vol"),
Name="DNA",
Channel=3,
Instrument=42 #cello
)
T.LTR=Track(
DB=TEs.gr,
Aes=list(Name="names", Note="kimura", Vol="fixed_vol"),
Name="LTR",
Channel=4,
Instrument=46 # orchestal harp
)
# Put them all togeter in a symphony
#S=Symphony(
# Label="The-repetitive-order",
# Chr="chr19",
# Start=19490627,
# End=30123884,
# Tempo=100000,
# TrackList=list(T.ATAC,T.GENE,T.LINE,T.SINE,T.DNA,T.LTR)
#)
S=Symphony(
Label="centromere-at-chr-4",
Chr="chr4",
Start=33311305,
End=47004872,
Tempo=100000,
TrackList=list(T.ATAC,T.GENE,T.LINE,T.SINE,T.DNA,T.LTR)
)
# And compose them by bringing all elements comprending the selected region
composeSymphony(S)
# Generate output files and reproduce
playSymphony(S)
# Save workspace
save.image()
# TODO
#
# + normalizeNotes <- could be dependent of instrument? to respect each instrument capabilities and thus being reallistic
#
# And some wrappers to midicomp and timidity
# + play
# + save.mp3
#
# Experimentos
# Iteracion para generar tracks:
# Funciona: ejemplo for creando Tracks
#mr=read.table("16-most-represented-tes.tab",sep="\t")
#tl <- vector("list", length(mr$V1))
#i=1
#for(te in mr$V1){
# track=Track(
# DB=TEs.gr,
# Aes=list(Name="names", Note="kimura", Vol="fixed_vol"),
# Name=as.character(te),
# Channel=i,
# Instrument=43
# )
# tl[[i]]=track
# i=i+1
#}