Skip to content

Commit

Permalink
Ran code from dev/04_update.R
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolladotor committed Mar 26, 2024
1 parent 98d4ebf commit 663a401
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 26 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ Encoding: UTF-8
LazyData: true
URL: https://github.com/LieberInstitute/jaffelab
BugReports: https://github.com/LieberInstitute/jaffelab/issues
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
11 changes: 5 additions & 6 deletions R/agePlotter.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@
#'
#'
#' par(def.par) #- reset to default
agePlotter <- function(
y, age, mod = matrix(rep(1, length(y)), ncol = 1),
mainText, smoothIt = TRUE, jitter = TRUE, ageLabel = "bottom",
orderByAge = TRUE, ylim = NULL, ageBreaks = c(-1, 0, 1, 10, 100),
ylab = "Adjusted Expression", pointColor = 2, lineColor = 1,
alreadyFitted = NULL, ...) {
agePlotter <- function(y, age, mod = matrix(rep(1, length(y)), ncol = 1),
mainText, smoothIt = TRUE, jitter = TRUE, ageLabel = "bottom",
orderByAge = TRUE, ylim = NULL, ageBreaks = c(-1, 0, 1, 10, 100),
ylab = "Adjusted Expression", pointColor = 2, lineColor = 1,
alreadyFitted = NULL, ...) {
stopifnot(length(ageBreaks) >= 4)
stopifnot(ageLabel %in% c("bottom", "top"))
stopifnot(length(lineColor) == length(unique(pointColor)))
Expand Down
5 changes: 2 additions & 3 deletions R/expression_cutoff.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@
#'
#' ## View the pdf with the following code
#' utils::browseURL("test_expression_cutoff.pdf")
expression_cutoff <- function(
expr, max_cut = 1, seed = NULL, n.boot = 2000,
k = 2) {
expression_cutoff <- function(expr, max_cut = 1, seed = NULL, n.boot = 2000,
k = 2) {
meanExpr <- rowMeans(expr)


Expand Down
9 changes: 4 additions & 5 deletions R/junctionCount.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@
#' ## TODO (need some data)
#' ## See https://github.com/LieberInstitute/RNAseq-pipeline/blob/ab71dedb36bcc3dad57233e645fabd5deb96d446/sh/create_count_objects-human.R#L633-L643
#' ## for an example of how it's being using the the RNA-seq pipeline code
junctionCount <- function(
junctionFiles, sampleNames = names(junctionFiles),
output = c("Count", "Rail"), minOverhang = 0,
strandSpecific = FALSE, illuminaStranded = FALSE,
minCount = 1, maxCores = 1, skipLines = ifelse(output == "Count", 0, 1)) {
junctionCount <- function(junctionFiles, sampleNames = names(junctionFiles),
output = c("Count", "Rail"), minOverhang = 0,
strandSpecific = FALSE, illuminaStranded = FALSE,
minCount = 1, maxCores = 1, skipLines = ifelse(output == "Count", 0, 1)) {
stopifnot(length(junctionFiles) == length(sampleNames))
stopifnot(output %in% c("Count", "Rail"))

Expand Down
5 changes: 2 additions & 3 deletions R/lab_presenters.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@
#' ## If it's a new sheet, we recommend sharing an editable link so other
#' ## lab members can swap out as necessary.
#' }
lab_presenters <- function(
presenters, start_date = "2019-09-18",
sheet_name = "Jaffelab research presenters", n = 2, repeat_day = 7) {
lab_presenters <- function(presenters, start_date = "2019-09-18",
sheet_name = "Jaffelab research presenters", n = 2, repeat_day = 7) {
## Check inputs
if (!is.character(presenters)) {
stop("'presenters' should be a character vector.", call. = FALSE)
Expand Down
7 changes: 3 additions & 4 deletions R/merge_rse_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
#' summary(mean_ERCCsumLogErr - ERCCsumLogErr)
#' )
#'

merge_rse_metrics <- function(rse) {
stopifnot(is(rse, "RangedSummarizedExperiment"))
stopifnot(
Expand Down Expand Up @@ -138,7 +137,7 @@ merge_rse_metrics <- function(rse) {
rse$mitoMapped <- sapply(rse$mitoMapped, sum)
rse$totalMapped <- sapply(rse$totalMapped, sum)

if("ERCCsumLogErr" %in% colnames(colData(rse))) {
if ("ERCCsumLogErr" %in% colnames(colData(rse))) {
message(Sys.time(), " attempting to approximate ERCCsumLogErr.")
stopifnot(is(rse$ERCCsumLogErr, "NumericList"))

Expand All @@ -161,9 +160,9 @@ merge_rse_metrics <- function(rse) {

## Then compute the approximate result starting from a NumericList input
rse$ERCCsumLogErr <- sapply(rse$ERCCsumLogErr, function(sumlogerr) {
log2(mean((2 ^ (
log2(mean((2^(
sumlogerr + ercc_expected_conc
)) ^ (1 / n_erccs)) ^ n_erccs) - ercc_expected_conc
))^(1 / n_erccs))^n_erccs) - ercc_expected_conc
})
}

Expand Down
43 changes: 39 additions & 4 deletions man/merge_rse_metrics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 663a401

Please sign in to comment.