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
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
def _parse_mmtf(fn):
    if fn.endswith('gz'):
        return mmtf.parse_gzip(fn)
    else:
        return mmtf.parse(fn)
Ejemplo n.º 5
0
 def setUp(self):
     top = mmtf.parse_gzip(MMTF_gz)
     self.u = mda.Universe(top)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 def test_gz_decoder(self):
     decoded = parse_gzip("mmtf/tests/testdatastore/4CUP.mmtf.gz")
Ejemplo n.º 8
0
 def u(self):
     top = mmtf.parse_gzip(MMTF_gz)
     return mda.Universe(top)
Ejemplo n.º 9
0
 def u(self):
     top = mmtf.parse_gzip(MMTF_gz)
     return mda.Universe(top)
Ejemplo n.º 10
0
def _parse_mmtf(fn):
    if fn.endswith('gz'):
        return mmtf.parse_gzip(fn)
    else:
        return mmtf.parse(fn)