Skip to content

Commit a53f227

Browse files
committed
Add host genes to differential expression results
1 parent 6e6e994 commit a53f227

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

src/app.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ server <- function(input, output, session) {
4646
filtered_phenotype <- filterSamplesServer("filter_samples", phenotype)
4747
filtered_expression <- filterTranscriptsServer("filter_transcripts", circ_cpm, filtered_phenotype)
4848
dimredServer("dimred", filtered_expression, filtered_phenotype)
49-
statisticsServer("statistics", filtered_expression, filtered_phenotype)
49+
statisticsServer("statistics", filtered_expression, filtered_phenotype, circ_cpm)
5050
}
5151

5252
shinyApp(ui = ui, server = server)

src/filter_transcripts.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ filterTranscriptsServer <- function(id, matrix, phenotype) {
3030
moduleServer(id, function(input, output, session) {
3131
matrixSamples <- reactive({
3232
cur_matrix <- matrix[, rownames(phenotype())]
33+
cur_matrix$gene_id <- NULL
3334
cur_matrix
3435
})
3536

src/load.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ loadCirc <- function() {
1717
circ <- read.table(circ_path, header = TRUE, sep = "\t")
1818
rownames(circ) <- circ$circ_id
1919
circ$circ_id <- NULL
20-
circ$gene_id <- NULL
2120

2221
return(circ)
2322
}

src/statistics.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ statisticsUI <- function(id) {
5151
)
5252
}
5353

54-
statisticsServer <- function(id, expr_matrix, phenotype) {
54+
statisticsServer <- function(id, expr_matrix, phenotype, circ_cpm) {
5555
moduleServer(id, function(input, output, session) {
5656

5757
output$column_select <- renderUI({
@@ -106,23 +106,26 @@ statisticsServer <- function(id, expr_matrix, phenotype) {
106106
})
107107

108108
gene_results <- reactive({
109-
test_result()[[1]]
109+
results <- test_result()[[1]]
110+
results[results$FDR < input$alpha, ]
110111
})
111112

112113
circ_results <- reactive({
113-
test_result()[[2]]
114+
results <- test_result()[[2]]
115+
results <- results[results$FDR < input$alpha, ]
116+
annotated <- cbind(circ_cpm[rownames(results), ]$gene_id, results)
117+
colnames(annotated)[1] <- "host_gene"
118+
annotated
114119
})
115120

116121
output$result_table_circ <- renderTable({
117122
results <- circ_results()
118-
results <- cbind("circRNA" = rownames(results), results)
119-
head(results)
123+
cbind("circRNA" = rownames(results), results)
120124
})
121125

122126
output$result_table_gene <- renderTable({
123127
results <- gene_results()
124-
results <- cbind("gene" = rownames(results), results)
125-
head(results)
128+
cbind("gene" = rownames(results), results)
126129
})
127130
})
128131
}

test.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ phenotype <- loadPhenotype()
77
control_samples <- rownames(head(phenotype))
88
treatment_samples <- rownames(tail(phenotype))
99

10-
run(control_samples, treatment_samples)
10+
results <- run(control_samples, treatment_samples)
1111

12+
print(head(results[[2]]))

0 commit comments

Comments
 (0)