R/jaccard.r

Defines functions Jaccard

Documented in Jaccard

Jaccard <- function(x, maf.threshold = 0.01) {
  if(maf.threshold > 0.5) 
    stop("MAF threshold can't be this high")
  
  w <- (x@snps$maf <= maf.threshold)
  inverse <- (x@p >= 1-maf.threshold)
 
  Ja <- .Call('oz_jaccard', PACKAGE = "Ravages", x@bed, w, inverse )
  J <- Ja$A/Ja$B
  # les individus qui ne portent aucun génotype rare 
  # ont un coeff d'identité nul avec tout le monde (y compris eux-même)
  J[Ja$B == 0] <- 0
  rownames(J) <- colnames(J) <- x@ped$id
  J
}

Try the Ravages package in your browser

Any scripts or data that you put into this service are public.

Ravages documentation built on April 1, 2023, 12:08 a.m.