Skip to content

Commit a487600

Browse files
committed
use pattern to get mirgenedb working
1 parent 5845055 commit a487600

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

data/examples/annotate/mirtop.db

52 KB
Binary file not shown.

mirtop/mirna/mapper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Read database information"""
22

33
from collections import defaultdict
4+
import re
45

56
import mirtop.libs.logger as mylog
67

@@ -290,6 +291,7 @@ def read_gtf_to_precursor_mirgenedb(gtf, format="precursor"):
290291
db = defaultdict(list)
291292
db_mir = defaultdict(list)
292293
id_dict = dict()
294+
pattern = r'(_3p\*?|_5p\*?)'
293295
with open(gtf) as in_handle:
294296
for line in in_handle:
295297
if line.startswith("#"):
@@ -305,7 +307,10 @@ def read_gtf_to_precursor_mirgenedb(gtf, format="precursor"):
305307
if cols[2] == "miRNA":
306308
idname_mi = [n.split("=")[1] for n in cols[-1].split(";")
307309
if n.startswith("ID")][0]
308-
parent = "%s_pre" % idname_mi.replace("_3p", "").replace("_5p", "")
310+
# parent = "%s_pre" % idname_mi.replace("_3p.*", "").replace("_5p.*", "")
311+
parent = re.sub(pattern, '', idname_mi)
312+
parent = "%s_pre" % parent
313+
# import pdb; pdb.set_trace()
309314
db_mir[(parent, name)] = [chrom,
310315
int(start), int(end),
311316
strand, parent]

0 commit comments

Comments
 (0)