Skip to content

Commit

Permalink
Merge pull request #653 from MDAnalysis/issue-461-nucleicselections
Browse files Browse the repository at this point in the history
Added extra resnames to 'nucleic' selection

closes #461
  • Loading branch information
kain88-de committed Jan 25, 2016
2 parents f13d8c8 + 8bb8d38 commit 5330a7c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 2 deletions.
2 changes: 2 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Fixes
(Issue #639)
* The 'atom' selection keyword returns an empty selection rather than an
error when no atoms are are found. (Issue #644)
* nucleic selection will now detect nucleic residue names suffixed with 3 or 5
(Issue #461)


01/16/16 tyler.je.reddy, kain88-de, richardjgowers, manuel.nuno.melo,
Expand Down
6 changes: 5 additions & 1 deletion package/MDAnalysis/core/Selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,11 @@ class NucleicSelection(Selection):

nucl_res = np.array([
'ADE', 'URA', 'CYT', 'GUA', 'THY', 'DA', 'DC', 'DG', 'DT', 'RA',
'RU', 'RG', 'RC', 'A', 'T', 'U', 'C', 'G'
'RU', 'RG', 'RC', 'A', 'T', 'U', 'C', 'G',
'DA5', 'DC5', 'DG5', 'DT5',
'DA3', 'DC3', 'DG3', 'DT3',
'RA5', 'RU5', 'RG5', 'RC5',
'RA3', 'RU3', 'RG3', 'RC3'
])

def __init__(self, parser, tokens):
Expand Down
42 changes: 42 additions & 0 deletions testsuite/MDAnalysisTests/data/nucl_res.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
MODEL
CRYST1 80.000 80.000 80.000 60.00 60.00 90.00
ATOM 1 CA ADE 1 00.000 00.000 00.000 1.00 84.71
ATOM 2 CA URA 2 01.000 01.000 01.000 1.00 68.59
ATOM 3 CA CYT 3 02.000 02.000 02.000 1.00 48.30
ATOM 4 CA GUA 4 03.000 03.000 03.000 1.00 49.38
ATOM 5 CA THY 5 04.000 04.000 04.000 1.00 42.10
ATOM 6 CA DA 6 04.000 04.000 04.000 1.00 42.10
ATOM 7 CA DC 7 04.000 04.000 04.000 1.00 42.10
ATOM 8 CA DG 8 04.000 04.000 04.000 1.00 42.10
ATOM 9 CA DT 9 04.000 04.000 04.000 1.00 42.10
ATOM 10 CA RA 10 04.000 04.000 04.000 1.00 42.10
ATOM 11 CA RU 11 04.000 04.000 04.000 1.00 42.10
ATOM 12 CA RG 12 04.000 04.000 04.000 1.00 42.10
ATOM 13 CA RC 13 04.000 04.000 04.000 1.00 42.10
ATOM 14 CA A 14 04.000 04.000 04.000 1.00 42.10
ATOM 15 CA T 15 04.000 04.000 04.000 1.00 42.10
ATOM 16 CA U 16 04.000 04.000 04.000 1.00 42.10
ATOM 17 CA C 17 04.000 04.000 04.000 1.00 42.10
ATOM 18 CA G 18 04.000 04.000 04.000 1.00 42.10
ATOM 19 CA DA5 19 04.000 04.000 04.000 1.00 42.10
ATOM 20 CA DC5 20 04.000 04.000 04.000 1.00 42.10
ATOM 21 CA DG5 21 04.000 04.000 04.000 1.00 42.10
ATOM 22 CA DT5 22 04.000 04.000 04.000 1.00 42.10
ATOM 23 CA DA3 23 04.000 04.000 04.000 1.00 42.10
ATOM 24 CA DC3 24 04.000 04.000 04.000 1.00 42.10
ATOM 25 CA DG3 25 04.000 04.000 04.000 1.00 42.10
ATOM 26 CA DT3 26 04.000 04.000 04.000 1.00 42.10
ATOM 27 CA RA5 27 04.000 04.000 04.000 1.00 42.10
ATOM 28 CA RU5 28 04.000 04.000 04.000 1.00 42.10
ATOM 29 CA RG5 29 04.000 04.000 04.000 1.00 42.10
ATOM 30 CA RC5 30 04.000 04.000 04.000 1.00 42.10
ATOM 31 CA RA3 31 04.000 04.000 04.000 1.00 42.10
ATOM 32 CA RU3 32 04.000 04.000 04.000 1.00 42.10
ATOM 33 CA RG3 33 04.000 04.000 04.000 1.00 42.10
ATOM 34 CA RC3 34 04.000 04.000 04.000 1.00 42.10
ATOM 35 CA TAF 35 04.000 04.000 04.000 1.00 42.10
ATOM 36 CA ERU 36 04.000 04.000 04.000 1.00 42.10
ATOM 37 CA SEN 37 04.000 04.000 04.000 1.00 42.10
ATOM 38 CA T__ 38 04.000 04.000 04.000 1.00 42.10
ATOM 39 CA S__ 39 04.000 04.000 04.000 1.00 42.10
END
4 changes: 4 additions & 0 deletions testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"COORDINATES_XTC",
"COORDINATES_TRR",
"COORDINATES_TOPOLOGY",
"NUCLsel",
]

from pkg_resources import resource_filename
Expand Down Expand Up @@ -294,3 +295,6 @@

Plength = resource_filename(__name__, 'data/plength.gro')
Martini_membrane_gro = resource_filename(__name__, 'data/martini_dppc_chol_bilayer.gro')

# Contains one of each residue in 'nucleic' selections
NUCLsel = resource_filename(__name__, 'data/nucl_res.pdb')
9 changes: 8 additions & 1 deletion testsuite/MDAnalysisTests/test_atomselections.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
PSF, DCD,
PRMpbc, TRJpbc_bz2,
PSF_NAMD, PDB_NAMD,
GRO, NUCL, TPR, XTC,
GRO, NUCL, NUCLsel, TPR, XTC,
TRZ_psf, TRZ,
PDB_full,
)
Expand Down Expand Up @@ -464,6 +464,13 @@ def test_nucleic(self):
assert_equal(rna.n_atoms, 739)
assert_equal(rna.n_residues, 23)

def test_nucleic_all(self):
u = mda.Universe(NUCLsel)

sel = u.select_atoms('nucleic')

assert_(len(sel) == 34)

def test_nucleicbackbone(self):
rna = self.universe.select_atoms("nucleicbackbone")
assert_equal(rna.n_residues, 23)
Expand Down

0 comments on commit 5330a7c

Please sign in to comment.