GithubHelp home page GithubHelp logo

binmapr's People

Contributors

xuzhougeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

binmapr's Issues

[Debug found] Error: operator is invalid for atomic vectors

When I executed the "batchCallGeno" function as flow, an error occurred: operator is invalid for atomic vectors.

geno_out <- batchCallGeno(GT_flt, CHROM = CHROM, 
                     pos.start = 7, fix.size = 10)

This error Can't be solved by translating GT_flt(matrix) to dafa.frame.
The problem is created by the "batchCallGeno" function,

Call Geno by window

  geno <- callWindowGeno(x, window.size = window.size,
                         low = low.count, high = high.count)

  ## Fix the potential error
  geno_fix <- fixGenoError(geno, fix.size = fix.size)

The Key

After "callWindowGeno", the geno is a list. But the "fixGenoError" function tries to quote the colnames (geno, CHROM and ind.name) that don't exist in geno. And the "callWindowGeno" function doesn't generate these colnames.

fixGenoError function

 fixGenoError <- function(x, fix.size = 10 ){
 
   geno <- x$geno
   chroms <- x$CHROM
   samples <- x$ind.name

callWindowGeno

callWindowGeno <- function(x, window.size = 15,
                           low = 6, high = 24){

  splitSNP <- split(x, ceiling(seq_along(x)/window.size))

  batchSNP <- sapply(seq_along(splitSNP), function(x){

    snp_num <- length(splitSNP[[x]])
    start_name <- names(splitSNP[[x]][1])
    end_name <- names(splitSNP[[x]][snp_num])

    chr_name <- strsplit(start_name,"_",fixed = TRUE)[[1]][1]
    start_pos <- as.numeric(strsplit(start_name,"_",fixed = TRUE)[[1]][2])
    end_pos <- as.numeric(strsplit(end_name,"_",fixed = TRUE)[[1]][2])

    total <- sum(splitSNP[[x]], na.rm = TRUE)
    names(total) <- paste(chr_name, floor((start_pos + end_pos) / 2) , sep = "_")
    return(total)
  })

  geno <- ifelse(batchSNP < low, 0, ifelse(batchSNP > high ,2 , 1))

  return(geno)
}

which version of R is available binmapr ?

install.packages("binmapr")
Installing package into ‘/home/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘binmapr’ is not available for this version of R
Thanks

wrong about "calcFreqFromAd"

image
When I run the example you provide, it occurred an error?

The operation process is as follows:

AD <- matrix(data = c("30,1","1,30","0,0","15,15"), nrow = 2)
row.names(AD) <- c("chr1_1","chr1_100")
colnames(AD) <- c("A","B")
freq <- calcFreqFromAd(AD)
Error: $ operator is invalid for atomic vectors

I have tried trun the matrix to data.frame, but it doesn't work. I wish if you can help me to solve this problem.

Question about binmap

Dear Gengxin Xu,

I am using the relevant code of Baidu Netdisk, which can successfully run the sample data, but the following error always appears in my data set. Can you please help me solve it?

Yours sincerely

Yan Qiu

image

wrong about "calcFreqFromAd"

freq <- calcFreqFromAd(ad_flt, min.depth = 10, max.depth = 100)
错误: $ operator is invalid for atomic vectors

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.