diff --git a/R/inferCNV_heatmap.R b/R/inferCNV_heatmap.R index 17c28762..9a225175 100755 --- a/R/inferCNV_heatmap.R +++ b/R/inferCNV_heatmap.R @@ -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() @@ -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]) @@ -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)))) diff --git a/inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz b/inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz new file mode 100644 index 00000000..65c5493e Binary files /dev/null and b/inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz differ diff --git a/inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz.REMOVED.git-id b/inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz.REMOVED.git-id deleted file mode 100644 index 21b09308..00000000 --- a/inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -65c5493e2be58957a9f6314b35e8f8dfa22fdcc8 \ No newline at end of file