Skip to content

Commit 11e69bb

Browse files
committed
fixed read len assumption bug
1 parent bc1297f commit 11e69bb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

RiboMetric/metrics.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,11 @@ def fourier_transform(
900900
"""
901901
fourier_scores = {}
902902
global_counts = []
903+
read_lengths = [i for i in read_lengths if i in metagene_profile['start'].keys()]
904+
905+
if not read_lengths:
906+
read_lengths = metagene_profile['start'].keys()
907+
903908
for read_len in read_lengths:
904909
if not global_counts:
905910
global_counts = list(metagene_profile['start'][read_len].values())
@@ -976,6 +981,11 @@ def multitaper(
976981
"""
977982
multitaper_scores = {}
978983
global_counts = []
984+
read_lengths = [i for i in read_lengths if i in metagene_profile['start'].keys()]
985+
986+
if not read_lengths:
987+
read_lengths = metagene_profile['start'].keys()
988+
979989
for read_len in read_lengths:
980990
if not global_counts:
981991
global_counts = list(metagene_profile['start'][read_len].values())
@@ -1022,6 +1032,11 @@ def wavelet_transform(
10221032
"""
10231033
wavelet_scores = {}
10241034
global_counts = []
1035+
read_lengths = [i for i in read_lengths if i in metagene_profile['start'].keys()]
1036+
1037+
if not read_lengths:
1038+
read_lengths = metagene_profile['start'].keys()
1039+
10251040
for read_len in read_lengths:
10261041
if not global_counts:
10271042
global_counts = list(metagene_profile['start'][read_len].values())

0 commit comments

Comments
 (0)