From 6ef69788133cb273e69c7f0af86f9781a8897aea Mon Sep 17 00:00:00 2001 From: Cristianetaniguti Date: Thu, 22 May 2025 09:21:32 -0400 Subject: [PATCH] fix chr ID --- R/madc2vcf_all.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/madc2vcf_all.R b/R/madc2vcf_all.R index 16dad2e..6c1691c 100644 --- a/R/madc2vcf_all.R +++ b/R/madc2vcf_all.R @@ -169,6 +169,7 @@ loop_though_dartag_report <- function(report, botloci, hap_seq, n.cores=1, align clust <- makeCluster(n.cores) #clusterExport(clust, c("botloci", "compare", "nucleotideSubstitutionMatrix", "pairwiseAlignment", "DNAString", "reverseComplement")) + #clusterExport(clust, c("botloci", "alignment_score_thr")) compare_results <- parLapply(clust, updated_by_cloneID, function(x) compare(x, botloci, alignment_score_thr)) stopCluster(clust) @@ -449,7 +450,11 @@ create_VCF_body <- function(csv, vcf_body$V3 <- as.numeric(vcf_body$V3) rownames(vcf_body) <- NULL - vcf_body$target <- paste0(sapply(strsplit(vcf_body$target, "_"),"[[", 1), "_",as.numeric(sapply(strsplit(vcf_body$target, "_"),"[[", 2))) + # Remove padding + sp <- strsplit(vcf_body$target, "_") + pos <- sapply(sp, function(x) x[length(x)]) + chr <- sapply(sp, function(x) paste0(x[-length(x)], collapse = "_")) + vcf_body$target <- paste0(chr, "_",as.numeric(pos)) # Dealing with repeated positions # discard the ones that are not the target and keep only the first if all are off-targets