gymrek-lab/TRTools

Division by Zero in plinkSTR

bibb opened this issue · 4 comments

bibb commented

Hello,

I'm using plinkSTR with a VCF coming from the STR imputation pipeline, and I got this error:

Traceback (most recent call last):
File "/projects/b1049/genetics_programs/gangSTR/bin/plinkSTR", line 11, in
load_entry_point('strtools==1.0.0', 'console_scripts', 'plinkSTR')()
File "/projects/b1049/genetics_programs/gangSTR/lib/python3.7/site-packages/strtools-1.0.0-py3.7.egg/plinkSTR/plinkSTR.py", line 354, in main
File "/projects/b1049/genetics_programs/gangSTR/lib/python3.7/site-packages/strtools-1.0.0-py3.7.egg/plinkSTR/plinkSTR.py", line 112, in PerformAssociation
ZeroDivisionError: float division by zero

I thought maybe it was a problem with my VCF and I tried different chromosomes, different imputed VCFs coming from other cohorts, running the program with different MAF thresholds since line 112 is about that, also with and without covariates, but I got the same error each time. I will appreciate your help in this

Best,

Bernabe

nmmsv commented

can you please check if the latest version of plinkSTR resolves this problem?

bibb commented

Hi, thanks for the fix, now I get the following error:

plinkSTR --vcf snp.str.chr22.v2.vcf.gz --covar PC1_5.ForVCF.covar --covar-name PC1,PC2,PC3,PC4,PC5 --out test.chr22 --fam VCF_file.fam --sex --logistic --infer-snpstr --allele-tests --allele-tests-length --remove-rare-str-alleles 0.01

Traceback (most recent call last):
  File "/home/bib0660/.local/bin/plinkSTR", line 11, in <module>
    load_entry_point('strtools==1.0.0', 'console_scripts', 'plinkSTR')()
  File "/projects/b1049/genetics_programs/gangSTR/lib/python3.7/site-packages/strtools-1.0.0-py3.7.egg/plinkSTR/plinkSTR.py", line 382, in main
    OutputAssoc(record.CHROM, record.POS, assoc, outf, assoc_type=GetAssocType(is_str, alt=alleles[i], name=record.ID))
  File "/projects/b1049/genetics_programs/gangSTR/lib/python3.7/site-packages/strtools-1.0.0-py3.7.egg/plinkSTR/plinkSTR.py", line 60, in GetAssocType
    if alt >= 0: return "%s-alt-%s"%(name,alt)
TypeError: '>=' not supported between instances of 'str' and 'int'

Is this a problem of the imputed VCF having both SNPs and STRs? should I separate them in different files?

Thanks!

Bernabe

@bibb This is because of incompatibility with Python 3. You can either use Python 2 to solve this, or get the development version of plinkSTR from the following link that supports both Python 2 and 3:
https://github.com/shubhamsaini/STRTools/blob/master/plinkSTR/plinkSTR.py

Closing due to inactivity.