mattfenwick / NMRPlay

1 stars 1 forks source link

Pandas? #1

Open kyleabeauchamp opened 11 years ago

kyleabeauchamp commented 11 years ago

Hey, have you every considered using Pandas? It provides a lot of the database functionality that you're using. I think Pandas could be helpful for what you're trying to do--although I realize the learning curve is a bit steep.

mattfenwick commented 11 years ago

@kyleabeauchamp thanks for the suggestion, I will definitely be trying Pandas out today.

If you don't mind my asking, are you doing NMR or bioinformatics? I'm just curious how you came across this project.

Thanks again!

kyleabeauchamp commented 11 years ago

So I do MD simulation, but I deal with a lot of NMR data. I've used your PyStar reader.

On Tue, Aug 13, 2013 at 4:36 AM, Matt Fenwick notifications@github.comwrote:

@kyleabeauchamp https://github.com/kyleabeauchamp thanks for the suggestion, I will definitely be trying Pandas out today.

If you don't mind my asking, are you doing NMR or bioinformatics? I'm just curious how you came across this project.

Thanks again!

— Reply to this email directly or view it on GitHubhttps://github.com/mattfenwick/NMRPlay/issues/1#issuecomment-22558805 .

kyleabeauchamp commented 11 years ago

I've personally been using Pandas DataFrame objects to store Ensembles of chemical shifts--one dimension is the ensemble, the other dimension is the different atoms. I then use Pandas Series to store the measured values.

On Tue, Aug 13, 2013 at 9:07 AM, Kyle Beauchamp kyleabeauchamp@gmail.comwrote:

So I do MD simulation, but I deal with a lot of NMR data. I've used your PyStar reader.

On Tue, Aug 13, 2013 at 4:36 AM, Matt Fenwick notifications@github.comwrote:

@kyleabeauchamp https://github.com/kyleabeauchamp thanks for the suggestion, I will definitely be trying Pandas out today.

If you don't mind my asking, are you doing NMR or bioinformatics? I'm just curious how you came across this project.

Thanks again!

— Reply to this email directly or view it on GitHubhttps://github.com/mattfenwick/NMRPlay/issues/1#issuecomment-22558805 .

kyleabeauchamp commented 11 years ago

FYI: here's an example of something I've done with Trialanine--you can download FitEnsemble from my github:

from fitensemble import example_loader
predictions, measurements, uncertainties = example_loader.load_alanine_pandas()

In [8]: predictions.mean()
Out[8]: 
J3_HN_HA    6.592816
dtype: float64
kyleabeauchamp commented 11 years ago

We also have some (still in beta testing) ability to take a PDB or trajectory file and convert it into a pandas DataFrame. That is through our MDTraj library (https://github.com/rmcgibbo/mdtraj)

 >>> topology = md.load('example.pdb').topology
>>> print topology # doctest: +SKIP
<mdtraj.Topology with 1 chains, 3 residues, 22 atoms, 21 bonds at 0x105a98e90>
>>> table, bonds = topology.to_dataframe()
>>> print table.head()
serial name element resSeq resName chainID
0 0 H1 H 0 CYS 0
1 1 CH3 C 0 CYS 0
2 2 H2 H 0 CYS 0
3 3 H3 H 0 CYS 0
4 4 C C 0 CYS 0
>>> # rename residue "CYS" to "CYSS"
>>> table[table['residue'] == 'CYS']['residue'] = 'CYSS'
>>> print table.head()
serial name element resSeq resName chainID
0 0 H1 H 0 CYSS 0
1 1 CH3 C 0 CYSS 0
2 2 H2 H 0 CYSS 0
3 3 H3 H 0 CYSS 0
4 4 C C 0 CYSS 0