CristinaMoraru / VIRIDIC

VIRIDIC (Virus Intergenomic Distance Calculator) computes pairwise intergenomic distances/similarities amongst viral genomes.
GNU General Public License v3.0
9 stars 3 forks source link

nident_fun approximation compatible with blastn/tblastx #1

Open igortru opened 10 months ago

igortru commented 10 months ago

I have fixed minor issue in my original version

nident_fun <- function(DF, gen_len) { DF <- DF %>% mutate(qstart = pmin(qstart, qend), qend = pmax(qstart,qend)) ir <- IRanges(start = DF$qstart, end = DF$qend) cov <- coverage(ir ,weight = DF$pident/100.0) %>% as.vector() cov2 <- coverage(ir) %>% as.vector()

align_q_o <- length(cov2 > 0) nident_o <- as.integer(sum(ifelse(cov2 == 0, 0.0, cov / cov2)) + 0.5)

rm(ir,cov,cov2) return (c(nident_o, align_q_o)) }

pident need to be added to outfmt, qseq,sseq not required blastn parameters need to be removed from tblastx cmd