Al-Murphy / MungeSumstats

Rapid standardisation and quality control of GWAS or QTL summary statistics
https://doi.org/doi:10.18129/B9.bioc.MungeSumstats
75 stars 16 forks source link

Warning in readLines(infile) : incomplete final line found #40

Closed bschilder closed 3 years ago

bschilder commented 3 years ago
Warning in readLines(infile) :
  incomplete final line found on '/Users/schilder/Desktop/MungeSumstats/tests/testthat/test-info_filter.R'
Warning in readLines(infile) :
  incomplete final line found on '/Users/schilder/Desktop/MungeSumstats/tests/testthat/test-strand_ambig.R'
bschilder commented 3 years ago

Note sure what's wrong with this:

test_that("Filter SNPs where INFO<0.9", {
  file <- tempfile()
  #write the Educational Attainment GWAS to a temp file for testing
  eduAttainOkbay <- readLines(system.file("extdata","eduAttainOkbay.txt",
                                          package="MungeSumstats"))
  writeLines(eduAttainOkbay,con = file)
  #read it in and make N
  sumstats_dt <- data.table::fread(file, nThread = 1)
  #Add N column and make it not an integer
  set.seed(101)
  sumstats_dt[,INFO:=runif(nrow(sumstats_dt))*2]
  #get SNPs with INFO<0.9
  rmv_snps <- sumstats_dt[INFO<0.9,]$MarkerName
  data.table::fwrite(x=sumstats_dt, file=file, sep="\t")
  #Run MungeSumstats code
  reformatted <- MungeSumstats::format_sumstats(file,ref_genome="GRCh37",
                                                INFO_filter = 0.9,
                                                on_ref_genome = FALSE,
                                                strand_ambig_filter=FALSE,
                                                bi_allelic_filter=FALSE,
                                                allele_flip_check=FALSE)
  res_dt <- data.table::fread(reformatted, nThread = 1)
  testthat::expect_equal(all(!rmv_snps %in% res_dt$SNP),TRUE)
})
bschilder commented 3 years ago

I think these were just missing an extra empty line after the function 🤷

Fixed.