INNER CODE UNIT · Python
mapper
ncbi/dbsnp · tutorials/hadoop_json_annotation.py:56
def mapper(self, _, line):
data = json.loads(line)
snp_id = data["refsnp_id"]
annotations = data["primary_snapshot_data"]["allele_annotations"]
for a in annotations:
assembly_annotations = a["assembly_annotation"]
for aa in assembly_annotations:
seq_id = aa["seq_id"]
annotation_release = aa["annotation_release"]
genes = aa["genes"]
for g in genes:
gene_name = g["name"]
gene_id = str(g["id"])