def mmtf_fetch(pdb, cache_dir='cath/mmtf/'): """ Retrieve mmtf record from PDB with local caching """ mmtf_file = cache_dir + pdb + '.mmtf.gz' url = 'http://mmtf.rcsb.org/v1.0/full/' + pdb + '.mmtf.gz' mmtf_file = download_cached(url, mmtf_file) mmtf_record = mmtf.parse_gzip(mmtf_file) return mmtf_record
def get_structure_gzip(file_path): """Get a structrue from a gzipped file - given a file path. :param file_path: the input file path :return the structure """ decoder = parse_gzip(file_path) return get_from_decoded(decoder)
def get_structure(file_path): """Get a structure from a file - given a file path. :param file_path: the input file path :return: the structure """ try: decoder = parse(file_path) except Exception: decoder = parse_gzip(file_path) return get_from_decoded(decoder)
def _parse_mmtf(fn): if fn.endswith('gz'): return mmtf.parse_gzip(fn) else: return mmtf.parse(fn)
def setUp(self): top = mmtf.parse_gzip(MMTF_gz) self.u = mda.Universe(top)
def test_round_trip(self): data_in = parse_gzip("mmtf/tests/testdatastore/4CUP.mmtf.gz") write_mmtf("test.mmtf", data_in, MMTFDecoder.pass_data_on) data_rt = parse("test.mmtf") self.check_equal(data_in, data_rt)
def test_gz_decoder(self): decoded = parse_gzip("mmtf/tests/testdatastore/4CUP.mmtf.gz")
def u(self): top = mmtf.parse_gzip(MMTF_gz) return mda.Universe(top)