You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importMDAnalysisasmdafromMDAnalysisTests.datafilesimportPSFimports3fss3_fs=s3fs.S3FileSystem(
# anon must be false to allow authenticationanon=False,
profile='sample_profile',# use profiles defined in a .aws/credentials file to store secret keysclient_kwargs=dict(
region_name='us-west-1',
)
)
# PDB trajectory file is stored in an S3 bucket# Trajectory used is PDB_small from MDAnalysisTests.datafilesfile=s3fs.S3File(s3_fs, "zarrtraj-test-data/pdb_small.pdb")
u=mda.Universe(PSF, file, format="PDB")
fortsinu.trajectory:
print(u.atoms)
This works because File-like objects are accepted by the PDBReader (and potentially other formats, @orbeckst suggested the GRO format may be able to do this as well) and S3File objects implement this interface.
For a large trajectory, this would be extremely slow, but could be sped up with caching.
The text was updated successfully, but these errors were encountered:
There's nothing in the code that needs changing, so this is more of a "let's document fun things one can do", perhaps for a "hacking around MDAnalysis section".
Also note that this functionality will fail to work when we were to switch to accelerated text-based readers, which would be based on a C++/Cython implementation.
As per @hmacdope's request, here is how you can tweak PDBReader with a few lines of code to get it to read from an AWS S3 bucket:
https://github.com/ljwoods2/mdanalysis/pull/2/files
This allows you to do something like this:
This works because File-like objects are accepted by the PDBReader (and potentially other formats, @orbeckst suggested the GRO format may be able to do this as well) and S3File objects implement this interface.
For a large trajectory, this would be extremely slow, but could be sped up with caching.
The text was updated successfully, but these errors were encountered: