Skip to content

Commit

Permalink
Merge pull request #8 from mariavica/patch-devel
Browse files Browse the repository at this point in the history
Patch devel
  • Loading branch information
mariavica authored Sep 21, 2017
2 parents 3aa217a + 1bafa2d commit 8353b09
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 36 deletions.
4 changes: 2 additions & 2 deletions rsconnect/shinyapps.io/mariavica/mirtools.dcf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: mirtools
account: mariavica
server: shinyapps.io
appId: 181686
bundleId: 889946
bundleId: 890285
url: https://mariavica.shinyapps.io/mirtools/
when: 1499076352.40474
when: 1499096979.51419
asMultiple: FALSE
asStatic: FALSE
34 changes: 16 additions & 18 deletions server.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ shinyServer(function(input, output) {

uploadedm<-read.csv(inFile$datapath)


mymirnas<-unlist(strsplit(as.character(uploadedm[,1]),c("\\,|\\ |\\\n")))
}

Expand All @@ -31,12 +30,7 @@ shinyServer(function(input, output) {
mymirnas<-unlist(strsplit(as.character(input$mirname),c("\\,|\\ |\\\n")))
}


if (input$species!="select") {
specie<-which(species_name %in% input$species)
mymirnas<-paste(prefix[specie],mymirnas,sep="")
mymirnas<-gsub(paste(prefix[specie],prefix[specie],sep=""),prefix[specie],mymirnas)
}


if (input$capitalise) {
mymirnas<-gsub("[mM][iI][rR]","miR",mymirnas)
Expand All @@ -53,8 +47,17 @@ shinyServer(function(input, output) {
mymirnas<-gsub("J","j",mymirnas)
}


if (input$species!="select") {
specie<-which(species_name %in% input$species)
sel<-c(grep("^miR",mymirnas),grep("^let",mymirnas))
mymirnas[sel]<-paste(prefix[specie],mymirnas[sel],sep="")
mymirnas[sel]<-gsub(paste(prefix[specie],prefix[specie],sep=""),prefix[specie],mymirnas[sel])
}


mymirnas<-mymirnas[which(mymirnas!="")]
print(mymirnas)
#print(mymirnas)

a<-apply(versions.mirnas,2,perc,mymirnas)

Expand All @@ -70,23 +73,21 @@ shinyServer(function(input, output) {
dat$x<-relevel(dat$x,"7.1")
dat$x<-relevel(dat$x,"7.0")
dat$x<-relevel(dat$x,"6.0")
print(dat)
#print(dat)

maxs<-which(dat$y==max(dat$y))
proposedversion<-dat[maxs[length(maxs)] ,"x"]


if (input$mirfrom != "I don't know") {
print("entering")
selectedversion<-input$mirfrom
} else {
selectedversion<-proposedversion
}

print(paste("miRBase_",selectedversion,sep=""))
#print(paste("miRBase_",selectedversion,sep=""))

mymirnas<-as.character(mymirnas)

mytrans<-data.frame(mymirnas)

for (i in 1:nrow(mytrans)) {
Expand All @@ -99,9 +100,9 @@ shinyServer(function(input, output) {

if (input$forceTranslation) {
coincidences <- which(t(versions.mirnas)==mymirnas[i])
print(coincidences)
#print(coincidences)
rowmir <- ceiling(coincidences[length(coincidences)]/(totcol-1))
print(rowmir)
#print(rowmir)

mytrans[i,2]<-as.character(versions.mirnas[rowmir, c(paste("miRBase_",as.character(input$mirto),sep="")) ])
}
Expand Down Expand Up @@ -132,18 +133,15 @@ shinyServer(function(input, output) {
paste("Most of your miRNAs are from version:",maketable()[[2]],"\n")
})


output$percent <- renderPlot({
datp<-maketable()[[3]]
qplot(x=datp$x, y=datp$y, fill=datp$x) + geom_bar(stat="identity") +
guides(fill=FALSE) + xlab("miRBase version") + ylab("Coincidence (%)")

})


output$translated<-renderTable(maketable()[[1]])

output$downloadTranslated <- downloadHandler( filename="translated.csv", content=function (file){ write.csv(maketable()[[1]], file, row.names=FALSE, sep="\t", quote=FALSE) })
output$downloadTranslated <- downloadHandler( filename="translated.csv", content=function (file){ write.table(maketable()[[1]], file, row.names=FALSE, sep="\t", quote=FALSE) })



Expand Down
28 changes: 12 additions & 16 deletions ui.r
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ shinyUI(fluidPage(
sidebarPanel(

helpText("Upload your file (\"*txt\" or \"*csv\" plain file):"),

fileInput(inputId="csvfile", label=NULL , multiple = FALSE, accept = c(
"text/csv", "text/comma-separated-values,text/plain",".csv",".txt"), width = NULL,
buttonLabel = "Browse...", placeholder = "No file selected"),
Expand All @@ -26,36 +26,32 @@ shinyUI(fluidPage(
selected = "21", multiple = FALSE, selectize = TRUE, width = NULL, size = NULL),

helpText(strong("Proofreading:")),



checkboxInput(inputId="forceTranslation",label="Force translation (miRNAs from other versions will be automatically translated to desired version)", value=FALSE),

checkboxInput(inputId="capitalise",label="Correct capital letters (valid only for \"miR\" and \"let\")", value=FALSE),
checkboxInput(inputId="forceTranslation",label="Force translation (miRNAs from other versions will be automatically translated to desired version)", value=FALSE),


helpText("MiRNA species"),

selectInput(inputId = "species", label=NULL, choices=c("select","Homo sapiens","Mus musculus"),
selected = "Specified in name", multiple = FALSE, selectize = TRUE, width = NULL, size = NULL)
selected = "Specified in name", multiple = FALSE, selectize = TRUE, width = NULL, size = NULL),


checkboxInput(inputId="capitalise",label="Correct capital letters (valid only for \"miR\" and \"let\")", value=FALSE)#,

# helpText("Substitute"),
# textInput("subst.orig",label=NULL,value=NULL),
# textInput("subst.fin",label=NULL,value="")

),

mainPanel(
#textOutput("text2", container=span),
helpText("Coincidences across miRNA versions"),
plotOutput("percent"),

textOutput("text1", container=span),

helpText("Your translated miRNAs are:"),

downloadButton("downloadTranslated",label="Download table"),

tableOutput("translated")



)
)
))

0 comments on commit 8353b09

Please sign in to comment.