Search in sources :

Example 1 with UnmodifiableCollectionsSerializer

use of de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer in project gatk by broadinstitute.

the class GATKRegistrator method registerClasses.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void registerClasses(Kryo kryo) {
    // JsonSerializer is needed for the Google Genomics classes like Read and Reference.
    kryo.register(Read.class, new JsonSerializer<Read>());
    //relatively inefficient serialization of Collections created with Collections.nCopies(), without this
    //any Collection created with Collections.nCopies fails to serialize at run time
    kryo.register(Collections.nCopies(2, "").getClass(), new FieldSerializer<>(kryo, Collections.nCopies(2, "").getClass()));
    // htsjdk.variant.variantcontext.CommonInfo has a Map<String, Object> that defaults to
    // a Collections.unmodifiableMap. This can't be handled by the version of kryo used in Spark, it's fixed
    // in newer versions (3.0.x), but we can't use those because of incompatibility with Spark. We just include the
    // fix here.
    // We are tracking this issue with (#874)
    kryo.register(Collections.unmodifiableMap(Collections.EMPTY_MAP).getClass(), new UnmodifiableCollectionsSerializer());
    kryo.register(Collections.unmodifiableList(Collections.EMPTY_LIST).getClass(), new UnmodifiableCollectionsSerializer());
    kryo.register(SAMRecordToGATKReadAdapter.class, new SAMRecordToGATKReadAdapterSerializer());
    kryo.register(SAMRecord.class, new SAMRecordSerializer());
    //register to avoid writing the full name of this class over and over
    kryo.register(PairedEnds.class, new FieldSerializer<>(kryo, PairedEnds.class));
    // register the ADAM data types using Avro serialization, including:
    //     AlignmentRecord
    //     Genotype
    //     Variant
    //     DatabaseVariantAnnotation
    //     NucleotideContigFragment
    //     Contig
    //     StructuralVariant
    //     VariantCallingAnnotations
    //     VariantEffect
    //     DatabaseVariantAnnotation
    //     Dbxref
    //     Feature
    //     ReferencePosition
    //     ReferencePositionPair
    //     SingleReadBucket
    //     IndelRealignmentTarget
    //     TargetSet
    //     ZippedTargetSet
    ADAMregistrator.registerClasses(kryo);
}
Also used : Read(com.google.api.services.genomics.model.Read) UnmodifiableCollectionsSerializer(de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer) PairedEnds(org.broadinstitute.hellbender.utils.read.markduplicates.PairedEnds)

Aggregations

Read (com.google.api.services.genomics.model.Read)1 UnmodifiableCollectionsSerializer (de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer)1 PairedEnds (org.broadinstitute.hellbender.utils.read.markduplicates.PairedEnds)1