weizhou0 / qtl

GNU General Public License v3.0
24 stars 2 forks source link

`Mat::elem(): index out of bounds` in step 2 #3

Open Zepeng-Mu opened 11 months ago

Zepeng-Mu commented 11 months ago

Hi, I encountered this error message while testing step 2 on my own data:

Error in mainMarkerInCPP(genoType, traitType, genoIndex_prev, genoIndex,  : 
  Mat::elem(): index out of bounds
Calls: SPAGMMATtest -> SAIGE.Marker -> mainMarkerInCPP
Execution halted

This is the log:

R version 4.1.3 (2022-03-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS/LAPACK: /scratch/midway3/zepengmu/miniconda3/envs/RSAIGE/lib/libopenblasp-r0.3.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.14.2      optparse_1.7.1         RhpcBLASctl_0.21-247.1
[4] SAIGEQTL_0.1.0        

loaded via a namespace (and not attached):
[1] compiler_4.1.3      Matrix_1.4-1        Rcpp_1.0.7         
[4] getopt_1.20.3       RcppNumerical_0.6-0 grid_4.1.3         
[7] RcppParallel_5.1.5  lattice_0.20-45    
$vcfFile
[1] "merged_chr1-22.merged.phased.vcf.gz"

$vcfFileIndex
[1] ""

$vcfField
[1] "DS"

$savFile
[1] ""

$savFileIndex
[1] ""

$bgenFile
[1] ""

$bgenFileIndex
[1] ""

$sampleFile
[1] "harmonised_smp_3study.txt"

$bedFile
[1] ""

$bimFile
[1] ""

$famFile
[1] ""

$AlleleOrder
[1] "alt-first"

$idstoIncludeFile
[1] ""

$rangestoIncludeFile
[1] "chr21_15922410-15922910.region.txt"

$chrom
[1] "21"

$is_imputed_data
[1] FALSE

$minMAF
[1] 0

$minMAC
[1] 4

$minGroupMAC_in_BurdenTest
[1] 5

$minInfo
[1] 0

$maxMissing
[1] 0.15

$impute_method
[1] "best_guess"

$LOCO
[1] FALSE

$GMMATmodelFile
[1] "chr21_15922410-15922910.rda"

$varianceRatioFile
[1] "chr21_15922410-15922910.varianceRatio.txt"

$GMMATmodel_varianceRatio_multiTraits_File
[1] ""

$SAIGEOutputFile
[1] "chr21_15922410-15922910"

$markers_per_chunk
[1] 3000

$groups_per_chunk
[1] 100

$is_output_moreDetails
[1] FALSE

$is_overwrite_output
[1] TRUE

$maxMAF_in_groupTest
[1] "0.0001,0.001,0.01"

$maxMAC_in_groupTest
[1] "0"

$annotation_in_groupTest
[1] "lof,missense;lof,missense;lof;synonymous"

$groupFile
[1] ""

$sparseGRMFile
[1] ""

$sparseGRMSampleIDFile
[1] ""

$relatednessCutoff
[1] 0

$MACCutoff_to_CollapseUltraRare
[1] 10

$cateVarRatioMinMACVecExclude
[1] "10,20.5"

$cateVarRatioMaxMACVecInclude
[1] "20.5"

$weights.beta
[1] "1;25"

$r.corr
[1] 0

$markers_per_chunk_in_groupTest
[1] 100

$condition
[1] ""

$SPAcutoff
[1] 2

$dosage_zerod_cutoff
[1] 0.2

$dosage_zerod_MAC_cutoff
[1] 10

$is_single_in_groupTest
[1] FALSE

$is_SKATO
[1] FALSE

$is_equal_weight_in_groupTest
[1] FALSE

$is_output_markerList_in_groupTest
[1] FALSE

$is_Firth_beta
[1] FALSE

$pCutoffforFirth
[1] 0.01

$is_fastTest
[1] FALSE

$is_noadjCov
[1] TRUE

$is_sparseGRM
[1] FALSE

$pval_cutoff_for_fastTest
[1] 0.05

$max_MAC_for_ER
[1] 4

$is_EmpSPA
[1] FALSE

$help
[1] FALSE

[1] "opt$r.corr"
[1] 0
dosage_zerod_cutoff  0.2 
Any dosages <=  0.2  for genetic variants with MAC <=  10  are set to be 0 in group tests
single-variant association test will be performed
[1] "Leave-one-chromosome-out is not applied"
[1] "LOCO = FASLE and leave-one-chromosome-out is not applied"
isSparseGRM  FALSE 
variance Ratio null is  0.08065672 
variance Ratio null_noXadj is  0.06248972 
variance Ratio ratioVec_null_sample is  0.07773422 
$ratioVec_sparse
[1] 0.8355189

$ratioVec_null
[1] 0.08065672

$ratioVec_null_sample
[1] 0.07773422

$ratioVec_null_noXadj
[1] 0.06248972

$ratioVec_null_eg
[1] -1

$ratioVec_sparse_eg
[1] -1

vcfFileIndex is not specified.  merged_chr1-22.merged.phased.vcf.gz.csi  will be used
dosageFile type is  vcf 
1  ranges are in rangestoIncludeFile
Open VCF done
To read the field DS
Number of meta lines in the vcf file (lines starting with ##): 40
Number of samples in the vcf file: 59
Setting position of samples in VCF files....
m_N 59
Tests will be performed for chromosome:  21 , start:  15672660  end:  16172659 
pval_cutoff_for_gxe  0.001 
traitType  count 
(2023-12-20 10:48:57) ---- Analyzing Chunk 1 :  chrom InitialChunk ---- 

I have tried using VCF or Plink file and got the same error. Thanks so much in advance!!

Zepeng-Mu commented 11 months ago

After some digging around, I realized I used --minMAF=0 --minMAC=4 which potentially conflicts with --max_MAC_for_ER (default is 4). When I used --max_MAC_for_ER=0, I do not get the error above.

hopedisastro commented 3 months ago

Hi Zepeng-Mu,

I am similarly using a VCF with dosages (DS) to run a common variants associations test on SAIGE-QTL. For 10% of the genes tested, I am getting this segfault error: *** caught segfault *** address (nil), cause 'memory not mapped'

I'm wondering if you've come across a similar issue?