diff --git a/package/CHANGELOG b/package/CHANGELOG index 5a878ff4871..88526c798f3 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -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, diff --git a/package/MDAnalysis/core/Selection.py b/package/MDAnalysis/core/Selection.py index 823313ea04c..fe74df3f229 100644 --- a/package/MDAnalysis/core/Selection.py +++ b/package/MDAnalysis/core/Selection.py @@ -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): diff --git a/testsuite/MDAnalysisTests/data/nucl_res.pdb b/testsuite/MDAnalysisTests/data/nucl_res.pdb new file mode 100644 index 00000000000..3594c788a92 --- /dev/null +++ b/testsuite/MDAnalysisTests/data/nucl_res.pdb @@ -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 diff --git a/testsuite/MDAnalysisTests/datafiles.py b/testsuite/MDAnalysisTests/datafiles.py index acd5a8fc9dc..63be4804615 100644 --- a/testsuite/MDAnalysisTests/datafiles.py +++ b/testsuite/MDAnalysisTests/datafiles.py @@ -105,6 +105,7 @@ "COORDINATES_XTC", "COORDINATES_TRR", "COORDINATES_TOPOLOGY", + "NUCLsel", ] from pkg_resources import resource_filename @@ -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') diff --git a/testsuite/MDAnalysisTests/test_atomselections.py b/testsuite/MDAnalysisTests/test_atomselections.py index 7fdf629b349..b657592e7c9 100644 --- a/testsuite/MDAnalysisTests/test_atomselections.py +++ b/testsuite/MDAnalysisTests/test_atomselections.py @@ -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, ) @@ -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)