Skip to content

Commit

Permalink
Update make_batch_effect_reclassification_table.PCRMinus_only.R
Browse files Browse the repository at this point in the history
# Just use onevsall.fails directly.
merged <- onevsall.fails
  • Loading branch information
shadizaheri authored Nov 29, 2023
1 parent 3533181 commit baba8aa
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,23 @@ onevsall.fails <- onevsall.fails[which(onevsall.fails$fails_onevsall>=onevsall.c


###Combine data
merged <- merge(onevsall.fails,all=T,sort=F,by="VID")
if(nrow(merged) > 0){
merged[,-1] <- apply(merged[,-1],2,function(vals){
#merged <- merge(onevsall.fails,all=T,sort=F,by="VID")
merged <- onevsall.fails
# If merged data frame is not empty, replace NA values with 0
if (nrow(merged) > 0) {
merged[,-1] <- apply(merged[,-1], 2, function(vals) {
vals[which(is.na(vals))] <- 0
return(vals)
})
}
merged <- merge(merged,freq.dat,by="VID",sort=F,all=F)

# Merge with frequency data
merged <- merge(merged, freq.dat, by = "VID", sort = F, all = F)

##Categorize batch effect failure sites
out.table <- analyze.failures(dat=merged,
onevsall.cutoff=onevsall.cutoff)
write.table(out.table,OUTFILE,col.names=F,row.names=F,sep="\t",quote=F)
## Categorize batch effect failure sites
# Assuming the categorize.failures function only requires onevsall.cutoff
# and is compatible with the new merged data structure
out.table <- categorize.failures(dat = merged, onevsall.cutoff = onevsall.cutoff)


# Write the output table
write.table(out.table, OUTFILE, col.names = F, row.names = F, sep = "\t", quote = F)

0 comments on commit baba8aa

Please sign in to comment.