Skip to content

Commit

Permalink
adds rank ordering and a better dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
rmflight committed Apr 11, 2024
1 parent d6ca45d commit 4158d89
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ICIKendallTau
Title: Calculates information-content-informed Kendall-tau
Version: 1.1.0
Version: 1.1.1
Authors@R: c(
person(
given = c("Robert", "M"),
Expand Down Expand Up @@ -40,5 +40,7 @@ Suggests: furrr,
naniar
URL: https://moseleybioinformaticslab.github.io/ICIKendallTau/
https://github.com/moseleybioinformaticslab/ICIKendallTau/
BugReports: https://github.com/moseleybioinformaticslab/ICIKendallTau/issues
BugReports:
https://github.com/moseleybioinformaticslab/ICIKendallTau/issues
Config/testthat/edition: 3
Depends: R (>= 2.10)
12 changes: 12 additions & 0 deletions R/left_censorship.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,15 @@ add_uniform_noise = function(value, n_rep, sd, use_zero = FALSE){
#'
#' @source Robert M Flight
"missing_dataset"

#' Example RNA-Seq Dataset With Missingness
#'
#' An example dataset from RNA-seq experiment on yeast, created by Gierliński et al.,
#' "Statistical models for RNA-seq data derived from a two-condition 48-replicate experiment",
#' Bioinformatics, 31, 2015 <https://doi.org/10.1093/bioinformatics/btv425>.
#'
#' @format ## `yeast_missing`
#' A matrix with 6887 rows (genes) and 96 columns (samples).
#'
#' @source <https://dx.doi.org/10.6084/M9.FIGSHARE.1425502.V1> <https://dx.doi.org/10.6084/M9.FIGSHARE.1425503.V1>
"yeast_missing"
19 changes: 19 additions & 0 deletions R/rank-ordering.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rank_order_data = function(data_matrix, global_na = c(NA, Inf, 0))
{
missing_loc = setup_missing_matrix(data_matrix, global_na)
data_matrix_na = data_matrix
data_matrix_na[missing_loc] = NA
sample_ranks = purrr::map(seq_len(ncol(data_matrix_na)), \(in_col){
rank(data_matrix_na[, in_col], na.last = FALSE)

})
sample_ranks = do.call(cbind, sample_ranks)
median_ranks = apply(sample_ranks, 1, median)
rank_order = order(median_ranks, decreasing = TRUE)

perc_missing = colSums(is.na(data_matrix_na)) / nrow(data_matrix_na)
perc_order = order(perc_missing, decreasing = TRUE)

return(original = data_matrix_na,
ordered = data_matrix_na[rank_order, perc_order])
}
Binary file added data/yeast_missing.rda
Binary file not shown.
24 changes: 24 additions & 0 deletions man/yeast_missing.Rd

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

0 comments on commit 4158d89

Please sign in to comment.