Skip to content

Commit

Permalink
Fix duplicate chunk of code following the merge of one cell group fix…
Browse files Browse the repository at this point in the history
… merge.

Former-commit-id: e3f7c6e
  • Loading branch information
GeorgescuC committed Apr 22, 2019
1 parent 7a9d3bf commit d0ce723
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
17 changes: 6 additions & 11 deletions R/inferCNV_heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,12 @@ plot_cnv <- function(infercnv_obj,

## Clustering separately by groups (ie. patients)

for (i in seq(1, max(obs_annotations_groups))) {
gene_indices_in_group <- which(obs_annotations_groups == i)
num_genes_in_group <- length(gene_indices_in_group)
flog.info(sprintf("Number of genes in group(%d) is %d", i, num_genes_in_group))
for (i in seq_len(max(obs_annotations_groups))) {
cell_indices_in_group <- which(obs_annotations_groups == i)
num_cells_in_group <- length(cell_indices_in_group)
flog.info(sprintf("Number of cells in group(%d) is %d", i, num_cells_in_group))

if (num_genes_in_group < 2) {
if (num_cells_in_group < 2) {
flog.info(sprintf("Skipping group: %d, since less than 2 entries", i))
ordered_names <- c(ordered_names, row.names(obs_data[which(obs_annotations_groups == i),, drop=FALSE]))
dfake = list()
Expand All @@ -577,7 +577,7 @@ plot_cnv <- function(infercnv_obj,
}
}
else {
data_to_cluster <- obs_data[gene_indices_in_group, hcl_group_indices, drop=FALSE]
data_to_cluster <- obs_data[cell_indices_in_group, hcl_group_indices, drop=FALSE]
flog.info(paste("group size being clustered: ", paste(dim(data_to_cluster), collapse=","), sep=" "))
group_obs_hcl <- hclust(dist(data_to_cluster), method=hclust_method)
ordered_names <- c(ordered_names, row.names(obs_data[which(obs_annotations_groups == i), ])[group_obs_hcl$order])
Expand All @@ -591,13 +591,8 @@ plot_cnv <- function(infercnv_obj,
write.tree(as.phylo(group_obs_hcl),
file=paste(file_base_name, sprintf("%s.observations_dendrogram.txt", output_filename_prefix), sep=.Platform$file.sep), append=TRUE)
}

group_obs_dend <- as.dendrogram(group_obs_hcl)
obs_dendrogram[[length(obs_dendrogram) + 1]] <- group_obs_dend
hcl_obs_annotations_groups <- c(hcl_obs_annotations_groups, rep(i, length(which(obs_annotations_groups == i))))
}


group_obs_dend <- as.dendrogram(group_obs_hcl)
obs_dendrogram[[length(obs_dendrogram) + 1]] <- group_obs_dend
hcl_obs_annotations_groups <- c(hcl_obs_annotations_groups, rep(i, length(which(obs_annotations_groups == i))))
Expand Down
Binary file not shown.

This file was deleted.

0 comments on commit d0ce723

Please sign in to comment.