私はNCBI Entrez Geneデータベースから遺伝子概要を取得して保存しようとしていますが、uidも保存したいのですが、そこにはありますが、結果から検索する正しい方法を見つけることができません。 (:ここで使用され、明らかではない、私の有効なメールアドレスNB):以下を参照してくださいEntrez.esummary( 'gene' db):DictElementからuidを取得する方法は?
from Bio import Entrez
Entrez.email = "[email protected]"
handle = Entrez.esummary(db="gene", id="79001")
record = Entrez.read(handle)
handle.close()
for k in record["DocumentSummarySet"]['DocumentSummary'][0].keys():
print k
これらのキーです:
ステータス、NomenclatureSymbol、OtherDesignations、ミム、名前、NomenclatureName、CurrentID、GenomicInfo、OtherAliasesあなたは要素自体
(record["DocumentSummarySet"]['DocumentSummary'][0])
を見れば、要約、GeneWeight、GeneticSource、MapLocation、ChrSort、ChrStart、LocationHist、生物、NomenclatureStatus、染色体、説明
しかし、あなたはに気づくでしょう末尾の:
DictElement(
{u'Status': '0',
u'NomenclatureSymbol': 'VKORC1',
u'OtherDesignations': 'phylloquinone epoxide reductase',
u'Mim': ['608547'],
u'Name': 'VKORC1',
u'NomenclatureName': 'vitamin K epoxide reductase complex subunit 1',
u'CurrentID': '0',
u'GenomicInfo': [
{u'ChrAccVer': 'NC_000016.10',
u'ChrLoc': '16',
u'ExonCount': '4',
u'ChrStop': '31090841',
u'ChrStart': '31094998'}],
u'OtherAliases': 'EDTP308, MST134, MST576, VKCFD2, VKOR',
u'Summary': 'This gene [...] variants. [provided by RefSeq, Aug 2015]',
u'GeneWeight': '46017',
u'GeneticSource': 'genomic',
u'MapLocation': '16p11.2',
u'ChrSort': '16',
u'ChrStart': '31090841',
u'LocationHist': [
{u'AssemblyAccVer': 'GCF_000001405.33',
u'ChrAccVer': 'NC_000016.10',
u'AnnotationRelease': '108',
u'ChrStop': '31090841',
u'ChrStart': '31094998'}],
u'Organism': {
u'CommonName': 'human',
u'ScientificName': 'Homo sapiens',
u'TaxID': '9606'},
u'NomenclatureStatus': 'Official',
u'Chromosome': '16',
u'Description': 'vitamin K epoxide reductase complex subunit 1'},
attributes={u'uid': u'79001'})
ただし、 'attributes'はキーの1つではありません。私はまだ属性で保持されているuidにアクセスする方法を見つけることです。誰にでもアイデアはありますか?
はい、それは動作します!本当にありがとう、私は怒っていました。私はDictElementsが属性を持っていたのか分かりませんでした。再度、感謝します。 –
編集のおかげで、次回は適切にやる方法を知っています。 –
@SBourgeois、私はそれを見つけるためにコードを覗かなければならなかった。 https://github.com/biopython/biopython/blob/master/Bio/Entrez/Parser.py#L96 – xbello