contact_map icon indicating copy to clipboard operation
contact_map copied to clipboard

ContactFrequency to pandas dataframe

Open PeptideSimulator01 opened this issue 4 years ago • 7 comments

Dear all,

I really like using ContactMap Explorer! I was wandering if there is a way to create a pandas dataframe out of a ContactFrequency calculation.

Like:

traj=mdt.load('trajectory.h5')
peptide = topology.select('chainid 1 and element != "H"')
protein = topology.select('chainid 0 and resid 77 or resid 124 or resid 130 or resid 137 and element != "H"')
contacts = ContactFrequency(traj, query=peptide, haystack=protein, cutoff=0.45)
df=pd.DataFrame(contacts)

where the query would be the columns and the haystack the rows or the other way round, doesn't matter.

Thanks for your effort! Have a nice day.

PeptideSimulator01 avatar May 31 '20 14:05 PeptideSimulator01