You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a strange situation, after the integration of batches., the cNMF result file cNMF.usages.k_28.dt_2_0.consensus.txt is blank. Other result files, such as cNMF.gene_spectra_score.k_28.dt_2_0.txt, are normal, and do not experience any errors during the process.
In addition, when the integration of batches is not performed, the resulting files are all normal.
Here is the code when executing off batch and not executing.
My data consists of multiple samples, which should be executed in integration of batche. May I ask how to solve the above situation?
`
Integration of batches.
import os
import pandas as pd
import numpy as np
import pickle
from scipy.io import mmread
import scipy.sparse as sp
import matplotlib.pyplot as plt
from IPython.display import Image
import scanpy as sc
from cnmf import cNMF, Preprocess
np.random.seed(14)
##############
adata = sc.read_h5ad("merge/counts.h5ad")
adata.var_names_make_unique()
###################
p = Preprocess(random_seed=14)
(adata_c, adata_tpm, hvgs) = p.preprocess_for_cnmf(adata, harmony_vars=['sample'], n_top_rna_genes = 2000, librarysize_targetsum= 1e6, save_output_base='./batchcorrect_merge')
##############
output_dir = "batchcorrect_merge"
run_name = 'merge_cNMF'
##############
cnmf_obj = cNMF(output_dir=output_dir, name=run_name)
cnmf_obj.prepare(counts_fn='batchcorrect_merge.Corrected.HVG.Varnorm.h5ad' ,
tpm_fn='batchcorrect_merge.TP10K.h5ad',
genes_file='batchcorrect_merge.Corrected.HVGs.txt',
components=np.arange(2,31), n_iter=200, seed=14, num_highvar_genes=2000)
cnmf_obj.factorize(worker_i=0, total_workers=1)
cnmf_obj.combine()
cnmf_obj.k_selection_plot(close_fig=False)
##############
selected_K = 28
density_threshold = 2
cnmf_obj.consensus(k= selected_K, density_threshold = density_threshold, show_clustering=True, close_clustergram_fig=False)
Hi @zhrmxxs, that is very odd. The cNMF.usages.k_28.dt_2_0.consensus.txt file is more of an intermediate output file so I'm surprised it is blank. I'll have to look into that a bit more.
I encountered a strange situation, after the integration of batches., the cNMF result file cNMF.usages.k_28.dt_2_0.consensus.txt is blank. Other result files, such as cNMF.gene_spectra_score.k_28.dt_2_0.txt, are normal, and do not experience any errors during the process.
In addition, when the integration of batches is not performed, the resulting files are all normal.
Here is the code when executing off batch and not executing.
My data consists of multiple samples, which should be executed in integration of batche. May I ask how to solve the above situation?
`
Integration of batches.
import os
import pandas as pd
import numpy as np
import pickle
from scipy.io import mmread
import scipy.sparse as sp
import matplotlib.pyplot as plt
from IPython.display import Image
import scanpy as sc
from cnmf import cNMF, Preprocess
np.random.seed(14)
##############
adata = sc.read_h5ad("merge/counts.h5ad")
adata.var_names_make_unique()
###################
p = Preprocess(random_seed=14)
(adata_c, adata_tpm, hvgs) = p.preprocess_for_cnmf(adata, harmony_vars=['sample'], n_top_rna_genes = 2000, librarysize_targetsum= 1e6, save_output_base='./batchcorrect_merge')
##############
output_dir = "batchcorrect_merge"
run_name = 'merge_cNMF'
##############
cnmf_obj = cNMF(output_dir=output_dir, name=run_name)
cnmf_obj.prepare(counts_fn='batchcorrect_merge.Corrected.HVG.Varnorm.h5ad' ,
tpm_fn='batchcorrect_merge.TP10K.h5ad',
genes_file='batchcorrect_merge.Corrected.HVGs.txt',
components=np.arange(2,31), n_iter=200, seed=14, num_highvar_genes=2000)
cnmf_obj.factorize(worker_i=0, total_workers=1)
cnmf_obj.combine()
cnmf_obj.k_selection_plot(close_fig=False)
##############
selected_K = 28
density_threshold = 2
cnmf_obj.consensus(k= selected_K, density_threshold = density_threshold, show_clustering=True, close_clustergram_fig=False)
#######################################################################################
#######################################################################################
#######################################################################################
No integration of batches.
import os
import pandas as pd
import numpy as np
import pickle
from scipy.io import mmread
import scipy.sparse as sp
import matplotlib.pyplot as plt
from IPython.display import Image
import scanpy as sc
from cnmf import cNMF, Preprocess
np.random.seed(14)
##############
output_dir = "'merge/"
run_name = 'merge_cNMF'
count_adat_fn = 'merge/counts.h5ad'
##############
cnmf_obj = cNMF(output_dir=output_dir, name=run_name)
cnmf_obj.prepare(counts_fn=count_adat_fn, components=np.arange(2,31), n_iter=200, seed=14, num_highvar_genes=2000)
cnmf_obj.factorize(worker_i=0, total_workers=1)
cnmf_obj.combine()
cnmf_obj.k_selection_plot(close_fig=False)
##############
selected_K = 28
density_threshold = 2
cnmf_obj.consensus(k= selected_K, density_threshold = density_threshold, show_clustering=True, close_clustergram_fig=False)`
The text was updated successfully, but these errors were encountered: