Exemple #1
0
def to_file_mmtf(item,
                 atom_indices='all',
                 structure_indices='all',
                 output_filename=None,
                 check=True):

    if check:
        from molsysmt.tools.mmtf_MMTFDecoder.is_mmtf_MMTFDecoder import _checking_form
        _checking_form(item, check=check)

    if output_filename is None:
        raise ValueError

    from molsysmt.tools.mmtf_MMTFDecoder import extract
    from mmtf.api.default_api import write_mmtf, MMTFDecoder

    tmp_item = extract(item,
                       atom_indices=atom_indices,
                       structure_indices=structure_indices,
                       copy_if_all=False,
                       check=False)

    write_mmtf(output_filename, tmp_item, MMTFDecoder.pass_data_on)

    tmp_item = output_filename

    return tmp_item
Exemple #2
0
 def round_trip(self,pdb_id):
     if _internet_on(BASE_URL):
         data_in = fetch(pdb_id)
         write_mmtf(pdb_id+".mmtf", data_in, MMTFDecoder.pass_data_on)
         data_rt = parse(pdb_id+".mmtf")
         self.check_equal(data_in, data_rt)
     else:
         print("Warning - cannot connect to "+BASE_URL)
Exemple #3
0
def to_file_mmtf(item,
                 atom_indices='all',
                 structure_indices='all',
                 output_filename=None,
                 check=True):

    if check:

        digest_item(item, 'mmtf.MMTFDecoder')
        atom_indices = digest_atom_indices(atom_indices)
        structure_indices = digest_structure_indices(structure_indices)

    from . import extract
    from mmtf.api.default_api import write_mmtf, MMTFDecoder

    tmp_item = extract(item,
                       atom_indices=atom_indices,
                       structure_indices=structure_indices,
                       copy_if_all=False,
                       check=False)
    write_mmtf(output_filename, tmp_item, MMTFDecoder.pass_data_on)
    tmp_item = output_filename

    return tmp_item
Exemple #4
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)
 def round_trip(self,pdb_id):
     data_in = fetch(pdb_id)
     write_mmtf(pdb_id+".mmtf", data_in, MMTFDecoder.pass_data_on)
     data_rt = parse(pdb_id+".mmtf")
     self.check_equal(data_in, data_rt)