Skip to content

Commit

Permalink
up vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielaCorbetta committed May 22, 2024
1 parent a1d79c1 commit d77e83d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
17 changes: 10 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ Package: scConform
Type: Package
Title: Conformal Inference For Cell Type Annotation
Version: 0.99.0
Authors@R: person("Corbetta", "Daniela", email = "daniela.corbetta@phd.unipd.it", role = c("aut", "cre"))
Authors@R: person("Corbetta", "Daniela",
email = "daniela.corbetta@phd.unipd.it",
role = c("aut", "cre"))
Maintainer: Daniela Corbetta <daniela.corbetta@phd.unipd.it>
Description: Builds prediction interval for cell type annotation using conformal inference and conformal risk control.
It provides two main methods. The first one gives prediction intervals with coverage guarantees based
on standard conformal inference. The second one instead gives hierarchical prediction intervals that are consistent
Description: Builds prediction interval for cell type annotation using conformal
inference and conformal risk control.
It provides two main methods. The first one gives prediction intervals with
coverage guarantees based on standard conformal inference. The second one
instead gives hierarchical prediction intervals that are consistent
with the cell ontology.
License: Artistic-2.0
LazyData: true
Expand All @@ -18,12 +22,11 @@ Suggests:
rmarkdown,
BiocStyle,
VGAM,
foreach,
ontoProc,
MerfishData,
doParallel,
igraph,
scuttle
scuttle,
SingleCellExperiment
Imports:
foreach,
igraph,
Expand Down
6 changes: 3 additions & 3 deletions R/getPredictionSets.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ getPredictionSets <- function(x.query, x.cal, y.cal, onto = NULL, alpha = 0.1,
# for(i in labels){
# p.query[,i] <- colData(x.query)[[i]]
# }
p.query <- .retrievePredMatrix(x.query)
p.query <- .retrievePredMatrix(x.query, K=K)
} else {
p.query <- x.query
}
Expand All @@ -212,7 +212,7 @@ getPredictionSets <- function(x.query, x.cal, y.cal, onto = NULL, alpha = 0.1,
# for(i in labels){
# p.cal[,i] <- colData(x.cal)[[i]]
# }
p.cal <- .retrievePredMatrix(x.cal)
p.cal <- .retrievePredMatrix(x.cal, K=K)
} else {
p.cal <- x.cal
}
Expand Down Expand Up @@ -295,7 +295,7 @@ getPredictionSets <- function(x.query, x.cal, y.cal, onto = NULL, alpha = 0.1,
## function to retrieve prediction matrix from the colData of a
## SingleCellExperiment object

.retrievePredMatrix <- function(sc) {
.retrievePredMatrix <- function(sc, K) {
n.sc <- ncol(sc)
p.sc <- matrix(NA, nrow = n.sc, ncol = K)
colnames(p.sc) <- labels
Expand Down
5 changes: 3 additions & 2 deletions R/utils_HierarchicalPS.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Function to get the hierarchical prediction sets for the observation in p.test
# Needs a vector of lambda values. For each of the lambdas computes the prediction sets
# for the data in the calibration set (p.cal n_cal x K matrix that contains
# Needs a vector of lambda values. For each of the lambdas computes the
# prediction sets for the data in the calibration set
# (p.cal n_cal x K matrix that contains
# estimated probabilities for each label). Based on these sets that compute the
# loss table and then gets lambda hat based on equation (4) in Bates and
# Angelopoulus (2023), Conformal Risk Control. Finally, builds prediction sets
Expand Down
39 changes: 33 additions & 6 deletions vignettes/vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ knitr::opts_chunk$set(

# Load useful packages

```{r setup, message=FALSE}
```{r libraries, message=FALSE}
library(scConform)
library(SingleCellExperiment)
library(VGAM)
Expand All @@ -34,11 +34,38 @@ library(MerfishData)
library(doParallel)
library(igraph)
library(scuttle)
#
# `%notin%` = Negate(`%in%`)
# num_cores <- 8
# cl1 <- makeCluster(num_cores)
# registerDoParallel(cl1)
`%notin%` = Negate(`%in%`)
num_cores <- 2
cl1 <- makeCluster(num_cores)
registerDoParallel(cl1)
```



***

## R.session Info

```{r SessionInfo, echo=FALSE, message=FALSE, warning=FALSE, comment=NA}
sessionInfo()
```


















0 comments on commit d77e83d

Please sign in to comment.