1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
"""
Testing PyQt Fab & Builder
"""
from pymol import cmd, testing
@testing.requires_version('2.3')
class TestNucBuilder(testing.PyMOLTestCase):
def testCanInit(self):
self.assertEqual(cmd.fnab("A"), None)
def testSingleDNAFASTA(self):
dna = "ATGC"
cmd.fnab(input=dna, mode="DNA", form="B", dbl_helix=-1)
fasta_str = cmd.get_fastastr().splitlines()
self.assertEqual(dna, fasta_str[1])
def testSingleRNAFASTA(self):
rna = "AUGC"
cmd.fnab(input=rna, mode="RNA")
fasta_str = cmd.get_fastastr().splitlines()
self.assertEqual(rna, fasta_str[1])
def testDoubleDNAFASTA(self):
dna = "ATCCCCG"
revcomp = "CGGGGAT"
cmd.fnab(input=dna, dbl_helix=1)
fasta_str = cmd.get_fastastr().splitlines()
fasta_raw = (fasta_str[1], fasta_str[3])
sense_strand = fasta_raw[0]
antisense_strand = fasta_raw[1]
self.assertEqual(dna, sense_strand)
self.assertEqual(revcomp, antisense_strand)
cmd.delete('all')
cmd.fnab(input=dna)
fasta_str = cmd.get_fastastr().splitlines()
fasta_raw = (fasta_str[1], fasta_str[3])
sense_strand = fasta_raw[0]
antisense_strand = fasta_raw[1]
self.assertEqual(dna, sense_strand)
self.assertEqual(revcomp, antisense_strand)
def testDoubleRNAFASTA(self):
rna = "AUUUUUUUCG"
cmd.fnab(input=rna, mode="RNA", form="B", dbl_helix=1)
fasta_str = cmd.get_fastastr().splitlines()
self.assertEqual(len(fasta_str), 2)
sense_strand = fasta_str[1]
self.assertEqual(rna, sense_strand)
def testMixedCase(self):
dna = "AtG"
revcomp = "CAT"
cmd.fnab(input=dna)
fasta_str = cmd.get_fastastr().splitlines()
fasta_raw = (fasta_str[1], fasta_str[3])
sense_strand = fasta_raw[0]
antisense_strand = fasta_raw[1]
self.assertEqual(dna.upper(), sense_strand)
self.assertEqual(revcomp, antisense_strand)
|