R version 2.11.1 (2010-05-31) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # 19 October 2010 > # From Mark Robinson, 18 October 2010 > #install.packages("Repitools",repos="http://r-forge.r-project.org",type="source") > #source("http://bioconductor.org/biocLite.R") > #biocLite("Rsamtools") 1.2.0 > #biocLite("BSgenome.Hsapiens.UCSC.hg18") 834 M > > # load packages > library(Rsamtools) Loading required package: IRanges Attaching package: 'IRanges' The following object(s) are masked from 'package:base': cbind, Map, mapply, order, paste, pmax, pmax.int, pmin, pmin.int, rbind, rep.int, table Loading required package: GenomicRanges Loading required package: Biostrings > library(Repitools) Loading required package: R.methodsS3 R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See ?R.methodsS3 for help. Loading required package: BSgenome > library(BSgenome.Hsapiens.UCSC.hg18) > > > # some parameter settings > p <- ScanBamParam(what=c("rname", "strand", "pos"), + flag=scanBamFlag(isUnmappedQuery=FALSE,isDuplicate=FALSE)) > windowSize <- 1000 > fragSize <- 200 > rdlen <- c(50,75) # vector to match filenames > chrNames <- paste("chr", c(1:22, "X", "Y"), sep = "") > > # file names (here, BAM format) --> list of GRanges > # HS1238 is 50 bp, HS1235 is 75 bp, both are SE reads > fn <- c("/projects/remc_bigdata/Karsan/HS1238_kd/maq2sam/HS1238.h.sorted.bam", + "/projects/remc_bigdata/Karsan/HS1235_ctl/maq2sam/HS1235.h.sorted.bam") > gr <- lapply(fn, FUN=function(u,v) { + sb <- scanBam(u, param=p)[[1]] + GRanges(seqnames=sb$rname, ranges=IRanges(start=sb$pos,width=v), + strand=sb$strand) + },fn,rdlen) Error in FUN(c("/projects/remc_bigdata/Karsan/HS1238_kd/maq2sam/HS1238.h.sorted.bam", : unused argument(s) (c(50, 75)) Calls: lapply -> lapply -> FUN Execution halted