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

Jb linreg #67

Merged
merged 5 commits into from
Nov 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ object LinearRegression {

val qtx = qtBc.value * x
val qty = qtyBc.value
val xxp = xx - (qtx dot qtx)
val xyp = xy - (qtx dot qty)
val yyp = yypBc.value
val xxp: Double = xx - (qtx dot qtx)
val xyp: Double = xy - (qtx dot qty)
val yyp: Double = yypBc.value

val b = xyp / xxp
val b: Double = xyp / xxp
val se = math.sqrt((yyp / xxp - b * b) / d)
val t = b / se
val p = 2 * tDistBc.value.cumulativeProbability(-math.abs(t))
Expand Down
11 changes: 5 additions & 6 deletions src/main/scala/org/broadinstitute/hail/methods/Pedigree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ case class Pedigree(trioMap: Map[Int, Trio]) {
.toMap
.groupByKey

def dadOf: Map[Int, Int] = completeTrios.map(t => (t.kid, t.dad.get)).toMap
def momOf: Map[Int, Int] = completeTrios.map(t => (t.kid, t.mom.get)).toMap
def sexOf: Map[Int, Sex] = completeTrios.map(t => (t.kid, t.sex.get)).toMap
def famOf: Map[Int, String] = trios.map(t => (t.kid, t.fam.get)).toMap
def phenoOf: Map[Int, Phenotype] = trios.map(t => (t.kid, t.pheno.get)).toMap
def dadOf: Map[Int, Int] = completeTrios.flatMap(t => t.dad.map(d => (t.kid, d))).toMap
def momOf: Map[Int, Int] = completeTrios.flatMap(t => t.mom.map(m => (t.kid, m))).toMap
def sexOf: Map[Int, Sex] = trios.flatMap(t => t.sex.map(s => (t.kid, s))).toMap
def famOf: Map[Int, String] = trios.flatMap(t => t.fam.map(f => (t.kid, f))).toMap
def phenoOf: Map[Int, Phenotype] = trios.flatMap(t => t.pheno.map(p => (t.kid, p))).toMap

def sexDefinedForAll: Boolean = trios.forall(_.sex.isDefined)

def phenoDefinedForAll: Boolean = trios.forall(_.pheno.isDefined)

def nSatisfying(filters: (Trio => Boolean)*): Int = trios.count(t => filters.forall(_(t)) )
Expand Down