This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How many ID's exist in BioSample?

Hello everyone!

I would like to know if there is a way to get all the id's from BioSample. I already tried a link that i saw in another post that works for BioProject (https://www.ncbi.nlm.nih.gov/bioproject/browse/) but it doesn´t work for BioSample.

I also tried to download the summary of BioSample using this example from BioProject (ftp://ftp.ncbi.nlm.nih.gov/bioproject/summary.txt)

Also, can this be solved programmatically, i.e. using Eutils or EDirect?

What i really want to know is, simply, how many id's exist and how can i search for a list of them.

Thank you very much!

ncbi biosample eutils bioproject

3 answers

using my tool XsltStream http://lindenb.github.io/jvarkit/XsltStream.html and the NCBI Biosample XML dump

May I ask you why you need a list of all samples? And just the id's without any other information? I don't understand what you want to accomplish.

However, if you have a problem with ncbi's biosamples, you can try EBI's Biosample database (It should be synchronized with the ncbi one as far as I know). In this post I link to the API and the documentation, you might find that useful!

Of course, you could also access the data via RDF/SPARQL but that is a whole different story.

Thank you very much for your explanation. I am trying to get the BioSample id's associated with some BioProjects and i just wanted to know how much records existed and a way to list them.

If you know the specific BioProject ID then use this (replace proj_ID with a real ID): esearch -db bioproject -query "proj_ID" | elink -target biosample | efetch -format docsum | xtract -pattern DocumentSummary -block Accession -element Accession

You could get this file and then grep for sample accession #.

Edit: For specific BioProject ID's

esearch -db bioproject -query "BioProj_ID" | elink -target biosample | efetch -format docsum | xtract -pattern DocumentSummary -block Accession -element Accession

Log in to answer this question.