Closed sneddonucsf closed 1 year ago
Hi @sneddonucsf
It could be that for one (or more) of the topics none of the regions are overlapping with the cistarget database.
You can test this like this:
from ctxcore.rnkdb import FeatherRankingDatabase
from pycistarget.utils import target_to_query
db = FeatherRankingDatabase(rankings_db, name=None)
db_regions = db.genes
for topic in region_sets['topics_otsu'].keys():
try:
overlapping_regions = target_to_query(
region_sets['topics_otsu'][topic],
list(db_regions),
fraction_overlap = 0.4)
except:
print(topic)
Could you show the output of this?
Best,
Seppe
@SeppeDeWinter I tried:
import pyranges as pr
from pycistarget.utils import region_names_to_coordinates
region_sets = {}
region_sets['topics_otsu'] = {}
region_sets['DARs_Annotation'] = {}
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
region_sets['topics_otsu'][topic] = pr.PyRanges(region_names_to_coordinates(regions))
for DAR in markers_dict_Annotation.keys():
regions = markers_dict_Annotation[DAR].index[markers_dict_Annotation[DAR].index.str.startswith('chr')] #only keep regions on known chromosomes
region_sets['DARs_Annotation'][DAR] = pr.PyRanges(region_names_to_coordinates(regions))
for key in region_sets.keys():
print(f'{key}: {region_sets[key].keys()}')
rankings_db = '/wynton/home/sneddon/seandelao1991/scenic_proj/input/hg38_screen_v10_clust.regions_vs_motifs.rankings.feather'
from ctxcore.rnkdb import FeatherRankingDatabase
from pycistarget.utils import target_to_query
db = FeatherRankingDatabase(rankings_db, name=None)
db_regions = db.genes
for topic in region_sets['topics_otsu'].keys():
try:
overlapping_regions = target_to_query(
region_sets['topics_otsu'][topic],
list(db_regions),
fraction_overlap = 0.4)
except:
print(topic)
And got the error:
Traceback (most recent call last):
File "scenic+_6.py", line 53, in <module>
db = FeatherRankingDatabase(rankings_db, name=None)
File "/wynton/home/sneddon/seandelao1991/scenic_plus/lib/python3.8/site-packages/ctxcore/rnkdb.py", line 104, in __init__
super().__init__(name=name)
File "/wynton/home/sneddon/seandelao1991/scenic_plus/lib/python3.8/site-packages/ctxcore/rnkdb.py", line 29, in __init__
assert name, "Name must be specified."
AssertionError: Name must be specified.
Hi my mistake.
Can you do:
db = FeatherRankingDatabase(rankings_db, name="test")
instead?
Best,
Seppe
@SeppeDeWinter the output is:
topics_otsu: dict_keys(['Topic1', 'Topic2', 'Topic3', 'Topic4', 'Topic5', 'Topic6', 'Topic7', 'Topic8', 'Topic9', 'Topic10', 'Topic11', 'Topic12', 'Topic13', 'Topic14', 'Topic15', 'Topic16', 'Topic17', 'Topic18', 'Topic19', 'Topic20', 'Topic21', 'Topic22', 'Topic23', 'Topic24', 'Topic25'])
DARs_Annotation: dict_keys(['Alpha', 'Beta', 'EPs', 'Epsilon'])
Topic1
Topic2
Topic3
Topic4
Topic5
Topic6
Topic7
Topic8
Topic9
Topic10
Topic11
Topic12
Topic13
Topic14
Topic15
Topic16
Topic17
Topic18
Topic19
Topic20
Topic21
Topic22
Topic23
Topic24
Topic25
Hmm .. interesting. Seems like none of the regions in your topics overlap with the cistarget database. This is very unexpected.
I was looking at the regions you show above, they seem to have a length of 0? For example,
chr8:47260632-47260632 0.002511
chr14:69767503-69767503 0.002478
chr19:18429108-18429108 0.002436
chr5:69414851-69414851 0.002389
chr16:2905619-2905619 0.002362
By default these should be of length 500. This is probably the cause of the issue! Can you recheck how you ran the consensus peak calling?
Just to be absolutely sure this is the issue, can you also show the output of:
db_regions[0:100]
Best,
Seppe
@SeppeDeWinter silly mistake, I accidentally copied my 'start' position twice instead of 'start' and 'end' when exporting my peaks from ArchR. Fixed it, ran run_pycistarget()
and everything went smoothly. Thank you and sorry to bother!
Hello,
I am trying to run run_pycistarget() with the following:
but get the following error:
My objects are as following:
Does the issue have to do with my pyranges objects? I downloaded my databases from the cisTarget database. Thank you!