From SRA to FASTQ file
This analysis was performed using R (ver. 3.1.0).
Objectives
- Download automatically sequencing data from Short Read Archive (SRA)
- Convert SRA to FASTQ file
Download SRA file
The data from Popovic et al., (GEO accession number: GSE57478) where used in the following example. The SRA files are available here : http://www.ncbi.nlm.nih.gov/sra?term=SRP032510.
The downloaded process can be automated using R.
STEP 1. Download a table of the metadata into a CSV file “SraRunInfo.csv”:
From SRA web page :
click on “Send to (top right corner)” Select “File” Select format “RunInfo” Click on “Create File”
STEP 2. Read this CSV file “SraRunInfo.csv” into R:
The SRA files are automatically download in the current working directory using the following R script:
#Read SRA file infos
sri<-read.csv("SraRunInfo.csv", stringsAsFactors=FALSE)
files<-basename(sri$download_path)
for(i in 1:length(files)) download.file(sri$download_path[i], files[i])
This article describes just one way to automate the download of SRA files from R. Users can also use wget (Unix/Linux) or curl (MAC OS X) or download from web browser
wget ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR128/SRR1282056/SRR1282056.sra
Convert SRA to FASTQ format
To convert the example data to FASTQ, use the fastq-dump command from the SRA Toolkit on each SRA file. To install SRA Toolkit click here.
R can be used to construct the required shell commands and to automate the process, starting from the SraRunInfo.csv" metadata table, as follows:
# Assure that all the files has been downloaded successfully
# Remember, the R object files has been created in the previous code chunk
stopifnot( all(file.exists(files)) )
for(f in files) {
cmd = paste("fastq-dump --split-3", f)
cat(cmd,"\n")#print the current command
system(cmd) # invoke command
}
fastq-dumb can be also used manually into the Unix Shell.
fastq-dump --split-3 SRR1282056.sra
Be sure to use the –split-3 option, which splits mate-pair reads into separate files. After this command, single and paired-end data will produce one or two FASTQ files, respectively. For paired-end data, the file names will be suffixed 1.FASTQ and 2.FASTQ; otherwise, a single file with extension .FASTQ will be produced
See the video:
Show me some love with the like buttons below... Thank you and please don't forget to share and comment below!!
Montrez-moi un peu d'amour avec les like ci-dessous ... Merci et n'oubliez pas, s'il vous plaît, de partager et de commenter ci-dessous!
Recommended for You!
Recommended for you
This section contains best data science and self-development resources to help you on your path.
Coursera - Online Courses and Specialization
Data science
- Course: Machine Learning: Master the Fundamentals by Standford
- Specialization: Data Science by Johns Hopkins University
- Specialization: Python for Everybody by University of Michigan
- Courses: Build Skills for a Top Job in any Industry by Coursera
- Specialization: Master Machine Learning Fundamentals by University of Washington
- Specialization: Statistics with R by Duke University
- Specialization: Software Development in R by Johns Hopkins University
- Specialization: Genomic Data Science by Johns Hopkins University
Popular Courses Launched in 2020
- Google IT Automation with Python by Google
- AI for Medicine by deeplearning.ai
- Epidemiology in Public Health Practice by Johns Hopkins University
- AWS Fundamentals by Amazon Web Services
Trending Courses
- The Science of Well-Being by Yale University
- Google IT Support Professional by Google
- Python for Everybody by University of Michigan
- IBM Data Science Professional Certificate by IBM
- Business Foundations by University of Pennsylvania
- Introduction to Psychology by Yale University
- Excel Skills for Business by Macquarie University
- Psychological First Aid by Johns Hopkins University
- Graphic Design by Cal Arts
Books - Data Science
Our Books
- Practical Guide to Cluster Analysis in R by A. Kassambara (Datanovia)
- Practical Guide To Principal Component Methods in R by A. Kassambara (Datanovia)
- Machine Learning Essentials: Practical Guide in R by A. Kassambara (Datanovia)
- R Graphics Essentials for Great Data Visualization by A. Kassambara (Datanovia)
- GGPlot2 Essentials for Great Data Visualization in R by A. Kassambara (Datanovia)
- Network Analysis and Visualization in R by A. Kassambara (Datanovia)
- Practical Statistics in R for Comparing Groups: Numerical Variables by A. Kassambara (Datanovia)
- Inter-Rater Reliability Essentials: Practical Guide in R by A. Kassambara (Datanovia)
Others
- R for Data Science: Import, Tidy, Transform, Visualize, and Model Data by Hadley Wickham & Garrett Grolemund
- Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems by Aurelien Géron
- Practical Statistics for Data Scientists: 50 Essential Concepts by Peter Bruce & Andrew Bruce
- Hands-On Programming with R: Write Your Own Functions And Simulations by Garrett Grolemund & Hadley Wickham
- An Introduction to Statistical Learning: with Applications in R by Gareth James et al.
- Deep Learning with R by François Chollet & J.J. Allaire
- Deep Learning with Python by François Chollet