Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpn1024 committed Feb 7, 2018
1 parent 17ab7d9 commit acdbf59
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2018-2-7 ribotish 0.2.0

Lower the threshold between fasttest and normal test to increase testing speed.

Some python3 compatibility updates.

2018-1-15 ribotish 0.1.11

Update codes to allow genes with transcripts in different strands in chromosome.
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
README for Ribo-TISH (0.1.11)
README for Ribo-TISH (0.2.0)
==================================
<2018-1-15 Peng Zhang>
<2018-2-7 Peng Zhang>

Introduction
============
Expand Down
4 changes: 2 additions & 2 deletions bin/ribotish
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Copyright (c) 2016 Peng Zhang <[email protected]>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).
@status: experimental
@version: 0.1.9
@status: Alpha
@version: 0.2.0
@author: Peng Zhang
@contact: [email protected]
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# the distribution).
#
# @status: Alpha
# @version: 0.1.11
# @version: 0.2.0
# @author: Peng Zhang
# @contact: [email protected]

Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__all__=["run"]
__version__ = '0.1.11'
__version__ = '0.2.0'
41 changes: 39 additions & 2 deletions src/zbio/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,40 @@ def contradict(self, other) :
si = self.intersect([(p1, p2)])
oi = other.intersect([(p1, p2)])
return si.sub(oi), oi.sub(si)

def genome_pos(self, p, strand = '+', bias = 1): # exon only
if len(self) == 0: return None
m = self.rlen() # cdna_length()
if p < 0 or p > m: return None
if strand == '-':
p = m - p
bias = 1 - bias
if p == 0 : return self.start
if p == m: return self.stop
p1 = p
for itv in self.lst:
l = itv[1] - itv[0]
if l - p1 >= bias:
return p1 + itv[0] # e.start
else:
p1 -= l
return None
def cdna_pos(self, p, strand = '+', strict = False):
'''if strict is True, the 3' end of exon will be considered as not in the transcript,
if strict is False, 3' end of exon will be considered as start of the next exon,
or transcript end (self.cdna_length()) if in the last exon.
'''
if len(self.lst) == 0 : return None
i, c = self.nearest(p)
if c != 0 : return None
if strict:
if strand != '-' and p == self.lst[i][1]: return None
if strand == '-' and p == self.lst[i][0]: return None
pos = sum([self.lst[j][1] - self.lst[j][0] for j in range(i)])
pos += p - self.lst[i][0]
if strand == '-':
pos = self.rlen() - pos
return pos

def trans2interval(t, start = 0, stop = None):
'''generate intervals for a transcript
start, stop are cDNA positions
Expand Down Expand Up @@ -302,4 +335,8 @@ def allTransRegions(trans):
for chr in regions: regions[t.chr].check()
return regions


def str2interval(s, blocksep = ',', rangesep = '-', id = ''):
itvs = [map(int, b.split(rangesep)) for b in s.split(blocksep)]
return Interval(itvs=itvs, id=id)


0 comments on commit acdbf59

Please sign in to comment.