snps icon indicating copy to clipboard operation
snps copied to clipboard

allow sex dedup determination

Open afaulconbridge opened this issue 4 years ago • 3 comments

When deduplicating sex chromosomes is a useful thing to do. However, in some conditions the default methods of sex detection can give incorrect results e.g. when homozygous reference alleles are omitted from the source such as in whole-exome or whole-genome. Therefore it is useful to be able to specify the sex detection method used when deciding how to deduplicate the sex chromosomes.

This PR both supports the existing use of a boolean for deduplicate_XY_chrom as well as using a String that can be passed to determine_sex() as the chrom parameter.

( I'll probably have another PR soon for improvements to determine_sex() itself. )

afaulconbridge avatar Nov 24 '20 21:11 afaulconbridge

Codecov Report

Merging #114 (e535507) into develop (91bfccf) will increase coverage by 1.37%. The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #114      +/-   ##
===========================================
+ Coverage    92.98%   94.36%   +1.37%     
===========================================
  Files            8        8              
  Lines         1468     1419      -49     
  Branches       252      252              
===========================================
- Hits          1365     1339      -26     
+ Misses          65       41      -24     
- Partials        38       39       +1     
Impacted Files Coverage Δ
src/snps/snps.py 95.49% <0.00%> (+0.88%) :arrow_up:
src/snps/io/reader.py 97.87% <0.00%> (-0.02%) :arrow_down:
src/snps/resources.py 94.73% <0.00%> (+0.03%) :arrow_up:
src/snps/ensembl.py 70.73% <0.00%> (+39.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 91bfccf...87fc45d. Read the comment docs.

codecov-io avatar Nov 24 '20 22:11 codecov-io

Hmm, interesting idea. I like it because it only has to be set in one place, and can be used in many as a default. It would still have to be overridable on specific invocations, but that shouldn't be a problem.

I'll have a try with that approach and see how it works in practice.

afaulconbridge avatar Dec 03 '20 16:12 afaulconbridge

@apriha I've implemented the selection of sex detection method as an instance variable, so it can be shared between methods easily. Theres are some further improvements to be made (e.g. a separate threshold to detect low heterozygous X chromosomes as male, number of non-null Y snps as a proportion of the total snps) but they are separate issues for the future.

afaulconbridge avatar Dec 23 '20 09:12 afaulconbridge