Skip to content

Commit

Permalink
BUGFIX: Make it so that single gene is plotted #19
Browse files Browse the repository at this point in the history
  • Loading branch information
csiu committed Oct 17, 2016
1 parent e8d6e3e commit da1fbe1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,21 @@ plot_geneExpr <- function(gene_of_interest, gene_name,
plot_geneExprGeneCluster <- function(gene_of_interest, gene_name){
the_genes <- setNames(gene_name, gene_of_interest)

gene_expr <-
expression[names(the_genes),] %>%
as.matrix() %>%
t() %>%
as.data.frame() %>%
tibble::rownames_to_column("barcode")
if (length(gene_of_interest) == 1) {
gene_expr <-
data.frame(
barcode = barcodes$Barcode,
expr = expression[gene_of_interest,]) %>%
tbl_df()
colnames(gene_expr)[2] <- gene_of_interest
} else {
gene_expr <-
expression[names(the_genes),] %>%
as.matrix() %>%
t() %>%
as.data.frame() %>%
tibble::rownames_to_column("barcode")
}
tsne1 <-
left_join(tsne, gene_expr, by="barcode") %>%
gather(gene, expr, starts_with("ENSG")) %>%
Expand Down

0 comments on commit da1fbe1

Please sign in to comment.