==31547== Memcheck, a memory error detector ==31547== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==31547== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==31547== Command: /data/blackswan/ripley/R/R-devel-vg/bin/exec/R --vanilla --slave ==31547== > unlink("*.fv?") > unlink("*.txt") > library(DatABEL) DatABEL v.0.9-6 loaded > matr <- matrix(c(1:12), ncol = 3, nrow = 4) > matr[3, 2] <- NA > matr [,1] [,2] [,3] [1,] 1 5 9 [2,] 2 6 10 [3,] 3 NA 11 [4,] 4 8 12 > dimnames(matr) <- list(paste("row", 1:4, sep = ""), + paste("col", 1:3, sep = "")) > matr col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NA 11 row4 4 8 12 > list.files(pattern = "*.fv?") character(0) > dat1 <- as(matr, "databel") ==31547== Syscall param write(buf) points to uninitialised byte(s) ==31547== at 0x730B280: __write_nocancel (in /usr/lib64/libpthread-2.25.so) ==31547== by 0x98601AD: ??? (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x989EBD0: std::basic_filebuf >::_M_convert_to_external(char*, long) (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x989EFDE: std::basic_filebuf >::overflow(int) (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x989ED40: std::basic_filebuf >::_M_terminate_output() (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x989EE7A: std::basic_filebuf >::_M_seek(long, std::_Ios_Seekdir, __mbstate_t) (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x989F2E3: std::basic_filebuf >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode) (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x98C1409: std::ostream::seekp(long, std::_Ios_Seekdir) (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x166DC380: initializeEmptyFile(std::__cxx11::basic_string, std::allocator >, unsigned long, unsigned long, unsigned short, bool) (packages/tests-vg/DatABEL/src/frutil.cpp:120) ==31547== by 0x166B81A7: ini_empty_FileMatrix_R (packages/tests-vg/DatABEL/src/AbstractMatrix_R.cpp:496) ==31547== by 0x498D73: do_dotcall (svn/R-devel/src/main/dotcode.c:1252) ==31547== by 0x4D102E: bcEval (svn/R-devel/src/main/eval.c:7280) ==31547== Address 0x16057942 is 2 bytes inside a block of size 8,192 alloc'd ==31547== at 0x4C2E8B7: operator new[](unsigned long) (/builddir/build/BUILD/valgrind-3.13.0/coregrind/m_replacemalloc/vg_replace_malloc.c:423) ==31547== by 0x989EA87: std::basic_filebuf >::_M_allocate_internal_buffer() (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x98A2C71: std::basic_filebuf >::open(char const*, std::_Ios_Openmode) (in /usr/lib64/libstdc++.so.6.0.24) ==31547== by 0x166DAAD0: open (/usr/include/c++/7/fstream:802) ==31547== by 0x166DAAD0: basic_ofstream (/usr/include/c++/7/fstream:702) ==31547== by 0x166DAAD0: initializeEmptyFile(std::__cxx11::basic_string, std::allocator >, unsigned long, unsigned long, unsigned short, bool) (packages/tests-vg/DatABEL/src/frutil.cpp:107) ==31547== by 0x166B81A7: ini_empty_FileMatrix_R (packages/tests-vg/DatABEL/src/AbstractMatrix_R.cpp:496) ==31547== by 0x498D73: do_dotcall (svn/R-devel/src/main/dotcode.c:1252) ==31547== by 0x4D102E: bcEval (svn/R-devel/src/main/eval.c:7280) ==31547== by 0x4DA96F: Rf_eval (svn/R-devel/src/main/eval.c:624) ==31547== by 0x4DC27E: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==31547== by 0x4D1A0C: bcEval (svn/R-devel/src/main/eval.c:6740) ==31547== by 0x4DA96F: Rf_eval (svn/R-devel/src/main/eval.c:624) ==31547== by 0x4DC27E: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==31547== Uninitialised value was created by a stack allocation ==31547== at 0x166DA35D: initializeEmptyFile(std::__cxx11::basic_string, std::allocator >, unsigned long, unsigned long, unsigned short, bool) (packages/tests-vg/DatABEL/src/frutil.cpp:78) ==31547== coersion from 'matrix' to 'databel' of type DOUBLE ; object connected to file ./tmp319507 > list.files(pattern = "*.fv?") [1] "tmp319507.fvd" "tmp319507.fvi" > dat1 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = ./tmp319507 cachesizeMb = 64 number of columns (variables) = 3 number of rows (observations) = 4 usedRowIndex: 1 2 3 4 usedColIndex: 1 2 3 Upper-left 3 columns and 4 rows: col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NaN 11 row4 4 8 12 > dat2 <- matrix2databel(matr, filename = "matr", cachesizeMb = 16, + type = "UNSIGNED_CHAR", readonly = FALSE) > dat2 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = matr cachesizeMb = 16 number of columns (variables) = 3 number of rows (observations) = 4 usedRowIndex: 1 2 3 4 usedColIndex: 1 2 3 Upper-left 3 columns and 4 rows: col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NaN 11 row4 4 8 12 > list.files(pattern = "*.fv?") [1] "matr.fvd" "matr.fvi" "tmp319507.fvd" "tmp319507.fvi" > dat3 <- databel("matr") > dat3 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = matr cachesizeMb = 64 number of columns (variables) = 3 number of rows (observations) = 4 usedRowIndex: 1 2 3 4 usedColIndex: 1 2 3 Upper-left 3 columns and 4 rows: col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NaN 11 row4 4 8 12 > write.table(matr, "matr.txt", row.names = TRUE, col.names = TRUE, + quote = FALSE) > dat4 <- text2databel("matr.txt", outfile = "matr1", + R_matrix = TRUE, type = "UNSIGNED_INT") Options in effect: --infile = matr.txt --outfile = matr1 --skiprows = 1 --skipcols = 1 --cnrow = ON, using line 1 of 'matr.txt' --rncol = ON, using column 1 of 'matr.txt' --transpose = OFF --Rmatrix = ON --nanString = NA Number of lines in source file is 5 Number of words in source file is 3 skiprows = 1 cnrow = 1 skipcols = 1 rncol = 1 Rmatrix = 1 numWords = 3 Creating file with numRows = 4 Creating file with numColumns = 3 Transposing matr1_fvtmp => matr1. text2fvf finished. > dat4 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = matr1 cachesizeMb = 64 number of columns (variables) = 3 number of rows (observations) = 4 usedRowIndex: 1 2 3 4 usedColIndex: 1 2 3 Upper-left 3 columns and 4 rows: col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NaN 11 row4 4 8 12 > dat5 <- dat4 > dat6 <- dat1[c("row1", "row3"), c("col1", "col2")] > dat6 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = ./tmp319507 cachesizeMb = 64 number of columns (variables) = 2 number of rows (observations) = 2 usedRowIndex: 1 3 usedColIndex: 1 2 Upper-left 2 columns and 2 rows: col1 col2 row1 1 5 row3 3 NaN > dat1[1, 1] <- 321 > dat6 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = ./tmp319507 cachesizeMb = 64 number of columns (variables) = 2 number of rows (observations) = 2 usedRowIndex: 1 3 usedColIndex: 1 2 Upper-left 2 columns and 2 rows: col1 col2 row1 321 5 row3 3 NaN > dim(dat1) [1] 4 3 > length(dat1) [1] 12 > dimnames(dat1) [[1]] [1] "row1" "row2" "row3" "row4" [[2]] [1] "col1" "col2" "col3" > colnames(dat1) [1] "col1" "col2" "col3" > rownames(dat1) [1] "row1" "row2" "row3" "row4" > dimnames(dat1) <- list(paste("ID", 1:4, sep = ""), + paste("SNP", 1:3, sep = "")) > dimnames(dat1) [[1]] [1] "ID1" "ID2" "ID3" "ID4" [[2]] [1] "SNP1" "SNP2" "SNP3" > backingfilename(dat1) [1] "./tmp319507" > cachesizeMb(dat1) [1] 64 > cachesizeMb(dat1) <- 1 > cachesizeMb(dat1) [1] 1 > set_dimnames(dat1) <- list(dimnames(dat1)[[1]], c("duplicate", + "col2", "duplicate")) Warning in uninames(x@data) : uninames: some column names are not unique; use set_dimnames/get_dimnames for non-unique row/col names > dimnames(dat1) [[1]] [1] "ID1" "ID2" "ID3" "ID4" [[2]] NULL > get_dimnames(dat1) [[1]] [1] "ID1" "ID2" "ID3" "ID4" [[2]] [1] "duplicate" "col2" "duplicate" > disconnect(dat1) > setReadOnly(dat6) <- FALSE > dat6[1, 1] <- 123 > dat6 uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = ./tmp319507 cachesizeMb = 64 number of columns (variables) = 2 number of rows (observations) = 2 usedRowIndex: 1 3 usedColIndex: 1 2 Upper-left 2 columns and 2 rows: duplicate col2 ID1 123 5 ID3 3 NaN > dat1 Warning in uninames(.Object@data) : uninames: some column names are not unique; use set_dimnames/get_dimnames for non-unique row/col names uninames$unique.names = FALSE uninames$unique.rownames = TRUE uninames$unique.colnames = FALSE backingfilename = ./tmp319507 cachesizeMb = 1 number of columns (variables) = 3 number of rows (observations) = 4 usedRowIndex: 1 2 3 4 usedColIndex: 1 2 3 Upper-left 3 columns and 4 rows: Warning in uninames(out@data) : uninames: some column names are not unique; use set_dimnames/get_dimnames for non-unique row/col names [,1] [,2] [,3] ID1 123 5 9 ID2 2 6 10 ID3 3 NaN 11 ID4 4 8 12 > newm <- as(dat2, "matrix") > class(newm) [1] "matrix" > class(newm[1, 1]) [1] "numeric" > newm col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NaN 11 row4 4 8 12 > databel2text(dat2, file = "dat2.txt") uninames$unique.names = TRUE uninames$unique.rownames = TRUE uninames$unique.colnames = TRUE backingfilename = matr cachesizeMb = 16 number of columns (variables) = 3 number of rows (observations) = 4 usedRowIndex: 1 2 3 4 usedColIndex: 1 2 3 Upper-left 3 columns and 4 rows: col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NaN 11 row4 4 8 12 > read.table("dat2.txt") col1 col2 col3 row1 1 5 9 row2 2 6 10 row3 3 NA 11 row4 4 8 12 > apply2dfo(SNP, dfodata = dat2, anFUN = "sum", MAR = 2) [,1] col1 10 col2 NaN col3 42 > apply2dfo(SNP, dfodata = dat2, anFUN = "sum", MAR = 1) [,1] row1 15 row2 18 row3 NaN row4 24 > apply2dfo(SNP^2, dfodata = dat2, anFUN = "sum", MAR = 2) [,1] col1 30 col2 NaN col3 446 > Y <- rnorm(4) > apply2dfo(Y ~ SNP, dfodata = dat2, anFUN = "lm", MAR = 2) Estimate Std. Error Pr(>|t|) col1 0.3298268 0.077693234 0.051258513 col2 0.3004820 0.004248917 0.009001417 col3 0.3298268 0.077693234 0.051258513 > apply2dfo(Y ~ SNP + I(SNP^2), dfodata = dat2, anFUN = "lm", + MAR = 2) Estimate Std. Error Pr(>|t|) col1_SNP 0.715034949 0.48600798 0.3800431 col1_I(SNP^2) -0.077041625 0.09568273 0.5684416 col2_SNP 0.375710845 NaN NaN col2_I(SNP^2) -0.005723931 NaN NaN col3_SNP 1.947700957 2.01115899 0.5102037 col3_I(SNP^2) -0.077041625 0.09568273 0.5684416 > rm(list = ls()) > gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 434688 23.3 866695 46.3 730690 39.1 Vcells 808040 6.2 8388608 64.0 1743053 13.3 > unlink("*.fv?") > unlink("*.txt") *** Run successfully completed *** > proc.time() user system elapsed 35.978 0.383 35.364 ==31547== ==31547== HEAP SUMMARY: ==31547== in use at exit: 52,303,690 bytes in 10,730 blocks ==31547== total heap usage: 80,218 allocs, 69,488 frees, 144,844,666 bytes allocated ==31547== ==31547== LEAK SUMMARY: ==31547== definitely lost: 0 bytes in 0 blocks ==31547== indirectly lost: 0 bytes in 0 blocks ==31547== possibly lost: 0 bytes in 0 blocks ==31547== still reachable: 52,303,690 bytes in 10,730 blocks ==31547== suppressed: 0 bytes in 0 blocks ==31547== Reachable blocks (those to which a pointer was found) are not shown. ==31547== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==31547== ==31547== For counts of detected and suppressed errors, rerun with: -v ==31547== ERROR SUMMARY: 6 errors from 1 contexts (suppressed: 0 from 0)