Commit 54c312c0 authored by Sander Bollen's avatar Sander Bollen

set vs list

parent bcd47977
...@@ -69,17 +69,17 @@ trait PedigreeQscript extends MultiSampleQScript { qscript: QScript => ...@@ -69,17 +69,17 @@ trait PedigreeQscript extends MultiSampleQScript { qscript: QScript =>
* @return * @return
*/ */
def pedSamplesFromConfig(): List[PedSample] = { def pedSamplesFromConfig(): List[PedSample] = {
val totalSampleIds = samples.values.map(_.sampleId).toList
val withFam = samples.values.filter(_.family.isDefined) val withFam = samples.values.filter(_.family.isDefined)
val fathers = withFam.filter(_.father.isDefined).flatMap(_.father) val sampleIds = withFam.map(_.sampleId).toSet
val mothers = withFam.filter(_.mother.isDefined).flatMap(_.mother) val fathers = withFam.flatMap(_.father)
val mothers = withFam.flatMap(_.mother)
fathers.foreach { f => fathers.foreach { f =>
if (!withFam.map(_.sampleId).toList.contains(f)) { if (!sampleIds.contains(f)) {
Logging.addError(s"Father $f does not exist in samples") Logging.addError(s"Father $f does not exist in samples")
} }
} }
mothers.foreach { m => mothers.foreach { m =>
if (!withFam.map(_.sampleId).toList.contains(m)) { if (!sampleIds.contains(m)) {
Logging.addError(s"Mother $m does not exist in samples") Logging.addError(s"Mother $m does not exist in samples")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment