Skip to content

Commit

Permalink
filter: add message showing # genes pass filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jminnier committed Apr 19, 2018
1 parent c4bc132 commit 89de35d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions server-filterdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ observe({
tmpmax = max(tmpdat[,colnames(tmpdat)==exprname],na.rm=T)

updateNumericInput(session,"datafilter_exprmin",
min=tmpmin,max= tmpmax,value=tmpmin)
min=floor(tmpmin),max= ceiling(tmpmax),value=floor(tmpmin))
updateNumericInput(session,"datafilter_exprmax",
min=tmpmin,max= tmpmax,value=tmpmax)
min=floor(tmpmin),max= ceiling(tmpmax),value=ceiling(tmpmax))
}
})

Expand Down Expand Up @@ -160,7 +160,7 @@ filterDataReactive <- reactive({
if(input$datafilter_expr) {
tmpdatlong_filter = data.table::data.table(tmpdatlong)[unique_id%in%mydata_genes$unique_id,]
data.table::setnames(tmpdatlong_filter,input$datafilter_selectexpr, "mycol")
tmpdatlong_filter = tmpdatlong_filter[,.(min=min(mycol),max=max(mycol)),by=unique_id]
tmpdatlong_filter = tmpdatlong_filter[,.(min=min(mycol,na.rm=T),max=max(mycol,na.rm=T)),by=unique_id]
tmpdatlong_filter = tmpdatlong_filter[(min>=input$datafilter_exprmin)&(max<=input$datafilter_exprmax),]

tmpgenes = as.character(tmpdatlong_filter$unique_id)
Expand All @@ -175,15 +175,13 @@ filterDataReactive <- reactive({
mydata
# need to add:
# filter only within some groups, should filter be based on above group selections? no because test is not
# if nrow(mydata)==0 validate send message no data
# save data as file with filter settings concatinated?
# show number of genes that pass filter like in heatmap
# data frame display too wide, truncate columns?
# output data should have counts too? which is shown, log2cpm? log2cpm_voom?
#download record of filters buttons
#DF display, make prettier?
#data summary?
# print out how many records meet each criterea
})


Expand All @@ -194,6 +192,11 @@ output$filterdataoutput <- renderDataTable({
datatable(res, class = 'cell-border stripe', rownames = FALSE)
})

output$nrow_filterdata <- renderText({
res <- filterDataReactive()
tmpnum = ifelse(is.null(res),0,nrow(res))
paste("Chosen filters result in ",tmpnum, " genes.")
})


# if datafilter_fold_change_groups selected
Expand Down
1 change: 1 addition & 0 deletions ui-tab-filterdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ tabPanel("Filter Data",
## Right hand column shows data input DT and data analysis result DT
## ==================================================================================== ##
column(8,wellPanel(
h4(textOutput("nrow_filterdata")),
downloadButton('download_filtered_data_csv','Save Filtered Results as CSV File'),
dataTableOutput('filterdataoutput')
)#wellpanel
Expand Down

0 comments on commit 89de35d

Please sign in to comment.