Skip to content

Commit

Permalink
Add utility function for filtering cells)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjwilliams1 committed Aug 24, 2021
1 parent 44047ba commit 91942ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export(createSNVmatrix)
export(create_cntransitions)
export(create_segments)
export(createbreakpointmatrix)
export(filterbycells)
export(filtercn)
export(fix_assignments)
export(fixjitter)
Expand Down
17 changes: 14 additions & 3 deletions R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -963,10 +963,10 @@ BAFdistance <- function(cn) {
filtercn <- function(cn,
average_distance_filt = 0.1,
ploidy_filt = NULL,
totalcounts_filt = 0,
totalhapcounts_filt = 0,
nsegments_filt = 0){
qcnew <- dplyr::filter(cn$qc_per_cell, average_distance >= average_distance_filt,
totalcounts >= totalcounts_filt,
qcnew <- dplyr::filter(cn$qc_per_cell, average_distance <= average_distance_filt,
totalhapcounts >= totalhapcounts_filt,
nsegments >= nsegments_filt)
if (!is.null(ploidy_filt)){
qcnew <- dplyr::filter(qcnew, ploidy == ploidy_filt)
Expand All @@ -980,3 +980,14 @@ filtercn <- function(cn,

return(cn)
}

#' @export
filterbycells <- function(cn, cells){
cn$data <- cn$data %>%
dplyr::filter(cell_id %in% cells)
cn$qc_per_cell <- cn$qc_per_cell %>%
dplyr::filter(cell_id %in% cells)
cn$qc_summary <- qc_summary(cn)

return(cn)
}

0 comments on commit 91942ed

Please sign in to comment.