Dear ctwas group,
I ran the code below
##GET LD Matrix##
convert_geno_to_LD_matrix(
region_info,
"/data1/yujin/JH_BOMICs/CHR/MET_sample_FastQTL.chr1.bed",
"/data1/yujin/JH_BOMICs/CHR/MET_sample_FastQTL.chr1.bim",
chrom = 1,
outputdir = "data1/yujin/JH_BOMICs/",
outname = "",
include_variance = TRUE,
include_allele_freq = TRUE,
show_progress_bar = TRUE,
verbose = FALSE,
logfile = NULL
)
then I got an error like below
2024-11-21 20:05:30.891674 INFO::Convert genotype data to LD matrices
2024-11-21 20:05:31.149244 INFO::Load variant information ...
2024-11-21 20:05:31.358821 INFO::No. regions in chr1: 82013
| | 0%
Error in `[.data.table`(ref_snpinfo_chr, sidx_ref, c("chrom", "id", "pos", :
column(s) not found: [chrom]
In addition: Warning message:
In pgenlibr::ReadList(pgen, variant_subset = variantidx, meanimpute = meanimpute) :
subscript out of bounds (index 0 >= vector size 0)
When I follow up the code, ref_snpinfo_chr was from ref_snp_all which is originated from the code "<- do.call(rbind, lapply(varinfo_files, read_var_info))"
function (read_var_info)
read_var_info <- function(var_info_file){
if (file_ext(var_info_file) == "pvar"){
var_info <- read_pvar(var_info_file)
} else if (file_ext(var_info_file) == "bim"){
var_info <- read_bim(var_info_file)
} else{
stop("unrecognized input")
}
return(var_info)
}
is implemented by function(read_bim)
which is
function (bimf)
{
bim <- data.table::fread(bimf)
colnames(bim) <- c("chr", "id", "cm", "pos", "alt", "ref")
return(bim)
}
I thought it there is an issue with "chr"
Could you please tell me what was the problem?
Many thanks,
Yujin.