Skip to content

Commit

Permalink
Bug fix for automatic namings
Browse files Browse the repository at this point in the history
  • Loading branch information
caravagn committed Oct 26, 2020
1 parent 67aa0fe commit e66b2d7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified R/.DS_Store
Binary file not shown.
18 changes: 11 additions & 7 deletions R/Clusters_denovo.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,30 @@
#' ggplot(new_assignments, aes(VAF, fill = cluster)) + geom_histogram(binwidth = 0.01)
Clusters_denovo = function(x, y)
{
is_mobster_fit(x)
is_mobster_input_dataset(y)
mobster:::is_mobster_fit(x)
mobster:::is_mobster_input_dataset(y)

# actual clusters
components = names(mobster:::.params_Pi(x))

# per-component density
densities = NULL
densities = y
for(component in seq_along(components))
{
comp_density = ddbpmm(x, data = y$VAF, components = component, log = TRUE) %>% data.frame()
colnames(comp_density) = components[component]

densities = dplyr::bind_cols(
densities,
ddbpmm(x, data = y$VAF, components = component, log = TRUE) %>% data.frame()
comp_density
)
}
colnames(densities) = components
# colnames(densities) = components
densities = densities %>% as_tibble()

# Hard clustering assignments
densities$cluster = components[apply(densities, 1, which.max)]
densities$cluster = components[apply(densities[, components, drop = FALSE], 1, which.max)]

dplyr::bind_cols(y, densities) %>% as_tibble()
densities
# dplyr::bind_cols(y, densities) %>% as_tibble()
}
17 changes: 17 additions & 0 deletions mobster.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source

0 comments on commit e66b2d7

Please sign in to comment.