Skip to content

Commit

Permalink
update gtf prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-ran committed Mar 11, 2022
1 parent 8086280 commit f124bea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions cli/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ def prepare(
sort and merge utr region information
"""
bedtmp = pybedtools.BedTool(utr_outfile)
bedtmp = bedtmp.sort().merge(d=500, s = True, o='distinct', c='6')
mt_tmp = pybedtools.BedTool('\n'.join(mt_lst), from_string=True).sort().merge(s=True, o='distinct', c='6')
bedtmp = bedtmp.sort().merge(d=500, s = True)

utr_out = open(utr_outfile, 'w')
utr_out.write(str(bedtmp))
utr_out.write(str(mt_tmp))
if mt_lst:
mt_tmp = pybedtools.BedTool('\n'.join(mt_lst), from_string=True).sort().merge(s=True)
utr_out.write(str(mt_tmp))
utr_out.close()

"""
Expand All @@ -152,7 +154,7 @@ def prepare(
'\n'.join(intron_lst),
from_string=True
)
intron_bed = intron_bed.sort().merge(s = True, o='distinct', c='6')
intron_bed = intron_bed.sort().merge(s = True)
intron_bed = intron_bed.intersect(bedtmp, v=True)
intron_lst = []
for line in intron_bed:
Expand Down
4 changes: 2 additions & 2 deletions utils/isoform.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def structure(self):

if "transcript_biotype" in line.attributes:
gene_structure[gid][tid]["transcript_biotype"] = line.attributes["transcript_biotype"]
elif "transcript_biotype" in line.attributes:
gene_structure[gid][tid]["transcript_biotype"] = line.attributes["transcript_biotype"]
elif "transcript_type" in line.attributes:
gene_structure[gid][tid]["transcript_type"] = line.attributes["transcript_type"]

gene_structure[gid][tid]["strand"] = line.strand
gene_structure[gid][tid][line.feature].append(
Expand Down

0 comments on commit f124bea

Please sign in to comment.