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

Add function for unphasing genotypes #275

Merged
merged 1 commit into from
Jun 1, 2023
Merged

Conversation

athos
Copy link
Member

@athos athos commented May 31, 2023

This PR adds a utility function for unphasing genotypes in the VCF format.

The function takes and returns a parsed genotype, so if you want to unphase an unparsed (string) genotype, you'll need to use this function together with parse-genotype and stringify-genotype:

(require '[cljam.io.vcf.util :as vcf.util])

(-> (vcf.util/parse-genotype "1|0")
    vcf.util/unphase-genotype
    vcf.util/stringify-genotype)
;=> "0/1"

(-> (vcf.util/parse-genotype "2|1|0")
    vcf.util/unphase-genotype
    vcf.util/stringify-genotype)
;=> "0/1/2"

@athos athos requested review from alumi and a team May 31, 2023 11:20
@athos athos assigned athos and alumi May 31, 2023
@athos athos requested review from niyarin and removed request for a team May 31, 2023 11:20
@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #275 (6a5a537) into master (edecb9d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #275   +/-   ##
=======================================
  Coverage   88.85%   88.86%           
=======================================
  Files          78       78           
  Lines        6496     6501    +5     
  Branches      456      456           
=======================================
+ Hits         5772     5777    +5     
  Misses        268      268           
  Partials      456      456           
Impacted Files Coverage Δ
src/cljam/io/vcf/util.clj 92.77% <100.00%> (+0.14%) ⬆️

Copy link
Member

@alumi alumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this feature! Looks good to me 👍
I have a minor suggestion for a possible improvement.

src/cljam/io/vcf/util.clj Outdated Show resolved Hide resolved
@athos athos force-pushed the feature/genotype-unphasing branch from d528a4c to 6a5a537 Compare June 1, 2023 07:28
@athos athos requested a review from a team as a code owner June 1, 2023 07:28
@athos athos removed the request for review from a team June 1, 2023 07:51
Copy link
Contributor

@niyarin niyarin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alumi alumi merged commit 0da23f7 into master Jun 1, 2023
@alumi alumi deleted the feature/genotype-unphasing branch June 1, 2023 08:01
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