syntax = "proto2";

package org.campagnelab.dl.varanalysis.protobuf;

option java_package = "org.campagnelab.dl.varanalysis.protobuf";

option optimize_for = SPEED;

/**
  Collection of segments.
*/
message SegmentInformationCollection {
    repeated SegmentInformation records = 1;
}

/**
One such message per segment in the genome that we observe.
*/
message SegmentInformation {

    /**  The position in the reference sequence of the genome. */
    optional ReferencePosition start_position = 1;

    optional ReferencePosition end_position = 2;

    /** Number of bases contained in this block/segment.
        Equals to end_position.location - start_position.location.  */
    optional uint32 length = 5;

    /** Aligned samples in this block/segment. */
    repeated Sample sample = 4;

}
/**
Keep segment information about a sample. More than one sample may be stored in an .ssi file, in which case the segment
positions are garanteed to be aligned across samples.
*/
message Sample {

    repeated Base base = 1;

}


message Base {

    repeated float features = 1;

    repeated float labels = 2;

    /** Color of the chromosome that contains the genotype. Used to reconstitute hapolotype continuity for indels.
        Color is used to assemble called bases at successive positions into alleles, such as A--C from called alleles
        at four positions. There are exactly ploidy number of colors in this list. Each integer encodes the color of the
        chromosome that carries the allele. */
    repeated uint32 color=6;

    /** True genotype, in the format of a list of alleles, where A,B,C are single base alleles {A,C,T,G,-}
        found at the genomic site in this genome.
    */
    repeated string trueLabel = 3;

    /** The genotype before segment post-processing. */
    optional string prePostProcessingGenotype=10;

    /** The offset used when creating the record copy during post-processing. */
    optional uint32 offset=11;

    /** True when the base contains some counts for indels. This does not mean that the base contains a true
        indel, but simply that it contains a potential indel.
    */
    optional bool hasCandidateIndel=4;

    /** True when the base actually overlaps an indel in one of its alleles. This is the set of bases used
        to evaluate F1 over indels (at the base level). Other bases are used to evaluate performance of SNPs. */
    optional bool hasTrueIndel=5;

    /** True when this base has at least one allele that does not match the reference. Those bases where
    isVariant==true are used to estimate precision/recall and F1 for SNPs and indels.
    */
    optional bool isVariant=7;

    optional string referenceAllele=8;
    /**
        The formatted counts from the sbi record at this base.
    */
    optional string formattedCounts=9;

    /**
        The location of this base.
    */
    optional uint32 location = 12;

}

/**
A position in the genome.
*/
message ReferencePosition {


    optional uint32 reference_index = 2;

    optional string reference_id = 3;

    optional uint32 location = 1;
}