comparison resfinder/cge/phenotype2genotype/dbhit.py @ 0:a16d245332d6 draft default tip

Uploaded
author dcouvin
date Wed, 08 Dec 2021 01:46:07 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a16d245332d6
1 #!/usr/bin/env python3
2
3
4 class DBHit(object):
5 """ A DBHit describes an alignment of a feature to a reference/template.
6 The db variable should be used to describe which database the alignment
7 in question was done against. For example 'resfinder'
8
9 The match_category variable stores one of the integers:
10 1: Match < 100% identity AND match_length < ref_length
11 2: Match < 100% identity AND match_length == ref_length
12 3: Match == 100% identity AND match_length == ref_length
13 """
14 def __init__(self, name, identity, match_length, ref_length, start_ref,
15 end_ref, acc, depth=None, db=None):
16 self.name = name
17 self.identity = float(identity)
18 if(match_length == "NA"):
19 self.match_length = None
20 else:
21 self.match_length = int(match_length)
22 self.ref_length = int(ref_length)
23 self.start_ref = int(start_ref)
24 self.end_ref = int(end_ref)
25 self.acc = acc
26 self.depth = depth
27 self.db = db
28
29 if(self.match_length is not None
30 and self.ref_length != self.match_length):
31 self.match_category = 1
32 elif(self.identity < 100.0):
33 self.match_category = 2
34 else:
35 self.match_category = 3