Mixed dtypes in chromosome column from get_gwas_catalog_study_summary_stats

Open Beginner friendly
#158 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
pandas, python

Research direction

The mixed types come from the pandas read_csv call in src/cellink/resources/_gwas_prs_qtl.py around line 419, inside get_gwas_catalog_study_summary_stats. Compare it with the low_memory=False usage in get_pgs_catalog_score_file and check how the chromosome column is read. Done when chromosome comes back with one consistent dtype for GCST90018926, and when other read_csv calls in the file are checked too.

Written by the indexing model from the issue text.

Description

Hi there,

When running get_gwas_catalog_study_summary_stats for GCST90018926, the chromosome column of the returned DataFrame contains mixed types, with some chromosomes appearing both as int and as str:

array([1, 2, 3, ..., 21, 22, '22', 'X', '7', '11', '5', '4', '13', '3'], dtype=object)

This comes from pandas inferring dtypes per chunk:
https://github.com/theislab/cellink/blob/924256a8a7ce66837aa0f8b12a413eea545eb48d/src/cellink/resources/_gwas_prs_qtl.py#L419

get_pgs_catalog_score_file already uses low_memory=False, so the same (or explicit dtypes) should work here. It depends on how a study's file encodes chromosomes, so it may not show up for every study, but it might be worth checking other read_csv calls as well.

Best wishes,
Pia

Dominant language
Python
Stars
25
Forks
8
Avg merge
2m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from theislab/cellink

All issues in theislab/cellink

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.