def sameCoordinates(self, pairwiseAlignment): return self.contig1 == pairwiseAlignment.contig1 and \ self.start1 == pairwiseAlignment.start1 and \ self.end1 == pairwiseAlignment.end1 and \ self.strand1 == pairwiseAlignment.strand1 and \ self.contig2 == pairwiseAlignment.contig2 and \ self.start2 == pairwiseAlignment.start2 and \ self.end2 == pairwiseAlignment.end2 and \ self.strand2 == pairwiseAlignment.strand2 and \ close(self.score, pairwiseAlignment.score, 0.001)
def __eq__(self, pairwiseAlignment): if pairwiseAlignment is None: return False return self.contig1 == pairwiseAlignment.contig1 and \ self.start1 == pairwiseAlignment.start1 and \ self.end1 == pairwiseAlignment.end1 and \ self.strand1 == pairwiseAlignment.strand1 and \ self.contig2 == pairwiseAlignment.contig2 and \ self.start2 == pairwiseAlignment.start2 and \ self.end2 == pairwiseAlignment.end2 and \ self.strand2 == pairwiseAlignment.strand2 and \ close(self.score, pairwiseAlignment.score, 0.001) and \ self.operationList == pairwiseAlignment.operationList
def testRemodelTreeRemovingRoot(self): for test in xrange(0, self.testNo): binaryTree = getRandomTree() binaryTree_depthFirstNumbers(binaryTree) node = getRandomLeafNode(binaryTree) remodTree = remodelTreeRemovingRoot(binaryTree, node.traversalID.mid) print "test", test, printBinaryTree(binaryTree, True), printBinaryTree(node, True), printBinaryTree(remodTree, True) binaryTree_depthFirstNumbers(remodTree) distances = mapTraversalIDsBetweenTrees(binaryTree, remodTree) d = getDistancesBetweenLeaves(binaryTree) d2 = getDistancesBetweenLeaves(remodTree) print d print d2 for key in d2: assert close(d2[key], d[key], 0.0001)
def testRemodelTreeRemovingRoot(self): for test in xrange(0, self.testNo): binaryTree = getRandomTree() binaryTree_depthFirstNumbers(binaryTree) node = getRandomLeafNode(binaryTree) remodTree = remodelTreeRemovingRoot(binaryTree, node.traversalID.mid) print "test", test, printBinaryTree( binaryTree, True), printBinaryTree(node, True), printBinaryTree(remodTree, True) binaryTree_depthFirstNumbers(remodTree) distances = mapTraversalIDsBetweenTrees(binaryTree, remodTree) d = getDistancesBetweenLeaves(binaryTree) d2 = getDistancesBetweenLeaves(remodTree) print d print d2 for key in d2: assert close(d2[key], d[key], 0.0001)
def __eq__(self, op): if op is None: return False return self.type == op.type and self.length == op.length and close(self.score, op.score, 0.0001)