AlphaFold db bundles files as tar files.
Rather than un-taring the files and then parsing the cif.gz files, specific files could be read directly from the tar file, e,g.,
filename = "AF-O52908-F1-model_v2.cif.gz"
with tarfile.open("UP000000799_192222_CAMJE_v2.tar") as tf:
with gzip.open(tf.extractfile(filename), mode="rt") as gf:
gf.readlines()
With some modifications to CifReader, it should be possible to do this:
with tarfile.open("UP000000799_192222_CAMJE_v2.tar") as tf:
cfr = CifFileReader()
file_obj = tf.extractfile(filename)
cif_obj = cfr.read(file_obj, output='cif_dictionary')
AlphaFold db bundles files as tar files.
Rather than un-taring the files and then parsing the cif.gz files, specific files could be read directly from the tar file, e,g.,
With some modifications to CifReader, it should be possible to do this: