if(file.exists('SRAmetadb.sqlite')) {
library(SRAdb)
sra_dbname <- 'SRAmetadb.sqlite'
sra_con <- dbConnect(dbDriver("SQLite"), sra_dbname)
## Get column descriptions
a <- colDescriptions(sra_con=sra_con)[1:5,]
## Convert SRA experiment accessions to other types
b <- sraConvert( in_acc=c(" SRR000137", "SRR000138 "), out_type=c('sample'), sra_con=sra_con )
## Fulltext search SRA meta data using SQLite fts3 module
rs <- getSRA (search_terms ='breas* NEAR/2 can*', out_types=c('run','study'), sra_con=sra_con)
rs <- getSRA (search_terms ='breast', out_types=c('run','study'), sra_con=sra_con)
rs <- getSRA (search_terms ='"breas* can*"', out_types=c('study'), sra_con=sra_con)
rs <- getSRA (search_terms ='MCF7 OR "MCF-7"', out_types=c('sample'), sra_con=sra_con)
rs <- getSRA (search_terms ='study_title: brea* can*', out_types=c('run','study'), sra_con=sra_con)
rs <- getSRA (search_terms ='study_title: brea* can*', out_types=c('run','study'), sra_con=sra_con, acc_only=TRUE)
## List fastq file ftp or fasp addresses associated with "SRX000122"
listSRAfile (in_acc = c("SRX000122"), sra_con = sra_con, fileType = 'sra')
listSRAfile (in_acc = c("SRX000122"), sra_con = sra_con, fileType = 'sra', srcType='fasp')
## Get file size and date from NCBI ftp site for available fastq files associated with "SRS012041","SRS000290"
## Not run:
# getSRAinfo (in_acc=c("SRS012041","SRS000290"), sra_con=sra_con, sraType='sra')
# ## End(Not run)
## Download sra files from NCBI SRA using ftp protocol:
getSRAfile( in_acc = c("SRR000648","SRR000657"), sra_con = sra_con, destDir = getwd(), fileType = 'sra' )
## Download fastq files from EBI using ftp protocol:
getSRAfile( in_acc, sra_con, destDir = getwd(), fileType = 'fastq', srcType = 'ftp', makeDirectory = FALSE, method = 'curl', ascpCMD = NULL )
## Download fastq files from EBI ftp siteusing fasp protocol:
## Not run:
# ascpCMD <- 'ascp -QT -l 300m -i /usr/local/aspera/connect/etc/asperaweb_id_dsa.putty'
# getSRAfile( in_acc, sra_con, fileType = 'fastq', srcType = 'fasp', ascpCMD = ascpCMD )## End(Not run)
## Start IGV from R if no IGV running
## Not run: startIGV(memory='mm')
## load BAM files to IGV
## Not run:
# exampleBams = file.path(system.file('extdata',package='SRAdb'), dir(system.file('extdata',package='SRAdb'),pattern='bam$'))
# sock <- IGVsocket()
# IGVload(sock,exampleBams)
# ## End(Not run)
## Change the IGV genome
## Not run:
# IGVgenome(sock,genome='hg18')
# ## End(Not run)
## Go to a specified region in IGV
## Not run:
# IGVgoto(sock,'chr1:1-10000')
# IGVgoto(sock,'TP53')
# ## End(Not run)
## Make a snapshot of the current IGV window
## Not run:
# IGVsnapshot(sock)
# dir()
# ## End(Not run)
## create a graphNEL object from SRA accessions, which are full text search results of terms 'primary thyroid cell line'
g <- sraGraph('primary thyroid cell line', sra_con)
## Not run:
# library(Rgraphviz)
# attrs <- getDefaultAttrs(list(node=list(fillcolor='lightblue', shape='ellipse')))
# plot(g, attrs=attrs)
# ## End(Not run)
dbDisconnect(sra_con)
} else {
print("use getSRAdbFile() to get a copy of the SRAmetadb.sqlite file
and then rerun the example")
}
Run the code above in your browser using DataLab