File: seqalign.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (43 lines) | stat: -rw-r--r-- 1,402 bytes parent folder | download
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
import os
import sys
from pymol import cmd, testing, stored

@testing.requires_version('2.3')
class TestSeqalign(testing.PyMOLTestCase):

    def testLoadAlnMatchingIds(self):
        cmd.fab('ACDEFGHIKLMNPQRS', 'seq1')
        cmd.fab('ACDIKLMNP', 'seq2')
        cmd.fab('GHIKPQRS', 'seq3')
        cmd.load(self.datafile('alignment.aln'), 'aln')
        self.assertEqual(cmd.count_atoms('guide & aln & seq1'), 11)
        self.assertEqual(cmd.count_atoms('guide & aln & seq2'), 7)
        self.assertEqual(cmd.count_atoms('guide & aln & seq3'), 6)

    def testLoadAlnMappingStr(self):
        cmd.fab('ACDEFGHIKLMNPQRS', 'm1')
        cmd.fab('ACDIKLMNP', 'm2')

        from pymol.seqalign import load_aln_multi

        load_aln_multi(self.datafile('alignment.aln'), 'aln', mapping=
            'seq1 m1 '
            'seq2 m2 '
        )

        self.assertEqual(cmd.count_atoms('guide & aln & m1'), 7)
        self.assertEqual(cmd.count_atoms('guide & aln & m2'), 7)

    def testLoadAlnMappingDict(self):
        cmd.fab('ACDIKLMNP', 'm2')
        cmd.fab('GHIKPQRS', 'm3')

        from pymol.seqalign import load_aln_multi

        load_aln_multi(self.datafile('alignment.aln'), 'aln', mapping={
            'seq2': 'm2',
            'seq3': 'm3',
        })

        self.assertEqual(cmd.count_atoms('guide & aln & m2'), 2)
        self.assertEqual(cmd.count_atoms('guide & aln & m3'), 2)