Created
March 20, 2012 14:49
-
-
Save aschreyer/2136435 to your computer and use it in GitHub Desktop.
Querying CIFStore with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for res in db.structures.find({"entry.id": "2P33"}, {'pdbx_entity_nonpoly.comp_id': 1}): | |
| print res | |
| {u'pdbx_entity_nonpoly': [{u'comp_id': u'J07'}, {u'comp_id': u'HOH'}], u'_id': u'2P33'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pymongo import Connection | |
| connection = Connection('localhost', 27017) | |
| db = connection.cifstore | |
| db.structures.count() | |
| 79177 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for res in db.structures.find({"pdbx_entity_nonpoly.comp_id":"STI"}, fields=["struct_ref.pdbx_db_accession"]): | |
| print res | |
| {u'_id': u'2OIQ', u'struct_ref': {}} | |
| {u'_id': u'3HEC', u'struct_ref': {}} | |
| {u'_id': u'1XBB', u'struct_ref': {}} | |
| {u'_id': u'3FW1', u'struct_ref': {}} | |
| {u'_id': u'2PL0', u'struct_ref': {}} | |
| {u'_id': u'1OPJ', u'struct_ref': {}} | |
| {u'_id': u'1T46', u'struct_ref': [{u'pdbx_db_accession': u'P10721'}, {u'pdbx_db_accession': u'4557695'}]} | |
| {u'_id': u'1IEP', u'struct_ref': {u'pdbx_db_accession': u'P00520'}} | |
| {u'_id': u'2HYY', u'struct_ref': {}} | |
| {u'_id': u'3GVU', u'struct_ref': {}} | |
| {u'_id': u'3K5V', u'struct_ref': {u'pdbx_db_accession': u'P00520'}} | |
| {u'_id': u'3MS9', u'struct_ref': {u'pdbx_db_accession': u'P00520'}} | |
| {u'_id': u'3MSS', u'struct_ref': {u'pdbx_db_accession': u'P00520'}} | |
| {u'_id': u'3OEZ', u'struct_ref': {}} | |
| {u'_id': u'3PYY', u'struct_ref': {}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment