def test_insertion_followed_by_deletion(state): state.change(Change(None, F('foo'))) assert state.changes == (Change(None, F('foo')), ) state.change(Change(F('foo'), None)) assert state.changes == ()
def test_integrate_plasmid_with_fusion(state): state.change( F('site') > Plasmid('pA', [F.parse('gene.A')**F.parse('gene.B')])) assert state.changes == (F('site') > Plasmid( 'pA', [F.parse('gene.A')**F.parse('gene.B')]), ) state.change(F.parse('gene.A')**F.parse('gene.B') > F.parse('gene.C')) assert state.changes == (F('site') > CompositeAnnotation( F.parse('gene.C')), )
def test_change_at_locus_when_before_is_at_locus(state): state.change(Change(F('a') % F('a'), F('b'))) assert state.changes == (Change(F('a'), F('b')), ) state.change(Change(F('c') % F('c'), None)) assert state.changes == ( Change(F('a'), F('b')), Change(F('c'), None), )
def test_standalone_change_at_replaced_locus(state): state.change(Change(F('a'), F('b'))) assert state.changes == (Change(F('a'), F('b')), ) state.change(Change(AtLocus(F('b'), F('a')), F('c'))) assert state.changes == (Change(F('a'), F('c')), )
def test_change_at_locus_that_cancels_out(state): state.change(Change(F('a') % F('locus'), F('b'))) assert state.changes == (Change(F('a') % F('locus'), F('b')), ) state.change(Change( F('b') % F('locus'), F('a'), )) assert state.changes == ()
def test_match_whole_fusion_on_delete(state): state.change(+F.parse('gene.A')**F.parse('gene.B')) state.change(+F.parse('gene.C')) state.change(-F('gene.A')) assert state.changes == ( +F.parse('gene.A')**F.parse('gene.B'), +F.parse('gene.C'), -F('gene.A'), ) state.change(-F.parse('gene.C')) assert state.changes == ( +F.parse('gene.A')**F.parse('gene.B'), -F('gene.A'), ) state.change(-F.parse('gene.A')**F.parse('gene.B')) assert state.changes == (-F('gene.A'), )
def test_replacement_of_variants(state): state.change(Change(F.parse('a(x)'), F('b'))) assert state.changes == (Change(F.parse('a(x)'), F('b')), ) state.change(Change(F.parse('a(y)'), F('b'))) assert state.changes == ( Change(F.parse('a(x)'), F('b')), Change(F.parse('a(y)'), F('b')), ) state.change(Change(F.parse('a(y)'), F('c'))) assert state.changes == ( Change(F.parse('a(x)'), F('b')), Change(F.parse('a(y)'), F('c')), )
def test_replace_fusion_in_fusion(): assert change_annotation(F('a') ** F('b') ** F('c') ** F('d'), F('b') ** F('c'), F('x')) == F('a') ** F('x') ** F('d') assert change_annotation(F('a') ** F('b') ** F('c'), F('a') ** F('b'), F('x') ** F('y')) == F('x') ** F('y') ** F('c')
def test_fusion_contains(): assert Fusion(F('a'), F('b'), F('c'), F('d')).contains( Fusion(F('b'), F('c'))) is True assert Fusion(F('a'), F('b'), F('c'), F('d')).contains( Fusion(F('a'), F('c'))) is False assert Fusion(F('a'), F('b'), F('c'), F('d')).contains(F('a')) is True assert Fusion(F('a'), F('b'), F('c'), F('d')).contains(F('x')) is False
def test_replacement_replace_variant(state): state.change(Change(F('a'), F.parse('a(x)'))) assert state.changes == (Change(F('a'), F.parse('a(x)')), ) state.change(Change(F('a'), F.parse('a(y)'))) assert state.changes == (Change(F('a'), F.parse('a(y)')), )
def test_replacement_in_fusion_at_locus(state): state.change(Change(F('x'), F('a')**F('b'))) state.change(Change(F('y'), F('a')**F('b'))) assert state.changes == ( Change(F('x'), F('a')**F('b')), Change(F('y'), F('a')**F('b')), ) state.change(Change(F('b') % F('y'), F('b')**F('c'))) assert state.changes == ( Change(F('x'), F('a')**F('b')), Change(F('y'), F('a')**F('b')**F('c')), )
def test_repeat_deletion(state): state.change(Change(F('foo'), None)) state.change(Change(F('foo'), None)) assert state.changes == (Change(F('foo'), None), )
def test_repeat_insertion(state): state.change(Change(None, F('foo'))) state.change(Change(None, F('foo'))) assert state.changes == (Change(None, F('foo')), )
def test_replacement_at_locus_of_locus(state): # XXX consider not simplifying (foo@foo>... and -foo@foo) if there is a logical use state.change(Change(F('a') % F('a'), F('b'))) assert state.changes == (Change(F('a'), F('b')), )
def test_replace_feature_in_composite_annotation(): assert change_annotation(CompositeAnnotation(F('a'), F('b')), F('a'), None) == CompositeAnnotation(F('b')) assert change_annotation(CompositeAnnotation(F('b')), F('a'), None) == CompositeAnnotation(F('b')) assert change_annotation(CompositeAnnotation(F('a') ** F('b'), F('c')), F('a') ** F('b'), F('d')) == CompositeAnnotation(F('d'), F('c')) assert change_annotation(CompositeAnnotation(F('a') ** F('b'), F('c')), F('a') ** F('b'), F('c')) == CompositeAnnotation(F('c'))
def test_repeat_replacement(state): state.change(Change(F('a'), F('b'))) state.change(Change(F('a'), F('b'))) assert state.changes == (Change(F('a'), F('b')), )
def test_insert_feature_in_fusion(): assert change_annotation(F('a') ** F('b'), None, F('x')) == CompositeAnnotation(F('a') ** F('b'), F('x'))
def test_replacement_at_unknown_locus(state): state.change(Change(F('a') % F('locus'), F('b'))) assert state.changes == (Change(F('a') % F('locus'), F('b')), )