aertslab / pycisTopic

pycisTopic is a Python module to simultaneously identify cell states and cis-regulatory topics from single cell epigenomics data.
Other
58 stars 12 forks source link

region_sets #134

Closed TingTingShao closed 7 months ago

TingTingShao commented 7 months ago

Hi,

When I run the code:

# Convert to dictionary of pyranges objects.
region_sets = {}
region_sets['topics_otsu'] = {}
region_sets['topics_top_3'] = {}
region_sets['DARs'] = {}
for topic in region_bin_topics_otsu.keys():
    regions = region_bin_topics_otsu[topic].index[region_bin_topics_otsu[topic].index.str.startswith('chr')] #only keep regions on known chromosomes
    print('-----------')
    print(pr.PyRanges(region_names_to_coordinates(regions)))
    region_sets['topics_otsu'][topic] = pr.PyRanges(region_names_to_coordinates(regions))
for topic in region_bin_topics_top3k.keys():
    regions = region_bin_topics_top3k[topic].index[region_bin_topics_top3k[topic].index.str.startswith('chr')] #only keep regions on known chromosomes
    region_sets['topics_top_3'][topic] = pr.PyRanges(region_names_to_coordinates(regions))
for DAR in markers_dict.keys():
    regions = markers_dict[DAR].index[markers_dict[DAR].index.str.startswith('chr')] #only keep regions on known chromosomes
    region_sets['DARs'][DAR] = pr.PyRanges(region_names_to_coordinates(regions))

for key in region_sets.keys():
    print(f'{key}: {region_sets[key].keys()}')

It shows error

RuleException:
ValueError in file /vsc-hard-mounts/leuven-data/351/vsc35107/master_thesis/workflow_new/Snakefile02, line 897:
Length mismatch: Expected axis has 0 elements, new values have 3 elements

Could I please ask what is the reason for this kind of error?

Thanks, tingting

SeppeDeWinter commented 7 months ago

Hi TingTing

I'm not sure, the error is quite cryptic. What part of the code is throwing this error?

Best,

Seppe

TingTingShao commented 7 months ago

Hi,

The keys with empty values caused the error.

Thanks tingting