Git Product home page Git Product logo

Comments (4)

Hua-Zhou avatar Hua-Zhou commented on August 21, 2024

A good point. I’ll fix it.

On Jul 8, 2016, at 1:03 PM, Eric Sobel [email protected] wrote:

A trivial edge case issue: In either summarize() function if m = 0 (i.e., the SnpArray is empty), then each calculation of maf includes a divide by zero. I suggest simply making those statements conditional on m > 0.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #4, or mute the thread https://github.com/notifications/unsubscribe/AEwHsSKr5U3uGSkADgIvTP2rwVqqXpV2ks5qTq0QgaJpZM4JIWhh.

from snparrays.jl.

Hua-Zhou avatar Hua-Zhou commented on August 21, 2024

One a second thought, the cases m=0 or a column having all missing genotypes do produce NaN for maf. Try

s = SnpArray(0, 5)
summarize(s)

gives

([NaN,NaN,NaN,NaN,NaN],Bool[false,false,false,false,false],[0,0,0,0,0],Int64[])

This is a sensible answer to me: maf cannot be calculated in these cases. Is this better to keep the current code?

from snparrays.jl.

ericsobel avatar ericsobel commented on August 21, 2024

I see your point. Of course if there are no genotypes, then which is the minor allele is also unknown (rather than the "allele2" implied by maf == NaN). I don't have a strong feeling about it, but I'd think with no genotypes, the minor (and the major) allele frequency should be 0.0 (since the count of alleles is zero), and the minor_allele boolean could be true or false. Edge cases certainly can be ambiguous. If you want to leave the code as is, I'm OK with that. (I've now rewritten Ken's code where he used summarize with a possibly empty SnpArray.)

from snparrays.jl.

Hua-Zhou avatar Hua-Zhou commented on August 21, 2024

I would follow the convention for regular array:

a = randn(0, 5)
mean(a)

produces

 NaN  NaN  NaN  NaN  NaN

That means no change to the current summarize functions, which output NaN for maf if input SnpArray has 0 rows or some columns have all missing genotypes.

from snparrays.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.