1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
Description: Fix Python3.12 string syntax
Bug-Debian: https://bugs.debian.org/1085608
Author: Andreas Tille <tille@debian.org>
Last-Update: 2024-06-07
--- a/ghmmwrapper/ghmm.py
+++ b/ghmmwrapper/ghmm.py
@@ -287,7 +287,7 @@ class EmissionDomain(object):
def isAdmissable(self, emission):
- """ Check whether \p emission is admissable (contained in) the domain
+ """ Check whether p emission is admissable (contained in) the domain
raises GHMMOutOfDomain else
"""
return None
@@ -1507,7 +1507,7 @@ class HMMOpenFactory(HMMFactory):
f = open(fileName,"r")
res = re.compile("^//")
- stat = re.compile("^ACC\s+(\w+)")
+ stat = re.compile(r"^ACC\s+(\w+)")
for line in f.readlines():
string = string + line
m = stat.match(line)
@@ -1533,11 +1533,11 @@ class HMMOpenFactory(HMMFactory):
#
file = open(fileName,'r')
- hmmRe = re.compile("^HMM\s*=")
- shmmRe = re.compile("^SHMM\s*=")
- mvalueRe = re.compile("M\s*=\s*([0-9]+)")
- densityvalueRe = re.compile("density\s*=\s*([0-9]+)")
- cosvalueRe = re.compile("cos\s*=\s*([0-9]+)")
+ hmmRe = re.compile(r"^HMM\s*=")
+ shmmRe = re.compile(r"^SHMM\s*=")
+ mvalueRe = re.compile(r"M\s*=\s*([0-9]+)")
+ densityvalueRe = re.compile(r"density\s*=\s*([0-9]+)")
+ cosvalueRe = re.compile(r"cos\s*=\s*([0-9]+)")
emission_domain = None
while 1:
@@ -2099,7 +2099,7 @@ class HMM(object):
@param emissionSequences can either be a SequenceSet or a EmissionSequence
@returns log( P[emissionSequences| model]) of type float which is
- computed as \f$\sum_{s} log( P[s| model])\f$ when emissionSequences
+ computed as $sum_{s} log( P[s| model])$ when emissionSequences
is a SequenceSet
@note The implementation does not compute the full forward matrix since
@@ -2375,7 +2375,7 @@ class HMM(object):
@param eseqs can either be a SequenceSet or an EmissionSequence
- @returns [q_0, ..., q_T] the viterbi-path of \p eseqs is an
+ @returns [q_0, ..., q_T] the viterbi-path of p eseqs is an
EmmissionSequence object,
[[q_0^0, ..., q_T^0], ..., [q_0^k, ..., q_T^k]} for a k-sequence
SequenceSet
@@ -2470,14 +2470,14 @@ class HMM(object):
return self.name2id[stateLabel]
def getInitial(self, i):
- """ Accessor function for the initial probability \f$\pi_i\f$ """
+ """ Accessor function for the initial probability $pi_i$ """
state = self.cmodel.getState(i)
return state.pi
def setInitial(self, i, prob, fixProb=False):
- """ Accessor function for the initial probability \f$\pi_i\f$.
+ """ Accessor function for the initial probability $pi_i$.
- If 'fixProb' = True \f$\pi\f$ will be rescaled to 1 with 'pi[i]'
+ If 'fixProb' = True $pi$ will be rescaled to 1 with 'pi[i]'
fixed to the arguement value of 'prob'.
"""
@@ -3321,7 +3321,7 @@ class StateLabelHMM(DiscreteEmissionHMM)
def labeledlogikelihoods(self, emissionSequences):
""" Compute a vector ( log( P[s,l| model]) )_{s} of log-likelihoods of the
- individual \p emissionSequences using the forward algorithm
+ individual p emissionSequences using the forward algorithm
@param emissionSequences SequenceSet
--- a/ghmmwrapper/modhmmer.py
+++ b/ghmmwrapper/modhmmer.py
@@ -189,10 +189,10 @@ class hmmer:
self.acc = self.acc[:-1]
#get number of match states
- n = int(gotoLine(f,re.compile("^LENG\s*(\d+)")).group(1))
+ n = int(gotoLine(f,re.compile(r"^LENG\s*(\d+)")).group(1))
self.n = n
#get type of profile hmm: amino/nucleotide
- m = self.dicType[gotoLine(f,re.compile("^ALPH\s*(\S+)")).group(1)];
+ m = self.dicType[gotoLine(f,re.compile(r"^ALPH\s*(\S+)")).group(1)];
self.m = m
#build matrix for transition: N B E J C T M1 I1 D1 M2 I2 D2 ... Mn In Dn
@@ -202,13 +202,13 @@ class hmmer:
self.maems = [build_matrix(n,m),build_matrix(n,m),build_matrix(1,m)]
#get line "XT" transitions
- trans = string.split(gotoLine(f,re.compile("^XT([\s\d\S]*)")).group(1))
+ trans = string.split(gotoLine(f,re.compile(r"^XT([\s\d\S]*)")).group(1))
self.set_matrix("XT",trans)
#null model
- trans = string.split(gotoLine(f,re.compile("^NULT([\s\d\S]*)")).group(1))
+ trans = string.split(gotoLine(f,re.compile(r"^NULT([\s\d\S]*)")).group(1))
self.manull = [self.H2P(trans[0],1.0),self.H2P(trans[1],1.0)] #[G->G,G->F]
- trans = string.split(gotoLine(f,re.compile("^NULE([\s\d\S]*)")).group(1))
+ trans = string.split(gotoLine(f,re.compile(r"^NULE([\s\d\S]*)")).group(1))
for k in range(len(trans)):
self.maems[2][0][k] = self.H2P(trans[k],1/float(m))
|