def test_search(): query1 = rcsb.ResolutionQuery(0.0, 0.8) query2 = rcsb.MolecularWeightQuery(0, 1000) ids_query1 = sorted(rcsb.search(query1)) ids_query2 = sorted(rcsb.search(query2)) ids_comp = sorted(rcsb.search(rcsb.CompositeQuery("or", [query1, query2]))) ids_comp2 = [] for id in ids_query1 + ids_query2: if id not in ids_comp2: ids_comp2.append(id) assert ids_comp == sorted(ids_comp2)
# true. # Download file in the fast and small binary MMTF format file_path = rcsb.fetch("1l2y", "mmtf", biotite.temp_dir(), overwrite=True) ######################################################################## # In many cases you are not interested in a specific structure, but you # want a set of structures that fits your desired criteria. # For this purpose the *RCSB* SEARCH service can be interfaced. # # At first you have to create :class:`Query` object for the property you # want to filter. # The :func:`search()` method takes the :class:`Query` and returns a # list of PDB IDs, which itself can be used as input for :func:`fetch()`. query = rcsb.ResolutionQuery(0.0, 0.6) pdb_ids = rcsb.search(query) print(pdb_ids) files = rcsb.fetch(pdb_ids, "mmtf", biotite.temp_dir()) ######################################################################## # Not all query types of the SEARCH service are supported yet. But it is # quite easy to implement your needed query type by inheriting # :class:`SimpleQuery`. # # Multiple :class:`SimpleQuery` objects can be 'and'/'or' combined using # a :class:`CompositeQuery`. query1 = rcsb.ResolutionQuery(0.0, 1.0) query2 = rcsb.MolecularWeightQuery(10000, 100000) composite = rcsb.CompositeQuery("and", [query1, query2])
# true. # Download file in the fast and small binary MMTF format file_path = rcsb.fetch("1l2y", "mmtf", biotite.temp_dir(), overwrite=True) ######################################################################## # In many cases you are not interested in a specific structure, but you # want a set of structures that fits your desired criteria. # For this purpose the *RCSB SEARCH* service can be interfaced. # # At first you have to create :class:`Query` object for the property you # want to filter. # The :func:`search()` method takes the :class:`Query` and returns a # list of PDB IDs, which itself can be used as input for :func:`fetch()`. query = rcsb.ResolutionQuery(min=0.0, max=0.6) pdb_ids = rcsb.search(query) print(pdb_ids) files = rcsb.fetch(pdb_ids, "mmtf", biotite.temp_dir()) ######################################################################## # Not all query types of the SEARCH service are supported yet. But it is # quite easy to implement your needed query type by inheriting # :class:`SimpleQuery`. # # Multiple :class:`SimpleQuery` objects can be 'and'/'or' combined using # a :class:`CompositeQuery`. query1 = rcsb.ResolutionQuery(0.0, 1.0) query2 = rcsb.MolecularWeightQuery(10000, 100000) composite = rcsb.CompositeQuery("and", [query1, query2])