Skip to content

Matrix is singular warning in LD4M #1

Description

@mja

I've gotten the run_FMR_32traits.m script to run and now I'm trying to adapt it to my own GWAS results. I'm getting the error

Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. 
> In LD4M (line 244)
  In run_FMR (line 68)

output a few dozen times, followed by

Out of memory. Type HELP MEMORY for your options.

Error in run_FMR (line 118)
        block=((jk-1)*blocksize+1:min(mm_regression,jk*blocksize)) + ...

This is running Matlab R2018 on a 32GB node.

I've made a plain text file for my GWAS results, where the first column is the numeric part of the rsID and the second column is a chisq value (calculated from the sumstats as log(OR)^2/SE^2). The first 5 rows look like:

2326918 0.2296
7929618 7.5625
66941928        0.0044
6977693 1.69
12364336        0.3554

I'm then loading it into Matlab setting up the inputs to run_FMR similar to what is in the example scripts:

% load the GWAS sumstats
gwas = dlmread('gwas_chisq.txt', '\t');

% first column are rsIDs (numeric), second column are chisq values
gwas_snps = gwas(:,1);
gwas_chisq = gwas(:,2);

% load FMR data files
load('FMR/matfiles/fourierLDscores.base.mat','SNPs','lF','l2','l4')
RefSNPs=vertcat(SNPs{:});
load('FMR/matfiles/1kg_LD.HM3.window1cm.noblocks.mat','RRb','LDSNPs')

% load FMR scripts
addpath('FMR/MATLAB/FMR')
addpath('FMR/MATLAB/otherfunctions')

% parameters
mm=length(lF);
no_blocks=100;
t_ratio_step=2;
ss=t_ratio_step.^(-7:5); %sigma^2 values of mixture cpts
tt=sqrt(ss); %sampling times
rel_wt=1;
sig_thresh_array=[30,100,300,1000];

% line up indices of SNPs between ref and gwas
[~,i2,i1]=intersect(RefSNPs,gwas_snps,'stable');

% run analysis
[ww,sigmasq,LD4Mout,warningflag] = ...
	run_FMR(gwas_chisq(i1),lF(i2,:),l2(i2),l4(i2),...
	ss,tt,'l2Weights',1./l2(i2),'l4Weights',1./l4(i2));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions