Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor combine_scorefiles #62

Merged
merged 41 commits into from
Dec 15, 2023
Merged

Refactor combine_scorefiles #62

merged 41 commits into from
Dec 15, 2023

Conversation

nebfield
Copy link
Member

@nebfield nebfield commented Nov 6, 2023

  • Old implementation used pandas to load big dataframes, do QC, and append to a gzipped file
  • Tried multiprocessing combine scores in parallel #61 but the performance benefits weren't great
  • New implementation sets up a data processing pipeline with a pile of generator functions
    • The end result streams variants to an output file, so memory usage will be low
  • setting up ScoreVariant class with __slots__ and __iter__ really helped (was using a dict)

Also fixes some bugs that cropped up:

  • pandas introduced effect weight precision errors
  • some variants lost information in weird conditions
  • dropped --threads because it didn't help

Benchmark with first 100 files in PGS Catalog with compressed output:

combine_scorefiles -s PGS000001_hmPOS_GRCh38.txt.gz                            262.74s user 1.44s system 99% cpu 4:24.99 total
combine_scorefiles -s PGS000001_hmPOS_GRCh38.txt.gz                            278.85s user 16.70s system 57% cpu 8:37.21 total

@nebfield nebfield changed the base branch from main to dev November 6, 2023 17:20
@nebfield nebfield marked this pull request as ready for review November 6, 2023 17:30
@nebfield
Copy link
Member Author

nebfield commented Nov 7, 2023

correlation of effect weights is 1 between old and new despite the floating point error in the old version

pgscatalog_utils/scorefile/liftover.py Show resolved Hide resolved
pgscatalog_utils/scorefile/liftover.py Outdated Show resolved Hide resolved
pgscatalog_utils/scorefile/qc.py Outdated Show resolved Hide resolved
pgscatalog_utils/scorefile/scoringfile.py Outdated Show resolved Hide resolved
Base automatically changed from dev to main December 5, 2023 11:09
pgscatalog_utils/scorefile/effectallele.py Outdated Show resolved Hide resolved
@nebfield nebfield changed the base branch from main to dev December 15, 2023 16:20
@nebfield nebfield merged commit c6605e8 into dev Dec 15, 2023
1 check passed
@nebfield nebfield deleted the stream_combine branch December 15, 2023 16:20
@nebfield nebfield mentioned this pull request Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants