• Stars
    star
    310
  • Rank 134,965 (Top 3 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 6 years ago
  • Updated 9 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Package for fetching metadata and downloading data from SRA/ENA/GEO

A Python package for retrieving metadata from SRA/ENA/GEO

image image image image image image image

Documentation

https://saketkc.github.io/pysradb

CLI Usage

pysradb supports command line usage. See CLI instructions or quickstart guide.

$ pysradb
 usage: pysradb [-h] [--version] [--citation]
                {metadata,download,search,gse-to-gsm,gse-to-srp,gsm-to-gse,gsm-to-srp,gsm-to-srr,gsm-to-srs,gsm-to-srx,srp-to-gse,srp-to-srr,srp-to-srs,srp-to-srx,srr-to-gsm,srr-to-srp,srr-to-srs,srr-to-srx,srs-to-gsm,srs-to-srx,srx-to-srp,srx-to-srr,srx-to-srs}
                ...

 pysradb: Query NGS metadata and data from NCBI Sequence Read Archive.
 version: 2.0.1
 Citation: 10.12688/f1000research.18676.1

 optional arguments:
   -h, --help            show this help message and exit
   --version             show program's version number and exit
   --citation            how to cite

 subcommands:
   {metadata,download,search,gse-to-gsm,gse-to-srp,gsm-to-gse,gsm-to-srp,gsm-to-srr,gsm-to-srs,gsm-to-srx,srp-to-gse,srp-to-srr,srp-to-srs,srp-to-srx,srr-to-gsm,srr-to-srp,srr-to-srs,srr-to-srx,srs-to-gsm,srs-to-srx,srx-to-srp,srx-to-srr,srx-to-srs}
     metadata            Fetch metadata for SRA project (SRPnnnn)
     download            Download SRA project (SRPnnnn)
     search              Search SRA for matching text
     gse-to-gsm          Get GSM for a GSE
     gse-to-srp          Get SRP for a GSE
     gsm-to-gse          Get GSE for a GSM
     gsm-to-srp          Get SRP for a GSM
     gsm-to-srr          Get SRR for a GSM
     gsm-to-srs          Get SRS for a GSM
     gsm-to-srx          Get SRX for a GSM
     srp-to-gse          Get GSE for a SRP
     srp-to-srr          Get SRR for a SRP
     srp-to-srs          Get SRS for a SRP
     srp-to-srx          Get SRX for a SRP
     srr-to-gsm          Get GSM for a SRR
     srr-to-srp          Get SRP for a SRR
     srr-to-srs          Get SRS for a SRR
     srr-to-srx          Get SRX for a SRR
     srs-to-gsm          Get GSM for a SRS
     srs-to-srx          Get SRX for a SRS
     srx-to-srp          Get SRP for a SRX
     srx-to-srr          Get SRR for a SRX
     srx-to-srs          Get SRS for a SRX

Quickstart

A Google Colaboratory version of most used commands are available in this Colab Notebook . Note that this requires only an active internet connection (no additional downloads are made).

The following notebooks document all the possible features of `pysradb`:

  1. Python API
  2. Downloading datasets from SRA - command line
  3. Parallely download multiple datasets - Python API
  4. Converting SRA-to-fastq - command line (requires conda)
  5. Downloading subsets of a project - Python API
  6. Download BAMs
  7. Metadata for multiple SRPs
  8. Multithreaded fastq downloads using Aspera Client
  9. Searching SRA/GEO/ENA

Installation

To install stable version using `pip`:

pip install pysradb

Alternatively, if you use conda:

conda install -c bioconda pysradb

This step will install all the dependencies. If you have an existing environment with a lot of pre-installed packages, conda might be slow. Please consider creating a new enviroment for pysradb:

conda create -c bioconda -n pysradb PYTHON=3.10 pysradb

Dependencies

pandas
requests
tqdm
xmltodict

Installing pysradb in development mode

git clone https://github.com/saketkc/pysradb.git
cd pysradb && pip install -r requirements.txt
pip install -e .

Using pysradb

Obtaining SRA metadata

$ pysradb metadata SRP000941 | head

study_accession experiment_accession experiment_title                                                                                                                 experiment_desc                                                                                                                  organism_taxid  organism_name library_strategy library_source  library_selection sample_accession sample_title instrument                    total_spots total_size    run_accession run_total_spots run_total_bases
SRP000941       SRX056722                                                                         Reference Epigenome: ChIP-Seq Analysis of H3K27ac in hESC H1 Cells                                                               Reference Epigenome: ChIP-Seq Analysis of H3K27ac in hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC    ChIP            SRS184466                              Illumina HiSeq 2000    26900401     531654480   SRR179707     26900401         807012030
SRP000941       SRX027889                                                                            Reference Epigenome: ChIP-Seq Analysis of H2AK5ac in hESC Cells                                                                  Reference Epigenome: ChIP-Seq Analysis of H2AK5ac in hESC Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC    ChIP            SRS116481                      Illumina Genome Analyzer II    37528590     779578968   SRR067978     37528590        1351029240
SRP000941       SRX027888                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS116483                      Illumina Genome Analyzer II    13603127    3232309537   SRR067977     13603127         489712572
SRP000941       SRX027887                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS116562                      Illumina Genome Analyzer II    22430523     506327844   SRR067976     22430523         807498828
SRP000941       SRX027886                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS116560                      Illumina Genome Analyzer II    15342951     301720436   SRR067975     15342951         552346236
SRP000941       SRX027885                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS116482                      Illumina Genome Analyzer II    39725232     851429082   SRR067974     39725232        1430108352
SRP000941       SRX027884                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS116481                      Illumina Genome Analyzer II    32633277     544478483   SRR067973     32633277        1174797972
SRP000941       SRX027883                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS004118                      Illumina Genome Analyzer II    22150965    3262293717   SRR067972      9357767         336879612
SRP000941       SRX027883                                                                                     Reference Epigenome: ChIP-Seq Input from hESC H1 Cells                                                                           Reference Epigenome: ChIP-Seq Input from hESC H1 Cells  9606            Homo sapiens       ChIP-Seq           GENOMIC  RANDOM            SRS004118                      Illumina Genome Analyzer II    22150965    3262293717   SRR067971     12793198         460555128

Obtaining detailed SRA metadata

$ pysradb metadata SRP075720 --detailed | head

study_accession experiment_accession experiment_title                                  experiment_desc                                   organism_taxid  organism_name library_strategy library_source  library_selection sample_accession sample_title instrument           total_spots total_size run_accession run_total_spots run_total_bases
SRP075720       SRX1800476            GSM2177569: Kcng4_2la_H9; Mus musculus; RNA-Seq   GSM2177569: Kcng4_2la_H9; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467643                    Illumina HiSeq 2500  2547148      97658407  SRR3587912    2547148         127357400
SRP075720       SRX1800475            GSM2177568: Kcng4_2la_H8; Mus musculus; RNA-Seq   GSM2177568: Kcng4_2la_H8; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467642                    Illumina HiSeq 2500  2676053     101904264  SRR3587911    2676053         133802650
SRP075720       SRX1800474            GSM2177567: Kcng4_2la_H7; Mus musculus; RNA-Seq   GSM2177567: Kcng4_2la_H7; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467641                    Illumina HiSeq 2500  1603567      61729014  SRR3587910    1603567          80178350
SRP075720       SRX1800473            GSM2177566: Kcng4_2la_H6; Mus musculus; RNA-Seq   GSM2177566: Kcng4_2la_H6; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467640                    Illumina HiSeq 2500  2498920      94977329  SRR3587909    2498920         124946000
SRP075720       SRX1800472            GSM2177565: Kcng4_2la_H5; Mus musculus; RNA-Seq   GSM2177565: Kcng4_2la_H5; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467639                    Illumina HiSeq 2500  2226670      83473957  SRR3587908    2226670         111333500
SRP075720       SRX1800471            GSM2177564: Kcng4_2la_H4; Mus musculus; RNA-Seq   GSM2177564: Kcng4_2la_H4; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467638                    Illumina HiSeq 2500  2269546      87486278  SRR3587907    2269546         113477300
SRP075720       SRX1800470            GSM2177563: Kcng4_2la_H3; Mus musculus; RNA-Seq   GSM2177563: Kcng4_2la_H3; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467636                    Illumina HiSeq 2500  2333284      88669838  SRR3587906    2333284         116664200
SRP075720       SRX1800469            GSM2177562: Kcng4_2la_H2; Mus musculus; RNA-Seq   GSM2177562: Kcng4_2la_H2; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467637                    Illumina HiSeq 2500  2071159      79689296  SRR3587905    2071159         103557950
SRP075720       SRX1800468            GSM2177561: Kcng4_2la_H1; Mus musculus; RNA-Seq   GSM2177561: Kcng4_2la_H1; Mus musculus; RNA-Seq  10090           Mus musculus  RNA-Seq          TRANSCRIPTOMIC  cDNA              SRS1467635                    Illumina HiSeq 2500  2321657      89307894  SRR3587904    2321657         116082850

Converting SRP to GSE

$ pysradb srp-to-gse SRP075720

study_accession study_alias
SRP075720       GSE81903

Converting GSM to SRP

$ pysradb gsm-to-srp GSM2177186

experiment_alias study_accession
GSM2177186       SRP075720

Converting GSM to GSE

$ pysradb gsm-to-gse GSM2177186

experiment_alias study_alias
GSM2177186       GSE81903

Converting GSM to SRX

$ pysradb gsm-to-srx GSM2177186

experiment_alias experiment_accession
GSM2177186       SRX1800089

Converting GSM to SRR

$ pysradb gsm-to-srr GSM2177186

experiment_alias run_accession
GSM2177186       SRR3587529

Downloading supplementary files from GEO

$ pysradb download -g GSE161707

Downloading an entire SRA/ENA project (multithreaded)

pysradb makes it super easy to download datasets from SRA parallely: Using 8 threads to download:

$ pysradb download -y -t 8 --out-dir ./pysradb_downloads -p SRP063852

Downloads are organized by SRP/SRX/SRR mimicking the hierarchy of SRA projects.

Downloading only certain samples of interest

$ pysradb metadata SRP000941 --detailed | grep 'study\|RNA-Seq' | pysradb download

This will download all RNA-seq samples coming from this project.

Ultrafast fastq downloads

With aspera-client installed, [pysradb]{.title-ref} can perform ultra fast downloads:

To download all original fastqs with [aspera-client]{.title-ref} installed utilizing 8 threads:

$ pysradb download -t 8 --use_ascp -p SRP002605

Refer to the notebook for (shallow) time benchmarks.

Publication

pysradb: A Python package to query next-generation sequencing metadata and data from NCBI Sequence Read Archive

Presentation slides from BOSC (ISMB-ECCB) 2019: https://f1000research.com/slides/8-1183

Citation

Choudhary, Saket. "pysradb: A Python Package to Query next-Generation Sequencing Metadata and Data from NCBI Sequence Read Archive." F1000Research, vol. 8, F1000 (Faculty of 1000 Ltd), Apr. 2019, p. 532 (https://f1000research.com/articles/8-532/v1)

@article{Choudhary2019,
doi = {10.12688/f1000research.18676.1},
url = {https://doi.org/10.12688/f1000research.18676.1},
year = {2019},
month = apr,
publisher = {F1000 (Faculty of 1000 Ltd)},
volume = {8},
pages = {532},
author = {Saket Choudhary},
title = {pysradb: A {P}ython package to query next-generation sequencing metadata and data from {NCBI} {S}equence {R}ead {A}rchive},
journal = {F1000Research}
}

Zenodo archive: https://zenodo.org/badge/latestdoi/159590788

Zenodo DOI: 10.5281/zenodo.2306881

Questions?

Open an issue or join our Slack Channel.

More Repositories

1

fos-proposals

💝 🐧 Archive of GSoC proposals
Python
480
star
2

gencode_regions

Extract 3'UTR, 5'UTR, CDS, Promoter, Genes, Introns, Exons from GTF files
Jupyter Notebook
101
star
3

rna-seq-snakemake

Snakemake based pipeline for RNA-Seq analysis
R
31
star
4

pyseqlogo

Python package to plot sequence logos
Python
29
star
5

pySCTransform

Python package to perform normalization and variance-stabilization of single-cell data
Jupyter Notebook
21
star
6

hatex

'h'omeworks, 'a'ssignments 'tex' for courses at USC
Jupyter Notebook
16
star
7

riboraptor

Tool for ribo-seq analysis. Most of the functionality moved to ribotricer (https://github.com/smithlabcode/ribotricer)
Python
13
star
8

usc-vpn-linux-setup

Instructions for accessing USC's VPN on linux
Shell
9
star
9

moca

Ⓜ️ Tool for motif conservation analysis
PostScript
9
star
10

notebooks

📗 Jupyter notebooks for demo/projects, now that github supports them
Jupyter Notebook
8
star
11

scilab_cloud

☁️ Scilab on Cloud
Scilab
8
star
12

open-ehr-django

An Electronic Health Records System in *pure* Django.
8
star
13

kicad-ngspice

🔌 Some tweaks integrated in a python script to make kiCAD and ngspice compatible to each other
Python
7
star
14

scRNA_NB_comparison

Scripts to reproduce the analyses in the paper "Comparison and evaluation of statistical error models for scRNA-seq"
R
7
star
15

dcpp.js

🔧 DC++ straight from your Browser! No Sharing Required!
JavaScript
6
star
16

motif-logos-matplotlib

Motif logos in matplotlib (POC)
Jupyter Notebook
6
star
17

variational-autoencoders-tf-eager

Variational autoencoders using Tensorflow's eager API
Jupyter Notebook
4
star
18

pivotal-tracker-email-wrapper

📪 Ruby Wrapper to assign tasks on pivotal through an email
Ruby
4
star
19

sklearn-hogsvd

Scikit-learn compatible python implementation of HO-GSVD
Python
4
star
20

multiZ-scripts

Snakefiles/Python scripts to create conservation tracks
Perl
4
star
21

covmuller

Covmuller is an R-package designed for analysis of SARS-CoV-2 sequencing metadata deposited on GISAID
R
3
star
22

pyFLGLM

Jupyter Notebook
3
star
23

pyvirchow

Tools for whole slide image processing and classification
Jupyter Notebook
3
star
24

galaxy_tools

My Galaxy Wrappers
JavaScript
3
star
25

EE-546-project

Jupyter Notebook
3
star
26

bio-tricks

💉 Custom bio* stuff
Python
3
star
27

biojs-genetic-variation-viewer

♻️ BioJS1.0 Component for visualising human gentic variations, GSoC2014
JavaScript
3
star
28

iclip-seq-snakemake

Snakemake based pipeline for analysing iCLIP-Seq data
Python
2
star
29

brewer

Homebrew Personal recipes
Ruby
2
star
30

ug_acads

UG Acads IIT B Open Sourced !
JavaScript
2
star
31

blog-archive

💾 => 📡
HTML
2
star
32

ribo-seq-snakemake

Snakemake pipeline for Ribo-Seq analysis
Python
2
star
33

blog

Jupyter Notebook
2
star
34

review

Review of Scientific Papers
2
star
35

rnn-cds-prediction

Prediction of CDS regions using RNNs
2
star
36

resume

HTML
1
star
37

overleaf-cloner

Clone your Overleaf.com projects at once!
Jupyter Notebook
1
star
38

haskell99

Haskell 99 Problems' Solutions
Haskell
1
star
39

machine_learning

My experiments with ML
R
1
star
40

math-501-project

📓 Optimal Control Design of a Reparable Multistate system
Julia
1
star
41

moodi-hack

Post for Hp !
Ruby
1
star
42

talks

Monologues. mostly.
HTML
1
star
43

moodle-stack

Allows you to download moodle files for all your courses. This will grow into a website later
Python
1
star
44

moca_web

Ⓜ️ Code for MOtif Conservation Analysis
Jupyter Notebook
1
star
45

points-of-significance

Python notebooks for Nature's Point of Significance collection: http://www.nature.com/collections/qghhqm/pointsofsignificance
Jupyter Notebook
1
star
46

pivotal_email_tracker_bot

Send Stories to pivotal through emails !
1
star
47

comp-bio

C++
1
star
48

iitb-library-sms-interface

Sends automated SMSes reminding you of due dates from IITB moodle/asc
Python
1
star
49

re-ribo-smk

Snakemake pipeline for end-to-end Ribo-seq analysis
Jupyter Notebook
1
star
50

tcga-python

Python Wrapper for TCGA API
Python
1
star
51

dropbox_on_sms

Access DropBox files using SMS
Ruby
1
star
52

SPOJ_haskell

HAskel Solutions for SPOJ
Haskell
1
star
53

scrape_ebi

Automate Submissions To EBI portals
Python
1
star
54

pyfastnbfit

Fast fitting for counts data using Minka's algorithm
Jupyter Notebook
1
star
55

ideone-chrome-extension

A chrome extension that allows running code on ideone simply by selecting the text in a browser window
JavaScript
1
star
56

Google-AppEngine-Projects

All Google-AppEngine Projects that I did. Try out the links at foldername.appspot.com
Python
1
star
57

dotfiles

Collection of dotfiles
Shell
1
star
58

predicting-cds-rnn

Jupyter Notebook
1
star
59

SlideShare-Instants

Instant Search for SlideShare Documents
1
star
60

protein_loop_closure

Protein Loop Closure Algorithm
Python
1
star
61

riddler

538 -- We all need stimulants.
Jupyter Notebook
1
star
62

SlideShare-Instant

Instant Search for SlideShare Documents
1
star
63

pyjoyplot

POC for a 'joyplot' using matplotlib
Jupyter Notebook
1
star
64

math-screening-solutions

📗 🎓 Solutions for MATH Screening Exams
HTML
1
star
65

rss-graduate-diploma-solutions

Solutions to Royal Statistical Society's Graduate Diploma in Statistics Examination
Makefile
1
star