NCBI Entrez can be accessed with many different platforms (python, R, etc.) , but I find .NET one of the best because the static typing makes it easy to infer what all the datafields mean, and navigate the data with much greater ease.
Documentation is sparse for this task, but here is how to access NCBI from the .NET platform. The example steps/program show how to query dbSNP for information about particular ids.
- Open visual studio, start a new project and add two Service References to the project: http://eutils.ncbi.nlm.nih.gov/soap/v2.0/eutils.wsdl and http://eutils.ncbi.nlm.nih.gov/soap/v2.0/efetch_snp.wsdl files. Note that the efetch depends on the database used, in this case “snp” other databases have different ones. You should now have two references:
More information is available here on setting up visual studio: http://www.ncbi.nlm.nih.gov/books/NBK55694/
2. Next up grab the data as shown in the example. Each SNP has A LOT more data, which can be inspected in the IDE.
1: static void Main(string[] args)
2: {
3: string dbSNPid="28357684";
4: efetch.eFetchRequest re = new efetch.eFetchRequest();
5: re.id = dbSNPid;
6: var serv=new efetch.eUtilsServiceSoapClient();
7: var exchange = serv.run_eFetch(re);
8: var snpData = exchange.ExchangeSet.Rs[0];
9: object[] dataToReport=new object[] {
10: snpData.Het.value,
11: snpData.hgvs.First(),
12: snpData.PrimarySequence.First().accession,
13: };
14: Console.WriteLine( String.Join("\t",dataToReport.Select(x=>x.ToString()).ToArray()));
15: Console.ReadLine();
16: }
The following links contain other useful information for consuming the entrez webservice in C#.
Setting up visual studio: http://www.ncbi.nlm.nih.gov/books/NBK55694/
Using efetch: http://www.ncbi.nlm.nih.gov/books/NBK55694/#csharp_msvs.Call_HYPERLINK__chaptercha_8
Forming queries: http://www.biostars.org/p/3436/
More information: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/v2.0/DOC/esoap_help.html
Also note that the first query takes much longer than subsequent ones, for reasons unknown to me at present.