Skip to content

Commit

Permalink
removing commented code components, now outdated
Browse files Browse the repository at this point in the history
  • Loading branch information
federicomarini committed Sep 12, 2024
1 parent 3c86692 commit d329369
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 125 deletions.
56 changes: 0 additions & 56 deletions R/ggplotCounts.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,60 +55,4 @@ ggplotCounts <- function(dds, gene, intgroup = "condition", annotation_obj = NUL
)

return(p)

# df <- plotCounts(dds, gene, intgroup, returnData = TRUE)
# df$sampleID <- rownames(df)
#
# if (!is.null(annotation_obj)) {
# genesymbol <- annotation_obj$gene_name[match(gene, annotation_obj$gene_id)]
# } else {
# genesymbol <- ""
# }
#
# jittered_df <- df
# # jittered_df$conditionj <- jitter(as.numeric(factor(jittered_df$condition)))
# jittered_df$countj <- jitter(jittered_df$count)
#
# onlyfactors <- df[, match(intgroup, colnames(df))]
# df$plotby <- interaction(onlyfactors)
#
# # base_breaks <- function(n = 10){
# # function(x) {
# # axisTicks(log10(range(x, na.rm = TRUE)), log = TRUE, nint = n)
# # }
# # }
#
# p <-
# ggplot(df, aes_string(x = "plotby", y = "count", col = "plotby")) +
# geom_boxplot(outlier.shape = NA) +
# # geom_text(data = jittered_df,aes(x=conditionj,y=countj,label=sampleID)) +
# scale_x_discrete(name = "") +
# geom_jitter(aes_string(x = "plotby", y = "count"),
# position = position_jitter(width = 0.1)
# ) +
# scale_color_discrete(name = "Experimental\nconditions")
#
# if (labels_repel) {
# p <- p + ggrepel::geom_text_repel(aes_string(label = "sampleID"))
# } else {
# p <- p + geom_text(aes_string(label = "sampleID"), hjust = -.1, vjust = 0)
# }
#
# if (transform) {
# p <- p + scale_y_log10(name = "Normalized counts (log10 scale)")
# } else {
# p <- p + scale_y_continuous(name = "Normalized counts")
# }
#
# # scale_y_log10(name="Normalized counts - log10 scale") +
# # coord_cartesian(ylim = c())# ,limits=c(0.1,NA)) +
# p <- p + theme_bw()
#
# if (!is.null(annotation_obj)) {
# p <- p + labs(title = paste0("Normalized counts for ", genesymbol, " - ", gene))
# } else {
# p <- p + labs(title = paste0("Normalized counts for ", gene))
# }
#
# p
}
42 changes: 0 additions & 42 deletions R/goseqTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,46 +90,4 @@ goseqTable <- function(de.genes, # Differentially expressed genes
)

return(res_enrich)

# gene.vector <- as.integer(assayed.genes %in% de.genes)
# names(gene.vector) <- assayed.genes
# fdr <- FDR_GO_cutoff
#
# pwf <- nullp(DEgenes = gene.vector, genome = genome, id = id, plot.fit = FALSE)
#
# goseq_out <- goseq(pwf, genome = genome, id = id, test.cats = testCats)
#
#
#
# goseq_out$p.adj <- p.adjust(goseq_out$over_represented_pvalue, method = "BH")
#
# # to reduce the load for adding the genes
# goseq_out <- goseq_out[seq_len(nTop), ]
#
# if (addGeneToTerms) {
# # for adding the gene ids/names...
# gene2cat <- getgo(de.genes, genome = genome, id = id, fetch.cats = testCats)
# names(gene2cat) <- de.genes
#
# reversemap <- function(map) # as in goseq
# {
# tmp <- unlist(map, use.names = FALSE)
# names(tmp) <- rep(names(map), times = as.numeric(summary(map)[, 1]))
# return(split(names(tmp), as.vector(tmp)))
# }
#
# cat2gene <- reversemap(gene2cat)
# # one list per GO term
# goseq_out$genes <- sapply(goseq_out$category, function(x) cat2gene[[x]])
#
# # TODO: replace identifiers/annotaions!!!
# ## and also TODO: do this only if genes are not already symbols
# goseq_out$genesymbols <- sapply(goseq_out$genes, function(x) sort(AnnotationDbi::mapIds(get(orgDbPkg), keys = x, keytype = "ENSEMBL", column = "SYMBOL", multiVals = "first")))
# # coerce to char
# goseq_out$genes <- unlist(lapply(goseq_out$genes, function(arg) paste(arg, collapse = ",")))
# # coerce to char
# goseq_out$genesymbols <- unlist(lapply(goseq_out$genesymbols, function(arg) paste(arg, collapse = ",")))
# }
#
# return(goseq_out)
}
27 changes: 0 additions & 27 deletions R/res2tbl.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ deseqresult2tbl <- function(deseqresult) {
res_de <- mosdef::deresult_to_df(deseqresult)

return(res_de)

# if (!is(deseqresult, "DESeqResults")) stop("Not a DESeqResults object.")
# deseqresult <- as.data.frame(deseqresult)
#
# deseqresult <- cbind(rownames(deseqresult), deseqresult)
# names(deseqresult)[1] <- "id"
# deseqresult$id <- as.character(deseqresult$id)
#
# dplyr::arrange(deseqresult, .data$padj)
}


Expand Down Expand Up @@ -74,22 +65,4 @@ deseqresult2DEgenes <- function(deseqresult,
res_de <- mosdef::deresult_to_df(deseqresult, FDR = FDR)

return(res_de)

# if (!is(deseqresult, "DESeqResults")) stop("Not a DESeqResults object.")
# deseqresult <- as.data.frame(deseqresult)
#
# deseqresult <- cbind(rownames(deseqresult), deseqresult)
# names(deseqresult)[1] <- "id"
# deseqresult$id <- as.character(deseqresult$id)
#
# # deseqresult$id <- rownames(deseqresult)
# # rownames(deseqresult) <- NULL
# # deseqresult <- dplyr::tbl_df(deseqresult)
# # if("symbol" %in% names(deseqresult))
# # deseqresult <- dplyr::select(deseqresult, id, baseMean, log2FoldChange:symbol)
# # else
# # deseqresult <- dplyr::select(deseqresult, id, baseMean, log2FoldChange:padj)
# tmp <- dplyr::arrange(deseqresult, .data$padj)
# res <- tmp[!(is.na(tmp$padj)) & tmp$padj <= FDR, ]
# res
}

0 comments on commit d329369

Please sign in to comment.