Code Monkey home page Code Monkey logo

artp2's People

Contributors

yfyang86 avatar zhangh12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

artp2's Issues

read.bed fails on simple .bed file

Dear ARTP2 maintainers,

Thanks for ARTP2's read.bed function, I am very happy it is available!

Unexpectedly, for a simple .bed file (created by PLINK v1.9 with --make_bed), read.bed fails, where the genio R package does read it successfully. Below is a reprex with the error message.

I predicted this can be fixed easily, as the solution is laid bare by the reprex :-)

Thanks and cheers, Richel

# Get the data to work on
remotes::install_github("richelbilderbeek/plinkr")
bed_filename <- get_plinkr_filename("demo_assoc.bed")
bim_filename <- get_plinkr_filename("demo_assoc.bim")
fam_filename <- get_plinkr_filename("demo_assoc.fam")

# genio can read the .bed file
genio::read_bed(
  file = bed_filename,
  names_loci = genio::read_bim(bim_filename)$id,
  names_ind =  genio::read_fam(fam_filename)$fam
)

# ARTP2 cannot read the .bed file yet
ARTP2::read.bed(
  bed = get_plinkr_filename("demo_assoc.bed"),
  bim = get_plinkr_filename("demo_assoc.bim"),
  fam = get_plinkr_filename("demo_assoc.fam")
)

The error given is:

Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning messages:
1: In ARTP2::read.bed(bed = get_plinkr_filename("demo_assoc.bed"),  :
  Duplicated subjects exist in fam file: 
/home/richel/GitHubs/plinkr/inst/extdata/demo_assoc.fam
2: non-unique value when setting 'row.names': ‘1’ 

This gives us the reason for the problem: the .fam file has duplicate IDs. This is reasonable: all individuals should be unique. Well done!

But maybe the function is a bit too overeager. One hint of this may already be that PLINK can work with the .fam file without problems. So, let's take a look at the .fam file:

genio::read_fam(fam_filename)
# A tibble: 3 x 6
  fam   id    pat   mat     sex pheno
  <chr> <chr> <chr> <chr> <int> <dbl>
1 1     1     0     0         1     1
2 2     1     0     0         1     1
3 3     1     0     0         1     1

Aha, all individuals are unique, as all combinations of family ID and within-family ID are unique.

I guess that makes fixing this bug easy :-)

question: loading plink file

Thanks for this package.

I would like to use this to read plink data.

https://rdrr.io/cran/ARTP2/man/read.bed.html

If I use following code however, I was wondering when reading plink file are the data loaded completely in memory or in chunks or index?

read.bed(bed, bim, fam, sel.snps = NULL, sel.subs = NULL, encode012 = TRUE)

I have plink data for about ~200K individuals.
Thank you.

Can I use this for continuous trait data?

I learned about GWAS and found a path-based test. From the manual, it seems that it can be executed only in cases and controls study. Is it applicable to continuous traits?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.