aertslab / scenicplus

SCENIC+ is a python package to build gene regulatory networks (GRNs) using combined or separate single-cell gene expression (scRNA-seq) and single-cell chromatin accessibility (scATAC-seq) data.
Other
167 stars 27 forks source link

error for `export_pseudobulk` #55

Closed fengweimin-maker closed 1 year ago

fengweimin-maker commented 1 year ago

Hi, Thanks for great tools. It came out RuntimeError when I ran export_pseudobulk . I don't know why it is ok to run part of the cell types, but all of them can not run out. What's more it also got error when run for more than 2 or more fragments.

Error output `2022-10-23 19:48:05,770 cisTopic INFO Reading fragments from /00.data/07.fragments/Inj_5DPI_A211213013_5col_sorted.bed.gz

2022-10-23 20:03:05,129 cisTopic INFO Creating pseudobulk for CMPN_1 2022-10-23 20:08:35,478 cisTopic INFO CMPN_1 done! 2022-10-23 20:08:35,480 cisTopic INFO Creating pseudobulk for CMPN_2 2022-10-23 20:12:19,711 cisTopic INFO CMPN_2 done! 2022-10-23 20:12:19,712 cisTopic INFO Creating pseudobulk for CMPN_3 Traceback (most recent call last): File "", line 1, in File "/pycisTopic/pycisTopic/pseudobulk_peak_calling.py", line 185, in export_pseudobulk [ File "/pycisTopic/pycisTopic/pseudobulk_peak_calling.py", line 186, in export_pseudobulk_one_sample( File "/pycisTopic/pycisTopic/pseudobulk_peak_calling.py", line 284, in export_pseudobulk_one_sample group_pr.to_bigwig( File "/scenicplus/lib/python3.8/site-packages/pyranges/pyranges.py", line 5339, in to_bigwig result = _to_bigwig(self, path, chromosome_sizes, rpm, divide, value_col, dryrun) File "/scenicplus/lib/python3.8/site-packages/pyranges/out.py", line 203, in _to_bigwig bw.addEntries(chromosomes, starts, ends=ends, values=values) RuntimeError: The entries you tried to add are out of order, precede already added entries, or otherwise use illegal values. Please correct this and try again.`

my script: fragments_dict = {'Inj_5DPI_A211213013': 'Inj_5DPI_A211213013_5col_sorted.bed.gz'} chromsizes=pd.read_csv('size.txt', sep='\t') chromsizes = chromsizes[['name','length']] chromsizes.columns = ['Chromosome','End'] chromsizes['Start']=[0]*chromsizes.shape[0] chromsizes=chromsizes.loc[:,['Chromosome', 'Start', 'End']] chromsizes=pr.PyRanges(chromsizes) from pycisTopic.pseudobulk_peak_calling import export_pseudobulk bw_paths, bed_paths = export_pseudobulk(input_data = meta, variable = 'Celltype_Final', sample_id_col = 'dataset', chromsizes = chromsizes, bed_path = os.path.join(work_dir, 'scATAC/consensus_peak_calling/pseudobulk_bed_files/'), bigwig_path = os.path.join(work_dir, 'scATAC/consensus_peak_calling/pseudobulk_bw_files/'), path_to_fragments = fragments_dict, n_cpu = 1, normalize_bigwig = True, remove_duplicates = True, _temp_dir = os.path.join(tmp_dir, 'r'), split_pattern = '-')

Version (please complete the following information):

cbravo93 commented 1 year ago

Hi @fengweimin-maker !

Can you provide a view of the fragments file (subsetting the barcodes for that cell type) and cell data (on that cell type)? And also chromsizes?

Cheers!

C

fengweimin-maker commented 1 year ago

Hi,C

Thank you for replying so quickly! I have an analysis with Signac for my data, so It can work whth the follow tutorial. Thank you again!

Best wish! W

SeppeDeWinter commented 1 year ago

Closing because of inactivity