QSG-Group / WISH

5 stars 3 forks source link

Error in generate modules #7

Open ag87unimib opened 3 years ago

ag87unimib commented 3 years ago

Hi

first of all thanks for this package.

I have generated correlations matrix which includes 132 elements. i have now tried several time to run generate.modules(correlations,values="Coefficients",thread=2) before that I have also run as suggested: correlations$Coefficients[(is.na(correlations$Coefficients))]<-0 correlations$Pvalues[(is.na(correlations$Pvalues))]<-1 i have a binary phenotype and i have used glm=T in the model of course.

the error i receive is this: Error in seq.default(from = min(k), to = max(k), length = nBreaks + 1) : 'from' must be a finite number.

i copy paste here my code:

library(WISH) library(data.table) ped <- fread("D:/Dati/GWAS_ITALIAN_PBC_Mike_files/EPISTASI/epistasi_all SNPs_all_TF/file_epistasi_per_wish/all_snp_tf_recoded.ped", data.table=F) tped <- fread("D:/Dati/GWAS_ITALIAN_PBC_Mike_files/EPISTASI/epistasi_all SNPs_all_TF/file_epistasi_per_wish/all_snp_tf_recoded.tped", data.table=F) pval <- fread("D:/Dati/GWAS_ITALIAN_PBC_Mike_files/EPISTASI/epistasi_all SNPs_all_TF/file_epistasi_per_wish/ALL_SNP_TF_p.txt", data.table=F) id <- fread("D:/Dati/GWAS_ITALIAN_PBC_Mike_files/EPISTASI/epistasi_all SNPs_all_TF/file_epistasi_per_wish/ALL_SNP_TF_id.txt", data.table=F) genotype <-generate.genotype(ped,tped,snp.id=id, pvalue=0.005,id.select=NULL,gwas.p=pval,major.freq=0.95,fast.read=T) LD_genotype<-LD_blocks(genotype) genotype <- LD_genotype$genotype pheno<-fread("D:/Dati/GWAS_ITALIAN_PBC_Mike_files/EPISTASI/epistasi_all SNPs_all_TF/file_epistasi_per_wish/pheno.txt",data.table=F) pheno<-ifelse(pheno=="1","0","1") pheno<-as.numeric(pheno) correlations<-epistatic.correlation(pheno, genotype,threads = 2 ,test=F,glm=T) genome.interaction(tped,correlations,quantile = 0.9) correlations$Coefficients[(is.na(correlations$Coefficients))]<-0 correlations$Pvalues[(is.na(correlations$Pvalues))]<-1 generate.modules(correlations,values="Coefficients",thread=2) #########

Thanks for your help! Alessio

beausoleilmo commented 6 months ago

The error seems to come from the scaleFreePlot(connectivity) function which is from the WGCNA package. I had a bunch of NAs in 'connectivity ' which was breaking the function. I don't know if this could be a solution but here is a possibility connectivity[is.na(connectivity)]<-0.