Skip to content

Commit dff117f

Browse files
committed
bug fix for VCFR2AF
1 parent edfc66d commit dff117f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

R/summarise_window_parallelism.R

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ summarise_window_parallelism <- function(window_id,
1515
# Make the final_out table
1616
final_out <- data.frame(window_id=NA,
1717
eigenvector=NA,
18+
eigenvalue=NA,
1819
parallel_lineages=NA,
1920
parallel_pops=NA,
2021
antiparallel_pops=NA)
@@ -28,6 +29,7 @@ summarise_window_parallelism <- function(window_id,
2829
# Output
2930
out <- data.frame(window_id=window_id,
3031
eigenvector=paste0("Eig",eigN),
32+
eigenvalue=eigen_res[[window_id]]$eigenvals[eigN],
3133
parallel_lineages = length(loadings[abs(loadings) > loading_cutoff]))
3234

3335
# Catch cases where all parallel but negative

R/vcfR2AF.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ vcfR2AF <- function(vcf,
2525
gt <- extract.gt(vcf)
2626

2727
# Convert to numbers using the appropriate separator
28-
geno_format <- strsplit(gt[1,1],"")[[1]][2]
28+
geno_format <- strsplit(na.omit(gt[1,])[1],"")[[1]][2]
2929
gt[gt == paste0("0",geno_format,"0")] <- 0
3030
gt[gt == paste0("0",geno_format,"1")] <- 0.5
3131
gt[gt == paste0("1",geno_format,"1")] <- 1

0 commit comments

Comments
 (0)