This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get corresponding Biosample accessions for very large list of SRA accesions?

I have ~1000 SRR files in a list and I want to get the Biosample accession numbers for each of them without doing it manually. Any easy script to do this sort of thing?

Thanks!

next-gen

1 answer

You can use Entrez Direct for this as follows:

$ esearch -db sra -query 'SRR5437876' | elink -target biosample | efetch 
1: Human sample from Homo sapiens
Identifiers: BioSample: SAMN06710536; Sample name: MCF-7; SRA: SRS2116118
Organism: Homo sapiens
Attributes:
    /isolate="MCF-7"
    /age="69 years"
    /biomaterial provider="missing"
    /sex="female"
    /tissue="breast"
    /cell line="MCF-7 cancer cell line"
Accession: SAMN06710536 ID: 6710536

If you use the -format native -mode xml with the final efetch command, you can get the output in XML format that can be parsed using the xtract command, an Entrez Direct tool.

Log in to answer this question.