{"action":"created","issue":{"url":"https://api.github.com/repos/privefl/bigsnpr/issues/10","repository_url":"https://api.github.com/repos/privefl/bigsnpr","labels_url":"https://api.github.com/repos/privefl/bigsnpr/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/privefl/bigsnpr/issues/10/comments","events_url":"https://api.github.com/repos/privefl/bigsnpr/issues/10/events","html_url":"https://github.com/privefl/bigsnpr/issues/10","id":356848515,"node_id":"MDU6SXNzdWUzNTY4NDg1MTU=","number":10,"title":"Error in subset.default(infos, pNA > 0.001): object 'pNA' not found","user":{"login":"moldach","id":5749465,"node_id":"MDQ6VXNlcjU3NDk0NjU=","avatar_url":"https://avatars1.githubusercontent.com/u/5749465?v=4","gravatar_id":"","url":"https://api.github.com/users/moldach","html_url":"https://github.com/moldach","followers_url":"https://api.github.com/users/moldach/followers","following_url":"https://api.github.com/users/moldach/following{/other_user}","gists_url":"https://api.github.com/users/moldach/gists{/gist_id}","starred_url":"https://api.github.com/users/moldach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moldach/subscriptions","organizations_url":"https://api.github.com/users/moldach/orgs","repos_url":"https://api.github.com/users/moldach/repos","events_url":"https://api.github.com/users/moldach/events{/privacy}","received_events_url":"https://api.github.com/users/moldach/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-04T14:54:50Z","updated_at":"2018-09-06T14:56:03Z","closed_at":null,"author_association":"NONE","body":"I'm having some trouble with the \"preprocessing\" script and not able to generate the plot at the end. \r\n\r\nI'm using my own data, loading in .ped and .map files and converting them with `snp_plinkQC()` and `snp_plinkIBDQC()`.\r\n\r\n``plink <- download_plink()``\r\n``NCORES <- nb_cores()``\r\n``technoQC.bed <- snp_plinkQC(prefix.in = \"data/technoTeens\",\r\nplink.path = plink,\r\nfile.type = \"--file\", # ped/map\r\ngeno = 0.05,\r\nmind = 0.05,\r\nmaf = 0.05,\r\nhwe = 1e-10,\r\nautosome.only = TRUE\r\n)``\r\n\r\nPLINK v1.90b6.4 64-bit (7 Aug 2018)            www.cog-genomics.org/plink/1.9/\r\n(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3\r\nLogging to data/technoTeens_QC.log.\r\nOptions in effect:\r\n  --autosome\r\n  --file data/technoTeens\r\n  --geno 0.05\r\n  --hwe 1e-10\r\n  --maf 0.05\r\n  --make-bed\r\n  --mind 0.05\r\n  --out data/technoTeens_QC\r\n\r\n257658 MB RAM detected; reserving 128829 MB for main workspace.\r\nAllocated 96621 MB successfully, after larger attempt(s) failed.\r\n.ped scan complete (for binary autoconversion).\r\nPerforming single-pass .bed write (669934 variants, 423 people).\r\n--file: data/technoTeens_QC-temporary.bed + data/technoTeens_QC-temporary.bim +\r\ndata/technoTeens_QC-temporary.fam written.\r\n669934 variants loaded from .bim file.\r\n423 people (0 males, 0 females, 423 ambiguous) loaded from .fam.\r\nAmbiguous sex IDs written to data/technoTeens_QC.nosex .\r\n1 person removed due to missing genotype data (--mind).\r\nID written to data/technoTeens_QC.irem .\r\nUsing 1 thread (no multithreaded calculations invoked).\r\nBefore main variant filters, 422 founders and 0 nonfounders present.\r\nCalculating allele frequencies... done.\r\nTotal genotyping rate in remaining samples is 0.992935.\r\n8604 variants removed due to missing genotype data (--geno).\r\n--hwe: 2294 variants removed due to Hardy-Weinberg exact test.\r\n338458 variants removed due to minor allele threshold(s)\r\n(--maf/--max-maf/--mac/--max-mac).\r\n320578 variants and 422 people pass filters and QC.\r\nNote: No phenotypes present.\r\n--make-bed to data/technoTeens_QC.bed + data/technoTeens_QC.bim +\r\ndata/technoTeens_QC.fam ... done.\r\n\r\n``technoQC2.bed <- snp_plinkIBDQC(\r\n     bedfile.in = technoQC.bed, \r\n     plink.path = plink, \r\n     ncores = NCORES\r\n)``\r\nPLINK v1.90b6.4 64-bit (7 Aug 2018)            www.cog-genomics.org/plink/1.9/\r\n(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3\r\nLogging to /tmp/Rtmpg7a6zA/file6adc6e7d579f.log.\r\nOptions in effect:\r\n  --bfile data/technoTeens_QC\r\n  --indep-pairwise 100 1 0.2\r\n  --out /tmp/Rtmpg7a6zA/file6adc6e7d579f\r\n\r\n257658 MB RAM detected; reserving 128829 MB for main workspace.\r\nAllocated 96621 MB successfully, after larger attempt(s) failed.\r\n320578 variants loaded from .bim file.\r\n422 people (0 males, 0 females, 422 ambiguous) loaded from .fam.\r\nAmbiguous sex IDs written to /tmp/Rtmpg7a6zA/file6adc6e7d579f.nosex .\r\nUsing 1 thread (no multithreaded calculations invoked).\r\nBefore main variant filters, 422 founders and 0 nonfounders present.\r\nCalculating allele frequencies... done.\r\nTotal genotyping rate is 0.997882.\r\n320578 variants and 422 people pass filters and QC.\r\nNote: No phenotypes present.\r\nPruned 13777 variants from chromosome 1, leaving 11023.\r\nPruned 15056 variants from chromosome 2, leaving 10855.\r\nPruned 12506 variants from chromosome 3, leaving 9649.\r\nPruned 11249 variants from chromosome 4, leaving 8904.\r\nPruned 10497 variants from chromosome 5, leaving 8289.\r\nPruned 16064 variants from chromosome 6, leaving 8472.\r\nPruned 10190 variants from chromosome 7, leaving 7938.\r\nPruned 9629 variants from chromosome 8, leaving 7051.\r\nPruned 7762 variants from chromosome 9, leaving 6492.\r\nPruned 8934 variants from chromosome 10, leaving 7148.\r\nPruned 8982 variants from chromosome 11, leaving 6730.\r\nPruned 8438 variants from chromosome 12, leaving 6958.\r\nPruned 6310 variants from chromosome 13, leaving 5307.\r\nPruned 5699 variants from chromosome 14, leaving 4841.\r\nPruned 5450 variants from chromosome 15, leaving 4709.\r\nPruned 5894 variants from chromosome 16, leaving 5071.\r\nPruned 5003 variants from chromosome 17, leaving 4729.\r\nPruned 5036 variants from chromosome 18, leaving 4680.\r\nPruned 3750 variants from chromosome 19, leaving 3755.\r\nPruned 4288 variants from chromosome 20, leaving 3808.\r\nPruned 2469 variants from chromosome 21, leaving 2258.\r\nPruned 2496 variants from chromosome 22, leaving 2432.\r\nPruning complete.  179479 of 320578 variants removed.\r\nMarker lists written to /tmp/Rtmpg7a6zA/file6adc6e7d579f.prune.in and\r\n/tmp/Rtmpg7a6zA/file6adc6e7d579f.prune.out .\r\nPLINK v1.90b6.4 64-bit (7 Aug 2018)            www.cog-genomics.org/plink/1.9/\r\n(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3\r\nLogging to /tmp/Rtmpg7a6zA/file6adc6e7d579f.log.\r\nOptions in effect:\r\n  --bfile data/technoTeens_QC\r\n  --extract /tmp/Rtmpg7a6zA/file6adc6e7d579f.prune.in\r\n  --genome\r\n  --min 0.08\r\n  --out /tmp/Rtmpg7a6zA/file6adc6e7d579f\r\n  --threads 23\r\n\r\n257658 MB RAM detected; reserving 128829 MB for main workspace.\r\nAllocated 96621 MB successfully, after larger attempt(s) failed.\r\n320578 variants loaded from .bim file.\r\n422 people (0 males, 0 females, 422 ambiguous) loaded from .fam.\r\nAmbiguous sex IDs written to /tmp/Rtmpg7a6zA/file6adc6e7d579f.nosex .\r\n--extract: 141099 variants remaining.\r\nUsing up to 23 threads (change this with --threads).\r\nBefore main variant filters, 422 founders and 0 nonfounders present.\r\nCalculating allele frequencies... done.\r\nTotal genotyping rate is 0.997893.\r\n141099 variants and 422 people pass filters and QC.\r\nNote: No phenotypes present.\r\nIBD calculations complete.  \r\nFinished writing /tmp/Rtmpg7a6zA/file6adc6e7d579f.genome .\r\nPLINK v1.90b6.4 64-bit (7 Aug 2018)            www.cog-genomics.org/plink/1.9/\r\n(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3\r\nLogging to data/technoTeens_QC_norel.log.\r\nOptions in effect:\r\n  --bfile data/technoTeens_QC\r\n  --make-bed\r\n  --out data/technoTeens_QC_norel\r\n  --remove /tmp/Rtmpg7a6zA/file6adc4e65cf65\r\n\r\n257658 MB RAM detected; reserving 128829 MB for main workspace.\r\nAllocated 96621 MB successfully, after larger attempt(s) failed.\r\n320578 variants loaded from .bim file.\r\n422 people (0 males, 0 females, 422 ambiguous) loaded from .fam.\r\nAmbiguous sex IDs written to data/technoTeens_QC_norel.nosex .\r\n--remove: 195 people remaining.\r\nWarning: At least 17736 duplicate IDs in --remove file.\r\nUsing 1 thread (no multithreaded calculations invoked).\r\nBefore main variant filters, 195 founders and 0 nonfounders present.\r\nCalculating allele frequencies... done.\r\nTotal genotyping rate in remaining samples is 0.997835.\r\n320578 variants and 195 people pass filters and QC.\r\nNote: No phenotypes present.\r\n--make-bed to data/technoTeens_QC_norel.bed + data/technoTeens_QC_norel.bim +\r\ndata/technoTeens_QC_norel.fam ... done.\r\n\r\n``system.time(\r\n     technoQC.rds <- snp_readBed(technoQC2.bed, \"technoQC\")\r\n)``\r\n   user  system elapsed \r\n  1.109   0.054   1.161 \r\n\r\n``str(technoTeens, max.level = 2)``\r\nList of 3\r\n $ genotypes:Reference class 'FBM.code256' [package \"bigstatsr\"] with 10 fields\r\n  ..and 22 methods, of which 8 are  possibly relevant:\r\n  ..  add_columns, as.FBM, copy#envRefClass, initialize,\r\n  ..  initialize#FBM, save, show#envRefClass, show#FBM\r\n $ fam      :'data.frame':\t195 obs. of  6 variables:\r\n  ..$ family.ID  : int [1:195] 1 3 4 6 8 11 12 13 17 21 ...\r\n  ..$ sample.ID  : chr [1:195] \"202528140036_R01C01\" \"202528140036_R02C01\" \"202528140036_R02C02\" \"202528140036_R03C02\" ...\r\n  ..$ paternal.ID: int [1:195] 0 0 0 0 0 0 0 0 0 0 ...\r\n  ..$ maternal.ID: int [1:195] 0 0 0 0 0 0 0 0 0 0 ...\r\n  ..$ sex        : int [1:195] 0 0 0 0 0 0 0 0 0 0 ...\r\n  ..$ affection  : int [1:195] -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 ...\r\n $ map      :'data.frame':\t320578 obs. of  6 variables:\r\n  ..$ chromosome  : int [1:320578] 1 1 1 1 1 1 1 1 1 1 ...\r\n  ..$ marker.ID   : chr [1:320578] \"GSA-rs114420996\" \"rs3131972\" \"rs12127425\" \"rs4970383\" ...\r\n  ..$ genetic.dist: num [1:320578] 0 0 0 0 0 0 0 0 0 0 ...\r\n  ..$ physical.pos: int [1:320578] 58814 752721 794332 838555 840753 846808 853954 854250 861808 866893 ...\r\n  ..$ allele1     : chr [1:320578] \"A\" \"G\" \"A\" \"A\" ...\r\n  ..$ allele2     : chr [1:320578] \"G\" \"A\" \"G\" \"C\" ...\r\n - attr(*, \"class\")= chr \"bigSNP\"\r\n> G <- technoTeens$genotypes\r\n> big_counts(G, ind.col = 1:10)\r\n     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]\r\n0       0   31    2   23   38   27   26   14   40     8\r\n1      55   91   31   87   99   89   89   87   97    51\r\n2     133   70  162   83   58   79   80   94   58   136\r\n<NA>    7    3    0    2    0    0    0    0    0     0\r\n\r\n``system.time(\r\n     infos <- snp_fastImpute(G, technoTeens$map$chromosome, ncores = NCORES)\r\n)``\r\n   user  system elapsed \r\n  0.791   1.128 185.524 \r\n\r\n``plot(subset(infos, pNA > 0.001), pch = 19, cex = 0.5)``\r\nError in subset.default(infos, pNA > 0.001) : object 'pNA' not found``\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/privefl/bigsnpr/issues/comments/419125207","html_url":"https://github.com/privefl/bigsnpr/issues/10#issuecomment-419125207","issue_url":"https://api.github.com/repos/privefl/bigsnpr/issues/10","id":419125207,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTEyNTIwNw==","user":{"login":"moldach","id":5749465,"node_id":"MDQ6VXNlcjU3NDk0NjU=","avatar_url":"https://avatars1.githubusercontent.com/u/5749465?v=4","gravatar_id":"","url":"https://api.github.com/users/moldach","html_url":"https://github.com/moldach","followers_url":"https://api.github.com/users/moldach/followers","following_url":"https://api.github.com/users/moldach/following{/other_user}","gists_url":"https://api.github.com/users/moldach/gists{/gist_id}","starred_url":"https://api.github.com/users/moldach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moldach/subscriptions","organizations_url":"https://api.github.com/users/moldach/orgs","repos_url":"https://api.github.com/users/moldach/repos","events_url":"https://api.github.com/users/moldach/events{/privacy}","received_events_url":"https://api.github.com/users/moldach/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T14:56:03Z","updated_at":"2018-09-06T14:56:03Z","author_association":"NONE","body":"So I followed the additional steps from `?snp_fastImpute`, but I'm worried about how my plot looks compared to the one you gave in the Vignette.\r\n\r\n```\r\nplink <- download_plink()\r\nNCORES <- nb_cores()  # We have 23 cores\r\n\r\ntechnoQC.bed <- snp_plinkQC(\r\nprefix.in = \"data/technoTeens\",\r\nplink.path = plink,\r\nfile.type = \"--file\", # ped/map\r\ngeno = 0.05,\r\nmind = 0.05,\r\nmaf = 0.05,\r\nhwe = 1e-10,\r\nautosome.only = TRUE\r\n)\r\n\r\ntechnoQC2.bed <- snp_plinkIBDQC(\r\nbedfile.in = technoQC.bed,\r\nplink.path = plink,\r\nncores = NCORES\r\n)\r\n\r\ntechnoQC.rds <- snp_readBed(technoQC.bed)\r\n\r\ntechnoTeens <- snp_attach(technoQC.rds)\r\nstr(technoTeens, max.level = 2, strict.width = \"cut\")\r\n\r\nG <- technoTeens$genotypes\r\nCHR <- technoTeens$map$chromosome\r\n\r\nG2 <- snp_fastImpute(G, CHR)\r\nG2[, 1:5]\r\n\r\nbig_counts(G, ind.col = 1:10)\r\nfake$genotypes$code256 <- bigsnpr:::CODE_IMPUTE_PRED\r\nfake <- snp_save(fake)\r\nbig_counts(fake$genotypes)[4, ]\r\n\r\ntechnoTeens$genotypes$code256 <- bigsnpr:::CODE_IMPUTE_PRED\r\ntechnoTeens <- snp_save(technoTeens)\r\nbig_counts(technoTeens$genotypes)[4, ]\r\n\r\npvals <- c(0.01, 0.005, 0.002, 0.001); colvals <- 2:5\r\ndf <- data.frame(pNA = G2[1, ], pError = G2[2, ])\r\n\r\nlibrary(ggplot2)\r\nReduce(function(p, i) {\r\np + stat_function(fun = function(x) pvals[i] / x, color = colvals[i])\r\n}, x = seq_along(pvals), init = ggplot(df, aes(pNA, pError))) +\r\ngeom_point() +\r\ncoord_cartesian(ylim = range(df$pError, na.rm = TRUE)) +\r\ntheme_bw(15)\r\n```\r\nThis is the image I get:\r\n\r\n![bigsnpr_plot](https://user-images.githubusercontent.com/5749465/45165422-ca439a80-b1c2-11e8-8dd9-1d9f0e6f5893.png)\r\n\r\nAny idea why my plot would look like this?\r\n\r\n````\r\nstr(G2)\r\nReference class 'FBM' [package \"bigstatsr\"] with 9 fields\r\n $ extptr     :<externalptr> \r\n $ nrow       : num 2\r\n $ ncol       : int 320578\r\n $ type       : Named int 8\r\n  ..- attr(*, \"names\")= chr \"double\"\r\n $ backingfile: chr \"/exports/meaney.lab/moldach/technoTeens_bigsnpr/data/technoTeens_QC-infos-impute.bk\"\r\n $ is_saved   : logi TRUE\r\n $ address    :<externalptr> \r\n $ bk         : chr \"/exports/meaney.lab/moldach/technoTeens_bigsnpr/data/technoTeens_QC-infos-impute.bk\"\r\n $ rds        : chr \"/exports/meaney.lab/moldach/technoTeens_bigsnpr/data/technoTeens_QC-infos-impute.rds\"\r\n and 18 methods, of which 4 are  possibly relevant:\r\n   add_columns, initialize, save, show#envRefClass\r\n```\r\n"}}
{"actor":{"display_login":"moldach"}}