Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step 7 computing tumor subclusters via random_trees NEVER FINISH #668

Open
mluciarr opened this issue Jul 15, 2024 · 0 comments
Open

Step 7 computing tumor subclusters via random_trees NEVER FINISH #668

mluciarr opened this issue Jul 15, 2024 · 0 comments

Comments

@mluciarr
Copy link

mluciarr commented Jul 15, 2024

Hi!

First of all, thank you for developing this useful tool and keeping it updated.

In my analysis, I want to create a phylogenetic tree based on the CNV of each chromosome, specifically using the package Uphyloplot2, which requires the “cell_groupings” files from inferCNV. We need to use the "random_trees" option in the tumor_subcluster_partition_method variable. I followed this approach, but for some reason, the process keeps running (consuming a huge amount of memory) and eventually, the computer collapses and shuts down. I have no idea how to make it work or if there is another option to create this phylogenetic tree based on the CNV of each cell.

I'm looking forward to hearing from you!

Thank you in advance,

Lucia

Here the code:

####### Prepare inferCNV objects #######
ref_group_names <- c("ABC", "DZ GCBC", "IFN NBC", "LZ GCBC",  "MBC", "NBC", "PC")
      
    # RNA
infer.rna.obj <- CreateInfercnvObject(
      raw_counts_matrix = as.matrix(cbind(seu2@assays$RNA$counts[rownames(gene_order_file),],healthy2@assays$RNA$counts[rownames(gene_order_file),])), # do not input sparse matrix, or infercnv::run may fail
      gene_order_file = gene_order_file,
      annotations_file = data.frame(anno = c(rep("tumor",ncol(seu2)),healthy2$annotation_level1), row.names = c(colnames(seu2),colnames(healthy2))),
      ref_group_names = ref_group_names,
      delim = "\t",
      max_cells_per_group = NULL,
      min_max_counts_per_cell = c(0, +Inf) # no filters, already good QC data
    )
    
   
#######################################
# Run inferCNV
#######################################

res.rna <- infercnv::run(
      infer.rna.obj,
      cutoff=0, # cutoff=1 works well for Smart-seq2, and cutoff=0.1 works well for 10x Genomics
      out_dir=dir_output_script_sample,
      cluster_by_groups=F, # DO NOT use cluster_by_groups, so that the analysis is run across all cells independently of any cluster.
      k_obs_groups=15,
      denoise=TRUE,
      HMM=TRUE, 
      BayesMaxPNormal = 0.5, 
      HMM_type='i6',
     tumor_subcluster_partition_method = "random_trees", 
     hclust_method='ward.D2',
      no_prelim_plot=FALSE,
      no_plot=FALSE,
      plot_steps=TRUE,
      plot_probabilities=TRUE,
      plot_chr_scale=TRUE,
      chr_lengths=chr_lengths,
      png_res=300,
     save_final_rds = TRUE,
     write_phylo = TRUE,
      leiden_resolution = 0.001, # to reduce the number of subclusters. default is "auto"
      k_nn = 20 # 20 is default, minimum subneighbors in the leiden
    )

Here the output when it get stuck in the step 7:

	STEP 07: computing tumor subclusters via random_trees

INFO [2024-07-15 11:07:04] define_signif_tumor_subclusters(p_val=0.1
INFO [2024-07-15 11:07:04] ::subtract_ref_expr_from_obs:Start inv_log=TRUE, use_bounds=TRUE
INFO [2024-07-15 11:07:04] subtracting mean(normal) per gene per cell across all data
INFO [2024-07-15 11:07:25] -subtracting expr per gene, use_bounds=TRUE
INFO [2024-07-15 11:07:46] -mirroring for hspike
INFO [2024-07-15 11:07:46] ::subtract_ref_expr_from_obs:Start inv_log=TRUE, use_bounds=TRUE
INFO [2024-07-15 11:07:46] subtracting mean(normal) per gene per cell across all data
INFO [2024-07-15 11:07:56] -subtracting expr per gene, use_bounds=TRUE
INFO [2024-07-15 11:08:00] define_signif_tumor_subclusters(), tumor: all_observations
INFO [2024-07-15 12:58:26] random trees, using 4 parallel threads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant