Source code for hit
[docs]class HIT:
[docs] def __init__(self, seq_record, start, end, strand, score,
tffm_name, tffm_matched_state): # start and end are 1-based
self.seq_record = seq_record
self.start = start
self.end = end
self.strand = strand
self.score = score
self.tffm_matched_state = tffm_matched_state
self.tffm_name = tffm_name
[docs] def __len__(self):
return self.end - self.start + 1
[docs] def __str__(self):
string = "%s\t%d\t%d\t%s\t%s\t%s\t%d\t%s"%(self.seq_record.id,
self.start, self.end, self.strand, self.sequence(),
self.tffm_name, self.tffm_matched_state, repr(self.score))
return string
[docs] def __lt__(self, other):
if other:
return self.score < other.score
else:
return False
[docs] def __le__(self, other):
if other:
return self.score <= other.score
else:
return False
[docs] def __eq__(self, other):
if other:
return self.score == other.score
else:
return False
[docs] def __ne__(self, other):
if other:
return self.score != other.score
else:
return True
[docs] def __gt__(self, other):
if other:
return self.score > other.score
else:
return True
[docs] def __ge__(self, other):
if other:
return self.score >= other.score
else:
return True
[docs] def sequence(self):
seq = self.seq_record.seq[self.start-1:self.end]
if self.strand == "+":
return seq
else:
return seq.reverse_complement()