Error in { : task 2054 failed - "'names' attribute [19] must be the same length as the vector [17]"

100 views
Skip to first unread message

Cato Romero

unread,
Jan 11, 2021, 5:29:44 PM1/11/21
to Genomic SEM Users
Hi all,

I tried running GWAS-by-subtraction but ended up receiving the error:
Error in { :
  task 2054 failed - "'names' attribute [19] must be the same length as the vector [17]"
Calls: userGWAS -> %dopar% -> <Anonymous>

The code I used was:

require("GenomicSEM")

library(data.table)

library(dplyr)

library(tidyverse)


munge("SCZ1.txt",

      "w_hm3.noMHC.snplist",

      trait.names="SCZ",

        N=306011,

      info.filter = 0.9,

      maf.filter = 0.01)


munge("INSO_Jansen_sumstats_filtered.txt.gz",

      "w_hm3.noMHC.snplist",

      trait.names="TRAIT",

      info.filter = 0.9,

      maf.filter = 0.01)


traits <- c("SCZ.sumstats.gz","TRAIT.sumstats.gz")

sample.prev <- c(NA,NA)

population.prev <- c(NA,NA)

ld<-"eur_w_ld_chr/"

wld <- "eur_w_ld_chr/"

trait.names<-c("SCZ", "TRAIT")


LDSCoutput <- ldsc(traits,

                   sample.prev,

                   population.prev,

                   ld,

                   wld,

                   trait.names)


model<-'F1=~NA*SCZ + TRAIT

         F2=~NA*SCZ

         

         F2~~1*F2

         F1~~1*F1

         F1~~0*F2


         TRAIT~~0*SCZ

         TRAIT~~0*TRAIT

         SCZ~~0*SCZ'


output <-usermodel(LDSCoutput,estimation="DWLS",model=model)


files = c("SCZ1.txt", "INSO_Jansen_sumstats_filtered.txt.gz")

ref = "reference.uk10k.maf.0.005.txt"

trait.names = c("SCZ","TRAIT")

se.logit = c(T,T)

info.filter = 0.6

maf.filter = 0.01


p_sumstats<-sumstats(files, ref, trait.names, se.logit, info.filter, maf.filter, OLS=c(F,F),linprob=NULL, prop=NULL, N=c(306011, 386533))


est1<-round(output$results$Unstand_Est[1],digits=2)

est2<-round(output$results$Unstand_Est[2],digits=2)

est4<-round(output$results$Unstand_Est[4],digits=2)


model <- 'F1=~NA*SCZ + start(est1)*SCZ + start(est2)*TRAIT

         F2=~NA*SCZ + start(est4)*SCZ

         

         F1~SNP

         F2~SNP


         F2~~1*F2

         F1~~1*F1

         F1~~0*F2


         TRAIT~~0*SCZ

         TRAIT~~0*TRAIT

         SCZ~~0*SCZ

         SNP~~SNP'


outputGWAS <- userGWAS(covstruc=LDSCoutput,

                    SNPs=p_sumstats,

                    estimation="DWLS",

                    model=model,

                    printwarn=FALSE,

                    sub=c("F1~SNP","F2~SNP"),

                    toler=FALSE,SNPSE=FALSE,parallel=TRUE,Output=NULL)


I have looked into the input files and they don't seem to have any abnormalities (no NAs, trait naming is consistent). The code runs for hours before the error terminates the job. I've tried running the same code with only 500k SNPs and I get the same error. 

Any thoughts of what might be going wrong and what I could try to do differently?

Best,
Cato Romero

Cato Romero

unread,
Jan 14, 2021, 8:11:14 AM1/14/21
to Genomic SEM Users
The error seems to have gone away after changing 'printwarn' to TRUE. Peculiar! 
We can't find any mention of such an error in the code provided on GitHub, so it might be an interaction with the various R dependencies. 
If you have any additional thoughts on the matter, we would appreciate hearing them!

Best, 
Cato

agro...@gmail.com

unread,
Jan 20, 2021, 2:09:43 PM1/20/21
to Genomic SEM Users

Hi Cato, 

Apologies for the late response and glad you found a workaround! If you could e-mail me (agro...@utexas.edu) the LDSCoutput and p_sumstats objects I can take a look at what might be throwing the error.  

Thanks!
 -Andrew

Poppy Grimes

unread,
Jul 22, 2026, 12:28:10 AMJul 22
to Genomic SEM Users
Hi Andrew

Just to flag I am getting this same error when running userGWAS. From other posts on the group, it looks like it was resolved in 2022. I found that setting printwarn=TRUE as flagged by Cato above seems to have fixed it!

Poppy

Reply all
Reply to author
Forward
0 new messages