<jupyter_start><jupyter_text>Elements selection<jupyter_code>import molsysmt as msm
molecular_system = msm.convert('1tcd.mmtf', to_form='molsysmt.MolSys')
molecular_system.composition.dataframe
print(molecular_system.composition.dataframe.columns)
# Atoms with name C
msm.select(molecular_system, 'atom.name == "C"')
# Atoms with name CA or CB
msm.select(molecular_system, 'atom.name in ["CA","CB"]')
# Atoms of type C or N
msm.select(molecular_system, 'atom.type==["C","N"]')
msm.select(molecular_system, 'atom.type == "C" | atom.type == "N"')
# Heavy atoms
msm.select(molecular_system, 'not atom.type=="H"')
# Atoms of type C not named CA
msm.select(molecular_system, 'atom.type=="C" and not atom.name=="CA"')
# Atoms not named CA, CB or C
msm.select(molecular_system, 'atom.name!=["CA","CB","C"]')
# Atoms with id number lower than 10
msm.select(molecular_system, 'atom.id<10')
# Atoms with id number lower than 10 and higher or equal than 3
msm.select(molecular_system, 'atom.id<10 and atom.id>=3')<jupyter_output><empty_output><jupyter_text>_________________________<jupyter_code># Atoms belonging to molecules of type water.
msm.select(molecular_system, 'molecule.type=="water"')
# Heavy atoms belonging to molecules of type protein.
msm.select(molecular_system, 'molecule.type=="protein" and atom.type!="H"')
# Atoms belonging to residues named GLY, ALA or VAL in chain named A.
msm.select(molecular_system, 'group.name==["GLY","ALA","VAL"] and chain.name=="A"')
# Atoms in groups with indices 10, 11 or 12.
indices=[10,11,12]
msm.select(molecular_system, 'group.index==@indices')
# Atoms named CA, C, O or N in groups with indices 10 to 29.
indices=list(range(10,30))
atoms=["CA", "C", "O", "N"]
msm.select(molecular_system, 'atom.name==@atoms & atom.index==@indices')<jupyter_output><empty_output><jupyter_text>_________________________<jupyter_code># Atoms named C with atom index in range 10 to 29
indices=list(range(10,30))
msm.select(molecular_system, 'atom.name=="C"', mask=indices)
# Atoms named C with atom index in range 10 to 29
indices=list(range(10,30))
msm.select(molecular_system, 'atom.name=="C" and atom.index in @indices')<jupyter_output><empty_output><jupyter_text>__________________<jupyter_code># Groups with indices equal to 0, 100 or 200
indices=[0,100,200]
msm.select(molecular_system, 'group.index==@indices', target='group')
# Groups with name "ALA"
msm.select(molecular_system, 'group.name=="ALA"', target='group')
# Groups of atoms index 34, 44 or 64
msm.select(molecular_system, 'atom.index==[34,44,64]', target='group')
# Groups belonging to chain named A and molecule of type anything but water
msm.select(molecular_system, 'chain.name=="A" and molecule.type!="water"', target='group')
# Groups of molecules of type water
msm.select(molecular_system, 'molecule.type=="water"', target='group')
# Molecules of type water
msm.select(molecular_system, 'molecule.type=="water"', target='molecule')
# Chains with molecules of type water
msm.select(molecular_system, 'molecule.type=="water"', target='chain')<jupyter_output><empty_output><jupyter_text>___________________<jupyter_code># Atoms with index from 0 to 4 and from 0 to 2
msm.select(molecular_system, 'atom.index in [0,1,2,3,4]', mask=[0,1,2], target='atom')
# Groups with index from 0 to 4 and from 0 to 2
msm.select(molecular_system, 'group.index in [0,1,2,3,4]', mask=[0,1,2], target='group')
# Molecules with index from 0 to 4 and from 0 to 2
msm.select(molecular_system, 'molecule.index in [0,1,2,3,4]', mask=[0,1,2], target='molecule')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15356541268950027, 'fraction_numerical': 0.03060078607523863, 'mean_word_length': 7.383529411764706, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '475859', 'license': 'MIT', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1237, 'n_words': 325, 'path': 'sandbox/Test_MolSysMT_Select.ipynb', 'repo_name': 'dprada/molsysmt', 'size': '3562'}