def test_prepare(self): """Prepares a single base""" mf = ModernaFragmentStrand(anchor=self.rna['4'], identifier='20') mf.superimpose() mf.prepare_anchor_residues() mf.renumber(self.rna) resis = list(mf.struc) self.assertEqual(resis[1].identifier, '20') self.assertEqual(str(resis[1].get_bp(self.rna['4'])), '20 +/+ 4')
def test_insert(self): mf = ModernaFragmentStrand(anchor=self.rna['4'], identifier='20', new_sequence=Sequence('C')) self.rna.insert_fragment(mf) self.assertEqual(self.rna.get_sequence(), Sequence('GCGGAUUUALCUCAG_C')) self.assertEqual(self.rna.get_secstruc(), '...(...........)')
def test_insert_many(self): SERIES = [ ('2', '24', 'G'), ('3', '23', 'C'), ('4', '22', 'C'), ('5', '21', 'U'), ('6', '20', 'A'), ] for num, ident, seq in SERIES: mf = ModernaFragmentStrand(anchor=self.rna[num], identifier=ident, new_sequence=Sequence(seq)) self.rna.insert_fragment(mf) self.rna.fix_backbone() self.assertEqual(self.rna.get_secstruc(), '.(((((.........)))))') self.assertEqual(self.rna.get_sequence(), Sequence('GCGGAUUUALCUCAG_AU_CCG'))
def add_pair_to_base(model, anchor_id, new_id=None, new_sequence=None): """*add_pair_to_base(model, anchor_id, new_id=None, new_sequence=None)* Adds Watson-Crick paired second strand to single nucleotide. :Arguments: * RNAModel object * Identifier of residue to which a new base pair will be added * New identifier for second strand * New sequence for second strand """ model = validate_model(model) anchor_id = validate_resnum(anchor_id) if new_id: new_id = validate_resnum(new_id) if new_sequence: new_sequence = validate_seq(new_sequence) fr = ModernaFragmentStrand(anchor=model[anchor_id], identifier=new_id, new_sequence=new_sequence) model.insert_fragment(fr)
def test_init(self): mf = ModernaFragmentStrand(anchor=self.rna['4'], identifier='20') #data_type='file', data=SINGLE_PAIR, chain_name='A', anchor=None, new_sequence=None, identifier=None, seq=None, strict=False, superposition_atoms=PAIR_SUPERPOSITION): self.assertEqual(mf.anchor.fixed_resi.identifier, '4')