Commit d7e6ab7f authored by Pauline Pommeret's avatar Pauline Pommeret
Browse files

[trx] Removing sliding_pb since it's done in fft

parent 976be1e3
......@@ -26,7 +26,7 @@ class NoMatch(XylokError):
class ShiftOutOfRange(XylokError):
"""
Exception raised when shift is too long for the used query sequence in
:py:meth:`lib.fft_tools.sliding_pb`
:py:meth:`lib.fft_tools.sliding_fft`
Parameters:
- ``msg`` : error message (str)
......
......@@ -6,7 +6,6 @@ Docstring
import os
import re
import numpy
from lib.XylokExceptions import NoMatch
from lib.XylokExceptions import ShiftOutOfRange
......@@ -121,25 +120,3 @@ def match(sequence, trx, center=None):
else:
sequence_trx[position] = pair_score(sequence[position-1:position+3], trx)
return sequence_trx
def sliding_pb(sequence_trx, shift=72):
"""
Uses ``sequence_trx`` (dictionary where keys are position in sequence and
values are TRX values associated with the nucleotides) and computes the
mean value on ``shift`` (int) sliding bp.
Default ``shift=72``.
Returns a dictionary.
"""
# Test if sequence_trx and shift have compatible length
if len(sequence_trx) > shift:
sliding_trx = {}
for position in xrange(0, len(sequence_trx)-shift):
sliding_trx[position] = numpy.round(numpy.mean([sequence_trx[i] for i in xrange(position, position+shift)]), decimals=2)
return sliding_trx
else:
raise ShiftOutOfRange("Choosen shift is too long for query sequence.")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment