Skip to content

float and string error #220

@zhong156

Description

@zhong156

Hello! I hope you are doing well! I am trying to use finngen GWAS summary statistics to run MTAG, but I get this error:

Trait 2: Dropped 64331 SNPs for duplicate values in the "snp_name" column
Dropped 975022 SNPs due to strand ambiguity, 6388280 SNPs remain in intersection after merging trait1
Dropped 8179 SNPs due to inconsistent allele pairs from phenotype 2. 6287048 SNPs remain.
unsupported operand type(s) for -: 'float' and 'str'
Traceback (most recent call last):
File "mtag.py", line 1577, in
mtag(args)
File "mtag.py", line 1343, in mtag
DATA_U, DATA, args = load_and_merge_data(args)
File "mtag.py", line 357, in load_and_merge_data
GWAS_int.loc[snps_to_flip, freq_name + str(p)] = 1. - GWAS_int.loc[snps_to_flip, freq_name + str(p)]
File "/home/zhong156/.conda/envs/2024.02-py311/py27_env/lib/python2.7/site-packages/pandas/core/ops.py", line 1583, in wrapper
result = safe_na_op(lvalues, rvalues)
File "/home/zhong156/.conda/envs/2024.02-py311/py27_env/lib/python2.7/site-packages/pandas/core/ops.py", line 1533, in safe_na_op
lambda x: op(x, rvalues))
File "pandas/_libs/algos.pyx", line 690, in pandas._libs.algos.arrmap
File "/home/zhong156/.conda/envs/2024.02-py311/py27_env/lib/python2.7/site-packages/pandas/core/ops.py", line 1533, in
lambda x: op(x, rvalues))
File "/home/zhong156/.conda/envs/2024.02-py311/py27_env/lib/python2.7/site-packages/pandas/core/ops.py", line 148, in rsub
return right - left
TypeError: unsupported operand type(s) for -: 'float' and 'str'
Analysis terminated from error at Thu Oct 3 10:31:05 2024
Total time elapsed: 6.0m:30.12s

I have tried making the chr, bpos, freq, z, pval columns numeric but I still get this error. I was wondering if you would know what part of the data is causing this issue. Thank you so much!

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