NMRlipids databank API functions
The functions that help analyzing data in the NMRlipids databank are described here. These functions locate in databanklibrary.py. To get started using these functions, first create the folder where you want to work
mkdir NMRlipids/
cd NMRlipids
then clone the NMRlipids databank git into this folder
git clone https://github.com/NMRLipids/Databank.git
You can then start to work with the template or write a code from the scratch. The minimum python code to intialize NMRlipids databank is
import sys
databankPath = './Databank/' # this is the local path for the cloned Databank git
sys.path.insert(1, databankPath + '/Scripts/BuildDatabank/')
from databankLibrary import *
systems = initialize_databank(databankPath)
After running this, systems
is the list of dictionaries where each dictionary is a simulation in the NMRlipids databank. A simulation dictionary contains the content of the README.yaml for that simulation. The content of README.yaml files is described in User input and content of README.yaml files. systems
can be then used to loop over all simulations:
for system in systems:
print(system)
Examples on analyses over NMRlipids databank can be found from the template and codes used to analyze the results for the NMRlipids databank manuscript.
The functions available to analyze the simulations are listed in here:
- databankLibrary.initialize_databank(databankPath)[source]
Intializes the NMRlipids databank.
- Parameters:
databankPath – path for the local location of the NMRlipids databank, for example
../../Databank
- Returns:
list of dictionaries that contain the content of README.yaml files for each system.
- databankLibrary.print_README(system)[source]
Prints the content of
system
dictionary in human readable format.- Parameters:
system – NMRlipids databank dictionary defining a simulation.
- databankLibrary.CalcAreaPerMolecule(system)[source]
Calculates average area per lipid for a simulation defined with
system
. It is using theapl.json
file where area per lipid as a function of time calculated by thecalcAPL.py
is stored.- Parameters:
system – NMRlipids databank dictionary defining a simulation.
- Returns:
area per lipid (Å^2)
- databankLibrary.GetThickness(system)[source]
Gets thickness for a simulation defined with
system
from thethickness.json
file where thickness calculated by thecalc_thickness.py
is stored.- Parameters:
system – NMRlipids databank dictionary defining a simulation.
- Returns:
membrane thickess (nm)
- databankLibrary.ShowEquilibrationTimes(system)[source]
Prints relative equilibration time for each lipid within a simulation defined by
system
. Relative equilibration times are calculated withNMRPCA_timerelax.py
and stored ineq_times.json
files.- Parameters:
system – NMRlipids databank dictionary defining a simulation.
- databankLibrary.GetNlipids(system)[source]
Returns the total number of lipids in a simulation defined by
system
.- Parameters:
system – NMRlipids databank dictionary defining a simulation.
- Returns:
the total number of lipids in the
system
.
- databankLibrary.getLipids(system, molecules=dict_keys(['POPC', 'POPG', 'POPS', 'POPE', 'PYPC', 'PAzePCprot', 'PAzePCdeprot', 'DMPC', 'DPPC', 'DPPE', 'DPPG', 'DEPC', 'DRPC', 'DYPC', 'DLPC', 'DLIPC', 'DOG', 'DOPC', 'DOPE', 'DDOPC', 'DOPS', 'DSPC', 'DAPC', 'DMTAP', 'SDG', 'SDPE', 'SOPC', 'POPI', 'SAPI', 'SAPI24', 'SAPI25', 'SLPI', 'CER', 'CER180', 'CHOL', 'DCHOL', 'DHMDMAB', 'SLiPC', 'SM16', 'SM18', 'TOCL', 'TLCL_0H', 'GM1', 'DPPGK', 'GB3']))[source]
Returns a string using MDAnalysis notation that can used to select all lipids from the
system
.- Parameters:
system – NMRlipids databank dictionary defining a simulation.
- Returns:
a string using MDAnalysis notation that can used to select all lipids from the
system
.
- databankLibrary.plotSimulation(ID, lipid)[source]
Creates plots of form factor and C-H bond order parameters for the selected
lipid
from a simulation with the givenID
number.- Parameters:
ID – NMRlipids databank ID number of the simulation
lipid – universal molecul name of the lipid
- databankLibrary.simulation2universal_atomnames(system, molecule, atom)[source]
Get force field specific atom name corresponding to universal atom name from the
system
.- Parameters:
mapping_file – path for the mapping file
atom1 – universal atom name
- Returns:
force field specific atom name
- databankLibrary.read_mapping_file(mapping_file, atom1)[source]
Get force field specific atom name corresponding to universal atom name from the mapping file.
- Parameters:
mapping_file – path for the mapping file
atom1 – universal atom name
- Returns:
force field specific atom name
- databankLibrary.loadMappingFile(mapping_file)[source]
Load mapping file into a dictionary
- Param:
name of the mapping file
- Returns:
mapping dictionary
- databankLibrary.getAtoms(system, lipid)[source]
Return system specific atom names of a lipid
- Parameters:
system – system dictionary
lipid – universal lipid name
- Returns:
string of system specific atom names
- databankLibrary.getUniversalAtomName(system, atomName, lipid)[source]
Returns the universal atom name corresponding the simulation specific
atomName
of alipid
in a simulation defined by thesystem
.- Parameters:
system – system dictionary
atomName – simulation specific atomname
lipid – universal lipid name
- Returns:
universal atomname (string)
- databankLibrary.ShowTable(SortedQualities, quality)[source]
Shows a table of simulation qualities against experimental data.
- Parameters:
SortedQualities – list of dictionaries to be shown, available in folder
Data/Ranking/
quality – should be either
TotalQuality
or universal lipid name. First one shows the system total quality. Latter shows the individual lipid quality.
- databankLibrary.system2MDanalysisUniverse(system)[source]
Takes the
system
dictionary as an input, downloads the required files to the NMRlipids databank directory and retuns MDAnalysis universe corressponding thesystem
.- Parameters:
system – NMRlipids databank dictionary describing the simulation.
- Returns:
MDAnalysis universe
- databankLibrary.read_trj_PN_angles(molname, atom1, atom2, MDAuniverse)[source]
Calculates the P-N vector angles with respect to membrane normal from the simulation defined by the MDAnalysis universe.
- Parameters:
molname – residue name of the molecule for which the P-N vector angle will be calculated
atom1 – name of the P atom in the simulation
atom2 – name of the N atom in the simulation
MDAuniverse – MDAnalysis universe of the simulation to be analyzed
- Returns:
list where the first element are the angles of all molecules as a function of time, second element contains time averages for each molecule, third element contains the average angle over time and molecules, and fourth element is the error of the mean calculated over molecules.
- databankLibrary.calcArea(system)[source]
Returns area of the calculated based on the area per lipid stored in the databank.
- Parameters:
system – a system dictionary
- Returns:
area of the system (Å^2)
- databankLibrary.GetFormFactorMin(system)[source]
Return list of minima of form factor of
system
.- Parameters:
system – a system dictionary
- Returns:
list of form factor minima
- databankLibrary.averageOrderParameters(system)[source]
Returns average order paramaters of sn-1 and sn-2 acyl chains based on universal atom names. The names starting with M_G1C will be assigned to sn-1 and names starting M_G2C to sn-2.
- Parameters system:
a system dictionary
- Returns:
average of sn-1 and sn-2 order parameters