Author: bugman Date: Fri Jul 1 22:22:25 2011 New Revision: 13406 URL: http://svn.gna.org/viewcvs/relax?rev=13406&view=rev Log: Created 3 new fns, get_molecule_ids(), get_residue_ids(), and get_spin_ids(). These return lists of molecule, residue, and spin ID strings. Modified: branches/gui_testing/generic_fns/mol_res_spin.py Modified: branches/gui_testing/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/mol_res_spin.py?rev=13406&r1=13405&r2=13406&view=diff ============================================================================== --- branches/gui_testing/generic_fns/mol_res_spin.py (original) +++ branches/gui_testing/generic_fns/mol_res_spin.py Fri Jul 1 22:22:25 2011 @@ -1451,6 +1451,24 @@ return id +def get_molecule_ids(selection=None): + """Return a list of the molecule ID strings. + + @param selection: The molecule selection identifier. + @type selection: str + @return: The molecule ID strings. + @rtype: list of str + """ + + # Loop over the molecules, append the ID of each within the selection. + mol_ids = [] + for mol, mol_id in molecule_loop(selection, return_id=True): + mol_ids.append(mol_id) + + # Return the IDs. + return mol_ids + + def get_molecule_names(selection=None): """Return a list of the molecule names. @@ -1469,6 +1487,24 @@ return mol_names +def get_residue_ids(selection=None): + """Return a list of the residue ID strings. + + @param selection: The molecule and residue selection identifier. + @type selection: str + @return: The residue ID strings. + @rtype: list of str + """ + + # Loop over the residues, appending the ID of each within the selection. + res_ids = [] + for res, res_id in residue_loop(selection, return_id=True): + res_ids.append(res_id) + + # Return the IDs. + return res_ids + + def get_residue_names(selection=None): """Return a list of the residue names. @@ -1503,6 +1539,24 @@ # Return the numbers. return res_nums + + +def get_spin_ids(selection=None): + """Return a list of the spin ID strings. + + @param selection: The molecule and spin selection identifier. + @type selection: str + @return: The spin ID strings. + @rtype: list of str + """ + + # Loop over the spins, appending the ID of each within the selection. + spin_ids = [] + for spin, spin_id in spin_loop(selection, return_id=True): + spin_ids.append(spin_id) + + # Return the IDs. + return spin_ids def last_residue_num(selection=None):