Skip to content

Commit

Permalink
adding missing registrations in kryo
Browse files Browse the repository at this point in the history
some classes were missing registration in kryo which causes less efficient serialization
adding registrations for a number of classes that MarkDuplicatesSpark needs that weren't registered yet

notably, BAMRecord wasn't registered to use the correct serializer which could cause major inefficiencies
it's not clear what circumstances we're serializing BAMRecord instead of SAMRecordToGATKReadAdapter so how much this will help is not obvious
  • Loading branch information
lbergelson committed Feb 23, 2018
1 parent f114dc0 commit d0c0d50
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.serializers.FieldSerializer;
import de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer;
import htsjdk.samtools.SAMRecord;
import htsjdk.samtools.*;
import org.apache.spark.serializer.KryoRegistrator;
import org.bdgenomics.adam.serialization.ADAMKryoRegistrator;
import org.broadinstitute.hellbender.utils.read.SAMRecordToGATKReadAdapter;
Expand All @@ -17,7 +17,7 @@
*/
public class GATKRegistrator implements KryoRegistrator {

private ADAMKryoRegistrator ADAMregistrator;
private final ADAMKryoRegistrator ADAMregistrator;

public GATKRegistrator() {
this.ADAMregistrator = new ADAMKryoRegistrator();
Expand All @@ -43,6 +43,13 @@ public void registerClasses(Kryo kryo) {
kryo.register(SAMRecordToGATKReadAdapter.class, new SAMRecordToGATKReadAdapterSerializer());

kryo.register(SAMRecord.class, new SAMRecordSerializer());
kryo.register(BAMRecord.class, new SAMRecordSerializer());

kryo.register(SAMFileHeader.class);
kryo.register(SAMFileHeader.GroupOrder.class);
kryo.register(SAMFileHeader.SortOrder.class);
kryo.register(SAMProgramRecord.class);
kryo.register(SAMReadGroupRecord.class);

//register to avoid writing the full name of this class over and over
kryo.register(PairedEnds.class, new FieldSerializer<>(kryo, PairedEnds.class));
Expand Down

0 comments on commit d0c0d50

Please sign in to comment.