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)
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]) ######################################################################## # Fetching files from the NCBI Entrez database # -------------------------------------------- # # .. currentmodule:: biotite.database.entrez # # Another important source of biological information is the # *NCBI Entrez* database, which is commonly known as *the NCBI*. # It provides a myriad of information, ranging from sequences and # sequence features to scientific papers. Fetching files from # NCBI Entrez works analogous to the RCSB interface. This time # we have to provide the UIDs (Accession or GI) instead of PDB IDs # to the :func:`fetch()` function.
def test_search_empty(): ids = rcsb.search(rcsb.MolecularWeightQuery(0, 1)) assert len(ids) == 0