Skip to content

Commit

Permalink
Merge branch 'devel' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
teng-gao committed Aug 12, 2022
2 parents 1453c50 + ded257d commit 429f5b6
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 122 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: numbat
Title: Accurate reconstruction of copy number profiles in scRNAseq data using population haplotype phasing
Title: Haplotype-aware CNV anlaysis from scRNA-seq
URL: https://github.com/kharchenkolab/numbat, https://kharchenkolab.github.io/numbat
Version: 0.1.3
Version: 1.0.0
Authors@R: c(person("Teng","Gao", email="[email protected]", role=c("cre", "aut")), person("Hirak", "Sarkar", email="[email protected]", role="aut"), person("Evan", "Biederstedt", email="[email protected]", role="aut"), person("Peter", "Kharchenko", email = "[email protected]", role = "aut"))
Description: Numbat is a computational method that infers copy number variations (CNVs) in cancer scRNA-Seq data and reconstructs the tumor phylogeny. The R package integrates signals from gene expression, allelic ratio, and population haplotype structures to accurately infer allele-specific CNVs in single cells and reconstruct their lineage relationship. Numbat can be used to: 1. detect allele-specific copy number variations from single-cells; 2. differentiate tumor versus normal cells in the tumor microenvironment; 3. infer the clonal architecture and evolutionary history of profiled tumors. Numbat does not require tumor/normal-paired DNA or genotype data, but operates solely on the donor scRNA-data data (for example, 10x Cell Ranger output).
License: MIT
Expand Down
19 changes: 11 additions & 8 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ run_numbat = function(
p = plot_bulks(bulk_subtrees, min_LLR = min_LLR, use_pos = TRUE)
ggsave(
glue('{out_dir}/bulk_subtrees_{i}.png'), p,
width = 12, height = 2*length(unique(bulk_subtrees$sample)), dpi = 200
width = 12, height = 2*length(unique(bulk_subtrees$sample)), dpi = 250
)
}

Expand All @@ -253,7 +253,6 @@ run_numbat = function(
bulk_subtrees = retest_bulks(
bulk_subtrees,
segs_consensus,
# segs_loh = segs_loh,
diploid_chroms = diploid_chroms,
min_LLR = min_LLR,
ncores = ncores
Expand Down Expand Up @@ -304,7 +303,7 @@ run_numbat = function(
p = plot_bulks(bulk_clones, min_LLR = min_LLR, use_pos = TRUE)
ggsave(
glue('{out_dir}/bulk_clones_{i}.png'), p,
width = 12, height = 2*length(unique(bulk_clones$sample)), dpi = 200
width = 12, height = 2*length(unique(bulk_clones$sample)), dpi = 250
)
}

Expand Down Expand Up @@ -474,7 +473,7 @@ run_numbat = function(
clone_bar = TRUE
)

ggsave(glue('{out_dir}/panel_{i}.png'), panel, width = 8, height = 3.5, dpi = 200)
ggsave(glue('{out_dir}/panel_{i}.png'), panel, width = 8, height = 3.5, dpi = 250)

},
error = function(e) {
Expand Down Expand Up @@ -518,7 +517,7 @@ run_numbat = function(
}
}

# Output final subclone bulk profiles
# Output final subclone bulk profiles - logic can be simplified
bulk_clones = make_group_bulks(
groups = clones,
count_mat = count_mat,
Expand All @@ -535,7 +534,7 @@ run_numbat = function(
gamma = gamma,
alpha = alpha,
min_genes = min_genes,
common_diploid = common_diploid,
common_diploid = FALSE,
diploid_chroms = diploid_chroms,
segs_loh = segs_loh,
ncores = ncores,
Expand All @@ -556,7 +555,7 @@ run_numbat = function(
p = plot_bulks(bulk_clones, min_LLR = min_LLR, use_pos = TRUE)
ggsave(
glue('{out_dir}/bulk_clones_final.png'), p,
width = 12, height = 2*length(unique(bulk_clones$sample)), dpi = 200
width = 12, height = 2*length(unique(bulk_clones$sample)), dpi = 250
)
}

Expand Down Expand Up @@ -763,7 +762,7 @@ run_group_hmms = function(
#' @param min_overlap numeric Minimum overlap fraction to determine count two events as as overlapping
#' @return dataframe Consensus segments
#' @keywords internal
get_segs_consensus = function(bulks, min_LLR = 5, min_overlap = 0.45, retest = FALSE) {
get_segs_consensus = function(bulks, min_LLR = 5, min_overlap = 0.45, retest = TRUE) {

if (!'sample' %in% colnames(bulks)) {
bulks$sample = 1
Expand Down Expand Up @@ -1009,6 +1008,10 @@ get_clone_post = function(gtree, exp_post, allele_post) {
#' @return dataframe Consensus CNV segments
#' @keywords internal
resolve_cnvs = function(segs_all, min_overlap = 0.5, debug = FALSE) {

if (nrow(segs_all) == 0) {
return(segs_all)
}

V = segs_all %>% ungroup() %>% mutate(vertex = 1:n(), .before = 1)

Expand Down
Loading

0 comments on commit 429f5b6

Please sign in to comment.