Search in sources :

Example 1 with HmfExonRegion

use of com.hartwig.hmftools.common.region.hmfslicer.HmfExonRegion in project hmftools by hartwigmedical.

the class CanonicalTranscriptFactory method create.

@VisibleForTesting
@NotNull
static CanonicalTranscript create(final HmfGenomeRegion region) {
    long codingStart = region.codingStart();
    long codingEnd = region.codingEnd();
    long exonStart = 0;
    long exonEnd = 0;
    long exonBases = 0;
    int codingBases = 0;
    int codingExons = 0;
    for (final HmfExonRegion exon : region.exome()) {
        if (exonStart == 0) {
            exonStart = exon.start();
        }
        if (codingStart <= exon.end() && codingEnd >= exon.start()) {
            codingExons++;
            codingBases += Math.min(exon.end(), codingEnd) - Math.max(exon.start(), codingStart) + 1;
        }
        exonBases += exon.bases();
        exonEnd = exon.end();
    }
    return ImmutableCanonicalTranscript.builder().from(region).geneID(region.geneID()).geneStart(region.geneStart()).geneEnd(region.geneEnd()).gene(region.gene()).exons(region.exome().size()).codingExons(codingExons).exonStart(exonStart).exonEnd(exonEnd).exonBases(exonBases).strand(region.strand()).codingStart(codingStart).codingEnd(codingEnd).codingBases(Math.max(0, codingBases - 3)).build();
}
Also used : HmfExonRegion(com.hartwig.hmftools.common.region.hmfslicer.HmfExonRegion) VisibleForTesting(com.google.common.annotations.VisibleForTesting) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 HmfExonRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfExonRegion)1 NotNull (org.jetbrains.annotations.NotNull)1