Parsing snp result

0

I am trying to parse dbSNP results into data frame in python, I got the result as "bytes" and I wonder if there is a way to parse it into dataframe. I tried multiple xml packages (xml, lxml) but they are not able to separate the arguments in the response.content. Does anyone know how to parse the result showed below into dataframe?

Below is the script and output:

import requests

response = requests.get("eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=snp&id=1593319917&report=XML")

print(response.content)

b'<?xml version="1.0" ?>n<ExchangeSet xmlns:xsi="www.w3.org/2001/XMLSchema-instance" xmlns="www.ncbi.nlm.nih.gov/SNP/docsum" xsi:schemaLocation="www.ncbi.nlm.nih.gov/SNP/docsum ftp.ncbi.nlm.nih.gov/snp/specs/docsum_eutils.xsd" ><DocumentSummary uid="1593319917"><SNP_ID>1593319917</SNP_ID><ALLELE_ORIGIN/><GLOBAL_MAFS><MAF><STUDY>SGDP_PRJ</STUDY><FREQ>G=0.5/1</FREQ></MAF></GLOBAL_MAFS><GLOBAL_POPULATION/><GLOBAL_SAMPLESIZE>0</GLOBAL_SAMPLESIZE><SUSPECTED/><CLINICAL_SIGNIFICANCE/><GENES><GENE_E><NAME>FLT3</NAME><GENE_ID>2322</GENE_ID></GENE_E></GENES><ACC>NC_000013.11</ACC><CHR>13</CHR><HANDLE>SGDP_PRJ</HANDLE><SPDI>NC_000013.11:28102567:G:A</SPDI><FXN_CLASS>upstream_transcript_variant</FXN_CLASS><VALIDATED>by-frequency</VALIDATED><DOCSUM>HGVS=NC_000013.11:g.28102568G>A,NC_000013.10:g.28676705G>A,NG_007066.1:g.3001C>T|SEQ=[G/A]|LEN=1|GENE=FLT3:2322</DOCSUM><TAX_ID>9606</TAX_ID><ORIG_BUILD>154</ORIG_BUILD><UPD_BUILD>154</UPD_BUILD><CREATEDATE>2020/04/27 06:19</CREATEDATE><UPDATEDATE>2020/04/27 06:19</UPDATEDATE><SS>3879653181</SS><ALLELE>R</ALLELE><SNP_CLASS>snv</SNP_CLASS><CHRPOS>13:28102568</CHRPOS><CHRPOS_PREV_ASSM>13:28676705</CHRPOS_PREV_ASSM><TEXT/><SNP_ID_SORT>1593319917</SNP_ID_SORT><CLINICAL_SORT>0</CLINICAL_SORT><CITED_SORT/><CHRPOS_SORT>0028102568</CHRPOS_SORT><MERGED_SORT>0</MERGED_SORT></DocumentSummary>n</ExchangeSet>'

I also tried efetch using the SNP_ID but no record is found:

handle=Entrez.efetch(db="snp", id='1593319917')

snp=SeqIO.read(handle, format="gb")

print(snp)

ValueError: No records found in handle


SNP

• 20 views


Login
before adding your answer.

Traffic: 1458 users visited in the last hour



Source link