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

[ADAM-1190] Manually (un)pack IndelRealignmentTarget set. #1191

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -198,13 +198,22 @@ class IndelRealignmentTarget(

class TargetSetSerializer extends Serializer[TargetSet] {

val irts = new IndelRealignmentTargetSerializer()

def write(kryo: Kryo, output: Output, obj: TargetSet) = {
kryo.writeClassAndObject(output, obj.set.toList)
output.writeInt(obj.set.size)
obj.set.foreach(innerObj => {
irts.write(kryo, output, innerObj)
})
}

def read(kryo: Kryo, input: Input, klazz: Class[TargetSet]): TargetSet = {
new TargetSet(new TreeSet()(TargetOrdering)
.union(kryo.readClassAndObject(input).asInstanceOf[List[IndelRealignmentTarget]].toSet))
val size = input.readInt()
val array = new Array[IndelRealignmentTarget](size)
(0 until size).foreach(i => {
array(i) = irts.read(kryo, input, classOf[IndelRealignmentTarget])
})
new TargetSet(TreeSet(array: _*)(TargetOrdering))
}
}

Expand Down