Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lingfeiwang committed Aug 18, 2023
1 parent c3a3eda commit c2c1d85
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/dictys/chromatin.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,13 @@ def _motif_postproc(dret,fi_exp:str,fo_bed:str,fo_wellington:str,fo_homer:str)->
t1=set(namet)
namem=[x.split('_') for x in namem]
namem=['_'.join([','.join(list(filter(lambda y:y in t1,x[0].split(','))))]+x[1:]) for x in namem]
if len(namem)!=len(set(namem)):
raise ValueError('Found non-unique motif name suffices. Each motif name is recommended to contain a unique suffix.')
dh.columns=dw.columns=namem
namem=np.array(namem)
#Remove motifs having no TF in current dataset
t1=[not x.startswith('_') for x in namem]
dw,dh=[x[:,t1] for x in [dw,dh]]
namem,=[x[t1] for x in [namem]]
if len(namem)!=len(set(namem)):
raise ValueError('Found non-unique motif name suffices. Each motif name is recommended to contain a unique suffix.')
assert dw.shape==(len(namep),len(namem)) and dh.shape==(len(namep),len(namem))
assert np.isfinite(dw).all() and np.isfinite(dh).all()
assert (dw>=0).all() and (dh>=0).all()
Expand Down

0 comments on commit c2c1d85

Please sign in to comment.