Skip to content

Commit

Permalink
fix set.filter
Browse files Browse the repository at this point in the history
  • Loading branch information
pievos101 committed Apr 6, 2021
1 parent b5e5a74 commit e397629
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions R/set.filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if((missing.freqs==TRUE) & (minor.freqs==FALSE)){
object <- count.unknowns(object)
change <- object@region.data

MAF <- object@region.stats@missing.freqs
MISS <- object@region.stats@missing.freqs

included <- vector("list",length(object@region.names))

Expand All @@ -22,7 +22,7 @@ if((missing.freqs==TRUE) & (minor.freqs==FALSE)){

if(length(object@region.data@biallelic.sites[[xx]])==0){next}

truefalse <- apply(MAF[[xx]],2,function(y){
truefalse <- apply(MISS[[xx]],2,function(y){
check <- (y >= miss.lower.bound) & (y <= miss.upper.bound)
if(all(check)){return(TRUE)}else{return(FALSE)}
})
Expand Down Expand Up @@ -83,9 +83,12 @@ if((minor.freqs==TRUE) & (missing.freqs==TRUE) ){

print("Using minor & missing allele frequencies")
object <- detail.stats(object)
object <- count.unknowns(object)

change <- object@region.data

MAF <- object@region.stats@minor.allele.freqs
MISS <- object@region.stats@missing.freqs

included <- vector("list",length(object@region.names))

Expand All @@ -98,12 +101,17 @@ if((minor.freqs==TRUE) & (missing.freqs==TRUE) ){

if(length(object@region.data@biallelic.sites[[xx]])==0){next}

truefalse <- apply(MAF[[xx]],2,function(y){
check <- (y >= maf.lower.bound) & (y <= maf.upper.bound) & (y >= miss.lower.bound) & (y <= miss.upper.bound)
truefalse1 <- apply(MAF[[xx]],2,function(y){
check <- (y >= maf.lower.bound) & (y <= maf.upper.bound)
if(all(check)){return(TRUE)}else{return(FALSE)}
})

included[[xx]] <- truefalse
truefalse2 <- apply(MISS[[xx]],2,function(y){
check <- (y >= miss.lower.bound) & (y <= miss.upper.bound)
if(all(check)){return(TRUE)}else{return(FALSE)}
})

included[[xx]] <- truefalse1 & truefalse2

# PROGRESS #######################################################
progr <- progressBar(xx,length(object@region.names), progr)
Expand Down

0 comments on commit e397629

Please sign in to comment.