==30619== Memcheck, a memory error detector ==30619== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==30619== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==30619== Command: /data/blackswan/ripley/R/R-devel-vg/bin/exec/R --vanilla ==30619== R Under development (unstable) (2018-05-04 r74695) -- "Unsuffered Consequences" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > pkgname <- "DatABEL" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('DatABEL') DatABEL v.0.9-6 loaded > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("apply2dfo") > ### * apply2dfo > > flush(stderr()); flush(stdout()) > > ### Name: apply2dfo > ### Title: applies a function to a 'databel' object > ### Aliases: apply2dfo > > ### ** Examples > > a <- matrix(rnorm(50), 10, 5) > rownames(a) <- paste("id", 1:10, sep="") > colnames(a) <- paste("snp", 1:5, sep="") > b <- as(a, "databel") ==30619== Syscall param write(buf) points to uninitialised byte(s) ==30619== at 0x730B280: __write_nocancel (in /usr/lib64/libpthread-2.25.so) ==30619== by 0x98601AD: ??? (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x989EBD0: std::basic_filebuf >::_M_convert_to_external(char*, long) (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x989EFDE: std::basic_filebuf >::overflow(int) (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x989ED40: std::basic_filebuf >::_M_terminate_output() (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x989EE7A: std::basic_filebuf >::_M_seek(long, std::_Ios_Seekdir, __mbstate_t) (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x989F2E3: std::basic_filebuf >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode) (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x98C1409: std::ostream::seekp(long, std::_Ios_Seekdir) (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x158C6380: initializeEmptyFile(std::__cxx11::basic_string, std::allocator >, unsigned long, unsigned long, unsigned short, bool) (packages/tests-vg/DatABEL/src/frutil.cpp:120) ==30619== by 0x158A21A7: ini_empty_FileMatrix_R (packages/tests-vg/DatABEL/src/AbstractMatrix_R.cpp:496) ==30619== by 0x498D73: do_dotcall (svn/R-devel/src/main/dotcode.c:1252) ==30619== by 0x4D102E: bcEval (svn/R-devel/src/main/eval.c:7280) ==30619== Address 0x11cb2172 is 2 bytes inside a block of size 8,192 alloc'd ==30619== at 0x4C2E8B7: operator new[](unsigned long) (/builddir/build/BUILD/valgrind-3.13.0/coregrind/m_replacemalloc/vg_replace_malloc.c:423) ==30619== by 0x989EA87: std::basic_filebuf >::_M_allocate_internal_buffer() (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x98A2C71: std::basic_filebuf >::open(char const*, std::_Ios_Openmode) (in /usr/lib64/libstdc++.so.6.0.24) ==30619== by 0x158C4AD0: open (/usr/include/c++/7/fstream:802) ==30619== by 0x158C4AD0: basic_ofstream (/usr/include/c++/7/fstream:702) ==30619== by 0x158C4AD0: initializeEmptyFile(std::__cxx11::basic_string, std::allocator >, unsigned long, unsigned long, unsigned short, bool) (packages/tests-vg/DatABEL/src/frutil.cpp:107) ==30619== by 0x158A21A7: ini_empty_FileMatrix_R (packages/tests-vg/DatABEL/src/AbstractMatrix_R.cpp:496) ==30619== by 0x498D73: do_dotcall (svn/R-devel/src/main/dotcode.c:1252) ==30619== by 0x4D102E: bcEval (svn/R-devel/src/main/eval.c:7280) ==30619== by 0x4DA96F: Rf_eval (svn/R-devel/src/main/eval.c:624) ==30619== by 0x4DC27E: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==30619== by 0x4D1A0C: bcEval (svn/R-devel/src/main/eval.c:6740) ==30619== by 0x4DA96F: Rf_eval (svn/R-devel/src/main/eval.c:624) ==30619== by 0x4DC27E: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==30619== Uninitialised value was created by a stack allocation ==30619== at 0x158C435D: initializeEmptyFile(std::__cxx11::basic_string, std::allocator >, unsigned long, unsigned long, unsigned short, bool) (packages/tests-vg/DatABEL/src/frutil.cpp:78) ==30619== coersion from 'matrix' to 'databel' of type DOUBLE ; object connected to file ./tmp658177 > apply(a, FUN="sum", MAR=2) snp1 snp2 snp3 snp4 snp5 1.322028 2.488450 -1.336732 1.207302 1.341367 > apply2dfo(SNP, dfodata=b, anFUN="sum") [,1] snp1 1.322028 snp2 2.488450 snp3 -1.336732 snp4 1.207302 snp5 1.341367 > tA <- apply2dfo(SNP, dfodata=b, anFUN="sum", + outclass="databel", outfile="tmpA") > tA uninames$unique.names = FALSE uninames$unique.rownames = TRUE uninames$unique.colnames = FALSE backingfilename = tmpA cachesizeMb = 64 number of columns (variables) = 1 number of rows (observations) = 5 usedRowIndex: 1 2 3 4 5 usedColIndex: 1 Upper-left 1 columns and 5 rows: [,1] snp1 1.322028 snp2 2.488450 snp3 -1.336732 snp4 1.207302 snp5 1.341367 > as(tA, "matrix") [,1] snp1 1.322028 snp2 2.488450 snp3 -1.336732 snp4 1.207302 snp5 1.341367 > apply2dfo(SNP, dfodata=b, anFUN="sum", transpose=FALSE) snp1 snp2 snp3 snp4 snp5 [1,] 1.322028 2.48845 -1.336732 1.207302 1.341367 > tB <- apply2dfo(SNP, dfodata=b, anFUN="sum", transpose=FALSE, + outclass="databel", outfile="tmpB") > tB uninames$unique.names = FALSE uninames$unique.rownames = FALSE uninames$unique.colnames = TRUE backingfilename = tmpB cachesizeMb = 64 number of columns (variables) = 5 number of rows (observations) = 1 usedRowIndex: 1 usedColIndex: 1 2 3 4 5 Upper-left 5 columns and 1 rows: snp1 snp2 snp3 snp4 snp5 [1,] 1.322028 2.48845 -1.336732 1.207302 1.341367 > as(tB, "matrix") snp1 snp2 snp3 snp4 snp5 [1,] 1.322028 2.48845 -1.336732 1.207302 1.341367 > > sex <- 1*(runif(10)>.5) > trait <- rnorm(10) + sex + as(b[, 2], "vector") + + as(b[, 2], "vector") * sex * 5 > apply2dfo(trait~SNP*sex, dfodata=b, anFUN="lm") Estimate Std. Error Pr(>|t|) snp1_SNP -0.6932634 5.7042874 0.9072364015 snp1_SNP:sex -2.2196895 6.7296109 0.7527328081 snp2_SNP 1.7059053 0.4948363 0.0136762190 snp2_SNP:sex 4.7334205 0.5580311 0.0001468253 snp3_SNP 2.0551360 6.4789765 0.7618388816 snp3_SNP:sex 1.5840724 7.2014428 0.8331906744 snp4_SNP 0.4487702 3.1564655 0.8915958054 snp4_SNP:sex 7.8433170 6.8971143 0.2988262240 snp5_SNP -1.1806830 8.0423660 0.8880922692 snp5_SNP:sex -0.7070180 12.0944403 0.9552820516 > tC <- apply2dfo(trait ~ SNP * sex, dfodata=b, anFUN="lm", + outclass="databel", outfile="tmpC") > tC uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = tmpC cachesizeMb = 64 number of columns (variables) = 3 number of rows (observations) = 10 usedRowIndex: 1 2 3 4 5 ... usedColIndex: 1 2 3 Upper-left 3 columns and 5 rows: Estimate Std. Error Pr(>|t|) snp1_SNP -0.6932634 5.7042874 0.9072364015 snp1_SNP:sex -2.2196895 6.7296109 0.7527328081 snp2_SNP 1.7059053 0.4948363 0.0136762190 snp2_SNP:sex 4.7334205 0.5580311 0.0001468253 snp3_SNP 2.0551360 6.4789765 0.7618388816 > as(tC, "matrix") Estimate Std. Error Pr(>|t|) snp1_SNP -0.6932634 5.7042874 0.9072364015 snp1_SNP:sex -2.2196895 6.7296109 0.7527328081 snp2_SNP 1.7059053 0.4948363 0.0136762190 snp2_SNP:sex 4.7334205 0.5580311 0.0001468253 snp3_SNP 2.0551360 6.4789765 0.7618388816 snp3_SNP:sex 1.5840724 7.2014428 0.8331906744 snp4_SNP 0.4487702 3.1564655 0.8915958054 snp4_SNP:sex 7.8433170 6.8971143 0.2988262240 snp5_SNP -1.1806830 8.0423660 0.8880922692 snp5_SNP:sex -0.7070180 12.0944403 0.9552820516 > apply2dfo(trait ~ SNP * sex, dfodata=b, anFUN="lm", transpose=FALSE) snp1_SNP snp1_SNP:sex snp2_SNP snp2_SNP:sex snp3_SNP snp3_SNP:sex Estimate -0.6932634 6.7296109 1.7059053 0.5580311474 2.055136 7.2014428 Std. Error -2.2196895 0.9072364 4.7334205 0.0136762190 1.584072 0.7618389 Pr(>|t|) 5.7042874 0.7527328 0.4948363 0.0001468253 6.478976 0.8331907 snp4_SNP snp4_SNP:sex snp5_SNP snp5_SNP:sex Estimate 0.4487702 6.8971143 -1.180683 12.0944403 Std. Error 7.8433170 0.8915958 -0.707018 0.8880923 Pr(>|t|) 3.1564655 0.2988262 8.042366 0.9552821 > tD <- apply2dfo(trait ~ SNP * sex, dfodata=b, anFUN="lm", + transpose=FALSE, outclass="databel", outfile="tmpD") > tD uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = tmpD cachesizeMb = 64 number of columns (variables) = 10 number of rows (observations) = 3 usedRowIndex: 1 2 3 usedColIndex: 1 2 3 4 5 6 7 8 9 10 Upper-left 10 columns and 3 rows: snp1_SNP snp1_SNP:sex snp2_SNP snp2_SNP:sex snp3_SNP snp3_SNP:sex Estimate -0.6932634 6.7296109 1.7059053 0.5580311474 2.055136 7.2014428 Std. Error -2.2196895 0.9072364 4.7334205 0.0136762190 1.584072 0.7618389 Pr(>|t|) 5.7042874 0.7527328 0.4948363 0.0001468253 6.478976 0.8331907 snp4_SNP snp4_SNP:sex snp5_SNP snp5_SNP:sex Estimate 0.4487702 6.8971143 -1.180683 12.0944403 Std. Error 7.8433170 0.8915958 -0.707018 0.8880923 Pr(>|t|) 3.1564655 0.2988262 8.042366 0.9552821 > as(tD, "matrix") snp1_SNP snp1_SNP:sex snp2_SNP snp2_SNP:sex snp3_SNP snp3_SNP:sex Estimate -0.6932634 6.7296109 1.7059053 0.5580311474 2.055136 7.2014428 Std. Error -2.2196895 0.9072364 4.7334205 0.0136762190 1.584072 0.7618389 Pr(>|t|) 5.7042874 0.7527328 0.4948363 0.0001468253 6.478976 0.8331907 snp4_SNP snp4_SNP:sex snp5_SNP snp5_SNP:sex Estimate 0.4487702 6.8971143 -1.180683 12.0944403 Std. Error 7.8433170 0.8915958 -0.707018 0.8880923 Pr(>|t|) 3.1564655 0.2988262 8.042366 0.9552821 > rm(tA, tB, tC, tD) > gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 400044 21.4 831081 44.4 623802 33.4 Vcells 752198 5.8 8388608 64.0 1743028 13.3 > unlink("tmp*") > > > > cleanEx() > nameEx("process_lm_output") > ### * process_lm_output > > flush(stderr()); flush(stdout()) > > ### Name: process_lm_output > ### Title: 'apply2dfo'-associated functions > ### Aliases: process_lm_output process_simple_output sum_NA sum_not_NA > > ### ** Examples > > a <- matrix(rnorm(50),10,5) > rownames(a) <- paste("id",1:10,sep="") > colnames(a) <- paste("snp",1:5,sep="") > b <- as(a,"databel") coersion from 'matrix' to 'databel' of type DOUBLE ; object connected to file ./tmp658177 > apply(a,FUN="sum",MAR=2) snp1 snp2 snp3 snp4 snp5 1.322028 2.488450 -1.336732 1.207302 1.341367 > apply2dfo(SNP,dfodata=b,anFUN="sum",procFUN="process_simple_output") [,1] snp1 0 snp2 0 snp3 0 snp4 0 snp5 0 > apply2dfo(SNP,dfodata=b,anFUN="sum",transpose=FALSE) snp1 snp2 snp3 snp4 snp5 [1,] 0 0 0 0 0 > > sex <- 1*(runif(10)>.5) > trait <- rnorm(10)+sex+as(b[,2],"vector")+as(b[,2],"vector")*sex*5 > apply2dfo(trait~SNP*sex,dfodata=b,anFUN="lm",procFUN="process_lm_output") Estimate Std. Error Pr(>|t|) snp1_SNP 0.1942601 0.5104985 0.713457 snp1_SNP:sex NA NA NA snp2_SNP 0.1942601 0.5104985 0.713457 snp2_SNP:sex NA NA NA snp3_SNP 0.1942601 0.5104985 0.713457 snp3_SNP:sex NA NA NA snp4_SNP 0.1942601 0.5104985 0.713457 snp4_SNP:sex NA NA NA snp5_SNP 0.1942601 0.5104985 0.713457 snp5_SNP:sex NA NA NA > > > > cleanEx() > nameEx("text2databel") > ### * text2databel > > flush(stderr()); flush(stdout()) > > ### Name: text2databel > ### Title: converts text file to filevector format > ### Aliases: text2databel > > ### ** Examples > > cat("this is an example which you can run if you can write to the + file system\n") this is an example which you can run if you can write to the file system > > ## Not run: > ##D > ##D # create matrix > ##D NC <- 5 > ##D NR <- 10 > ##D data <- matrix(rnorm(NC*NR),ncol=NC,nrow=NR) > ##D rownames(data) <- paste("r",1:NR,sep="") > ##D colnames(data) <- paste("c",1:NC,sep="") > ##D data > ##D > ##D # create text files > ##D write.table(data, file="test_matrix_dimnames.dat", row.names=TRUE, > ##D col.names=TRUE, quote=FALSE) > ##D write.table(data, file="test_matrix_colnames.dat", row.names=FALSE, > ##D col.names=TRUE, quote=FALSE) > ##D write.table(data, file="test_matrix_rownames.dat", row.names=TRUE, > ##D col.names=FALSE, quote=FALSE) > ##D write.table(data, file="test_matrix_NOnames.dat", row.names=FALSE, > ##D col.names=FALSE, quote=FALSE) > ##D write(colnames(data), file="test_matrix.colnames") > ##D write(rownames(data), file="test_matrix.rownames") > ##D > ##D # generate identical data > ##D text2databel(infile="test_matrix_dimnames.dat", > ##D outfile="test_matrix_dimnames", R_matrix=TRUE) > ##D x <- databel("test_matrix_dimnames") > ##D data <- as(x, "matrix") > ##D data > ##D > ##D # convert text two filevector format > ##D > ##D text2databel(infile="test_matrix_NOnames.dat", > ##D outfile="test_matrix_NOnames.fvf", > ##D colnames="test_matrix.colnames", > ##D rownames="test_matrix.rownames") > ##D x <- databel("test_matrix_NOnames.fvf") > ##D if (!identical(data, as(x, "matrix"))) stop("not identical data") > ##D > ##D text2databel(infile="test_matrix_NOnames.dat", > ##D outfile="test_matrix_NOnames_T.fvf", > ##D colnames="test_matrix.colnames", > ##D rownames="test_matrix.rownames", transpose=TRUE) > ##D x <- databel("test_matrix_NOnames_T.fvf") > ##D if (!identical(data, t(as(x, "matrix")))) stop("not identical data") > ##D > ##D text2databel(infile="test_matrix_rownames.dat", > ##D outfile="test_matrix_rownames.fvf", > ##D rownames=1, colnames="test_matrix.colnames") > ##D x <- databel("test_matrix_rownames.fvf") > ##D if (!identical(data, as(x, "matrix"))) stop("not identical data") > ##D > ##D text2databel(infile="test_matrix_colnames.dat", > ##D outfile="test_matrix_colnames.fvf", > ##D colnames=1, rownames="test_matrix.rownames") > ##D x <- databel("test_matrix_colnames.fvf") > ##D if (!identical(data, as(x, "matrix"))) stop("not identical data") > ##D > ##D text2databel(infile="test_matrix_dimnames.dat", > ##D outfile="test_matrix_dimnames.fvf", R_matrix=TRUE) > ##D x <- databel("test_matrix_dimnames.fvf") > ##D if (!identical(data, as(x, "matrix"))) stop("not identical data") > ##D > ##D # stupid extended matrix in non-R format > ##D newmat <- matrix(-100, ncol=NC+3, nr=NR+2) > ##D newmat[3:(NR+2), 4:(NC+3)] <- data > ##D newmat[2, 4:(NC+3)] <- paste("c", 1:NC, sep="") > ##D newmat[3:(NR+2), 3] <- paste("r", 1:NR, sep="") > ##D newmat > ##D write.table(newmat, file="test_matrix_strange.dat", > ##D col.names=FALSE, row.names=FALSE, quote=FALSE) > ##D > ##D text2databel(infile="test_matrix_strange.dat", > ##D outfile="test_matrix_strange.fvf", > ##D colnames=2, rownames=3) > ##D x <- databel("test_matrix_strange.fvf") > ##D if (!identical(data, as(x, "matrix"))) stop("not identical data") > ##D > ## End(Not run) > > > > ### *