forked from jmzeng1314/TF_map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput_links.R
59 lines (45 loc) · 1.75 KB
/
output_links.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
output$washUlink <- renderUI({
## the glob_values$results will return by two search buttones.
tmp1=glob_values$results
## http://dc2.cistrome.org/api/batchview/h/2816_3584_4608_8960_33792/w/
if(! is.null(tmp1)){
if(glob_values$database == 'cistrome'){
## if choose the cistrome database:
s = input$results_rows_selected
if (length(s)) {
tmp1=tmp1[s, , drop = FALSE]
genome=ifelse(glob_values$species=='human','h','m')
url=paste0("http://dc2.cistrome.org/api/batchview/",genome,"/",
paste(unique(as.character(tmp1$sampleID)),collapse = '_'),
"/w/")
cat(as.character(Sys.time()),"Check the URL:",url,'\n',file=stderr())
log_cat(paste0(getIP()," Check the URL:",url,'\n'))
return(a('WashU Epigenome Browser',href=url,target="_blank"))
}
}
}
})
output$downloadData_csv <- downloadHandler(
filename = function() {
paste(glob_values$species ,glob_values$IP,glob_values$database,
glob_values$input_gene ,glob_values$cellline,glob_values$genomic_feature,
'data', Sys.Date(), 'peaks.csv', sep='-')
},
content = function(con) {
tmp1=glob_values$results
write.csv( tmp1 , con)
}
)
output$downloadData_bed <- downloadHandler(
filename = function() {
paste(glob_values$species ,glob_values$IP,glob_values$database,
glob_values$input_gene ,glob_values$cellline,glob_values$genomic_feature,
'data', Sys.Date(), 'peaks.bed', sep='-')
},
content = function(con) {
tmp1=glob_values$results
tmp1=tmp1[,c('chrom' ,'start' ,'end' ,'IP' ,'score')]
tmp1$strand='+'
write.table( tmp1 , con,sep = '\t',quote = F,row.names = F,col.names = F)
}
)