importBedToMongo: arrange import to mongo using mongoimport, setting up type...

Description Usage Arguments Value Examples

View source: R/importBedToMongo.R

Description

arrange import to mongo using mongoimport, setting up type and fields appropriately

Usage

1
2
3
4
5
6
7
8
importBedToMongo(
  path,
  collectionName,
  bedType = "narrowPeak",
  dbname = "db",
  importCmd = "mongoimport",
  host = "127.0.0.1"
)

Arguments

path

path to bed file (not compressed)

collectionName

name to use in mongodb

bedType

one of 'narrowPeak', 'broadPeak', 'chromHMM': contact developers for other types if desired

dbname

mongodb database name, used directly with system2('mongoimort ...')

importCmd

how to invoke 'mongoimport', default is to assume it can be found in PATH

host

host identifier for mongoimport, defaults to 127.0.0.1

Value

if error encountered, return the try-error content, otherwise TRUE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
f1 = dir(system.file('bedfiles', package='TxRegInfra2'), full=TRUE, patt='ENCFF971VCD')
f2 = dir(system.file('bedfiles', package='TxRegInfra2'), full=TRUE, patt='E096_imp12')
if (verifyHasMongoCmd('mongoimport')) {
chk1 = importBedToMongo(f1, 'vjc1', db='txregnet')
stopifnot(chk1)
chk2 = importBedToMongo(f2, 'vjc2', db='txregnet', bedType='chromHMM')
stopifnot(chk2)
system2("mongo", args=c("txregnet", "--eval", "'db.vjc1.remove({})'")) 
system2("mongo", args=c("txregnet", "--eval", "'db.vjc2.remove({})'"))
}

vjcitn/TxRegInfra2 documentation built on Jan. 1, 2021, 12:41 p.m.