Commit 793b521d authored by Peter van 't Hof's avatar Peter van 't Hof

Fixed BIOPET-584

parent 2299e7a9
...@@ -154,7 +154,10 @@ object VcfWithVcf extends ToolCommand { ...@@ -154,7 +154,10 @@ object VcfWithVcf extends ToolCommand {
* @param header: header of secondary reader * @param header: header of secondary reader
* @return Map of fields and their values in secondary records * @return Map of fields and their values in secondary records
*/ */
def createFieldMap(fields: List[Fields], record: VariantContext, secondaryRecords: List[VariantContext], header: VCFHeader): Map[String, List[Any]] = { def createFieldMap(fields: List[Fields],
record: VariantContext,
secondaryRecords: List[VariantContext],
header: VCFHeader): Map[String, List[Any]] = {
val fieldMap = (for ( val fieldMap = (for (
f <- fields if secondaryRecords.exists(_.hasAttribute(f.inputField)) f <- fields if secondaryRecords.exists(_.hasAttribute(f.inputField))
) yield { ) yield {
...@@ -236,8 +239,8 @@ object VcfWithVcf extends ToolCommand { ...@@ -236,8 +239,8 @@ object VcfWithVcf extends ToolCommand {
* @return * @return
*/ */
def numberA(referenceRecord: VariantContext, annotateRecord: VariantContext, field: String): List[Any] = { def numberA(referenceRecord: VariantContext, annotateRecord: VariantContext, field: String): List[Any] = {
val refValues = referenceRecord.getAttributeAsList(field).toArray val refValues = annotateRecord.getAttributeAsList(field).toArray
annotateRecord. referenceRecord.
getAlternateAlleles.filter(referenceRecord.hasAlternateAllele). getAlternateAlleles.filter(referenceRecord.hasAlternateAllele).
map(x => referenceRecord.getAlternateAlleles.indexOf(x)). map(x => referenceRecord.getAlternateAlleles.indexOf(x)).
flatMap(x => refValues.lift(x)). flatMap(x => refValues.lift(x)).
...@@ -252,8 +255,8 @@ object VcfWithVcf extends ToolCommand { ...@@ -252,8 +255,8 @@ object VcfWithVcf extends ToolCommand {
* @return * @return
*/ */
def numberR(referenceRecord: VariantContext, annotateRecord: VariantContext, field: String): List[Any] = { def numberR(referenceRecord: VariantContext, annotateRecord: VariantContext, field: String): List[Any] = {
val refValues = referenceRecord.getAttributeAsList(field).toArray val refValues = annotateRecord.getAttributeAsList(field).toArray
annotateRecord. referenceRecord.
getAlleles. getAlleles.
filter(referenceRecord.hasAllele). filter(referenceRecord.hasAllele).
map(x => referenceRecord.getAlleles.indexOf(x)). map(x => referenceRecord.getAlleles.indexOf(x)).
......
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