use of com.hartwig.hmftools.svannotation.annotations.Transcript in project hmftools by hartwigmedical.
the class GeneFusionData method from.
@NotNull
public static GeneFusionData from(@NotNull final GeneFusion fusion) {
final Transcript upstream = fusion.upstreamLinkedAnnotation();
final Transcript downstream = fusion.downstreamLinkedAnnotation();
return ImmutableGeneFusionData.builder().geneStart(upstream.geneName()).geneStartEntrezIds(upstream.parent().entrezIds()).geneContextStart(exonDescription(upstream)).geneStartTranscript(upstream.transcriptId()).geneEnd(downstream.geneName()).geneEndEntrezIds(downstream.parent().entrezIds()).geneContextEnd(exonDescription(downstream)).geneEndTranscript(downstream.transcriptId()).copies(ploidyToCopiesString(fusionPloidy(fusion))).cosmicURL(fusion.cosmicURL()).build();
}
use of com.hartwig.hmftools.svannotation.annotations.Transcript in project hmftools by hartwigmedical.
the class MySQLAnnotator method annotateBreakend.
@NotNull
private List<GeneAnnotation> annotateBreakend(@NotNull EnrichedStructuralVariant variant, final boolean isStart, @NotNull String chromosome, final long position) {
final List<GeneAnnotation> result = Lists.newArrayList();
final Result<?> genes = queryGenesOnChromosomeAndPosition(chromosome, position);
for (final Record gene : genes) {
final UInteger geneId = gene.get(GENE.GENE_ID);
final String geneName = gene.get(XREF.DISPLAY_LABEL);
final String geneStableId = gene.get(GENE.STABLE_ID);
final UInteger canonicalTranscriptId = gene.get(GENE.CANONICAL_TRANSCRIPT_ID);
final int geneStrand = gene.get(GENE.SEQ_REGION_STRAND);
final List<Integer> entrezIds = Arrays.stream(gene.get(ENTREZ_IDS, String.class).split(",")).map(Integer::parseInt).collect(Collectors.toList());
final String karyotypeBand = gene.get(KARYOTYPE_BAND, String.class);
final List<String> synonyms = context.select(XREF.DBPRIMARY_ACC).from(XREF).innerJoin(OBJECT_XREF).on(OBJECT_XREF.XREF_ID.eq(XREF.XREF_ID)).and(OBJECT_XREF.ENSEMBL_ID.eq(geneId)).and(OBJECT_XREF.ENSEMBL_OBJECT_TYPE.eq(ObjectXrefEnsemblObjectType.Gene)).fetch().stream().map(r -> r.get(XREF.DBPRIMARY_ACC)).collect(Collectors.toList());
final GeneAnnotation geneAnnotation = new GeneAnnotation(variant, isStart, geneName, geneStableId, geneStrand, synonyms, entrezIds, karyotypeBand);
final Result<?> transcripts = context.select(TRANSCRIPT.TRANSCRIPT_ID, TRANSCRIPT.STABLE_ID).from(TRANSCRIPT).where(TRANSCRIPT.GENE_ID.eq(geneId)).fetch();
for (final Record transcriptRecord : transcripts) {
Transcript transcript = buildTranscript(geneAnnotation, transcriptRecord, position, canonicalTranscriptId, geneStrand > 0);
if (transcript != null) {
geneAnnotation.addTranscript(transcript);
}
}
if (!geneAnnotation.transcripts().isEmpty()) {
result.add(geneAnnotation);
}
}
return result;
}
use of com.hartwig.hmftools.svannotation.annotations.Transcript in project hmftools by hartwigmedical.
the class GeneDisruptionData method from.
@NotNull
public static GeneDisruptionData from(@NotNull final GeneDisruption disruption) {
final Transcript transcript = disruption.linkedAnnotation();
final GeneAnnotation gene = transcript.parent();
// TODO (KODU): Add upstream/downstream annotation
// final boolean upstream = gene.variant().orientation(gene.isStart()) > 0;
// + (upstream ? " Upstream" : " Downstream");
final String geneContext = exonDescription(transcript);
return ImmutableGeneDisruptionData.builder().chromosome(gene.variant().chromosome(gene.isStart())).gene(gene.geneName()).geneContext(geneContext).type(gene.variant().type().name()).copies(ploidyToCopiesString(gene.variant().ploidy())).chromosomeBand(gene.karyotypeBand()).build();
}
use of com.hartwig.hmftools.svannotation.annotations.Transcript in project hmftools by hartwigmedical.
the class MySQLAnnotator method buildTranscript.
@Nullable
private Transcript buildTranscript(@NotNull GeneAnnotation parent, @NotNull Record transcript, long position, @NotNull UInteger canonicalTranscriptId, boolean isForwardStrand) {
final UInteger transcriptId = transcript.get(TRANSCRIPT.TRANSCRIPT_ID);
final boolean canonical = transcriptId.equals(canonicalTranscriptId);
final String transcriptStableId = transcript.get(TRANSCRIPT.STABLE_ID);
final Record exonLeft = context.select(EXON_TRANSCRIPT.RANK, EXON.PHASE, EXON.END_PHASE).from(EXON_TRANSCRIPT).innerJoin(EXON).on(EXON.EXON_ID.eq(EXON_TRANSCRIPT.EXON_ID)).where(EXON_TRANSCRIPT.TRANSCRIPT_ID.eq(transcriptId)).and(EXON.SEQ_REGION_START.le(UInteger.valueOf(position))).orderBy(EXON.SEQ_REGION_START.desc()).limit(1).fetchOne();
final Record exonRight = context.select(EXON_TRANSCRIPT.RANK, EXON.PHASE, EXON.END_PHASE).from(EXON_TRANSCRIPT).innerJoin(EXON).on(EXON.EXON_ID.eq(EXON_TRANSCRIPT.EXON_ID)).where(EXON_TRANSCRIPT.TRANSCRIPT_ID.eq(transcriptId)).and(EXON.SEQ_REGION_END.ge(UInteger.valueOf(position))).orderBy(EXON.SEQ_REGION_END.asc()).limit(1).fetchOne();
final int exonMax = context.select(EXON_TRANSCRIPT.RANK).from(EXON_TRANSCRIPT).where(EXON_TRANSCRIPT.TRANSCRIPT_ID.eq(transcriptId)).orderBy(EXON_TRANSCRIPT.RANK.desc()).limit(1).fetchOne().value1();
final int exonUpstream;
final int exonUpstreamPhase;
final int exonDownstream;
final int exonDownstreamPhase;
if (isForwardStrand) {
exonUpstream = exonLeft == null ? 0 : exonLeft.get(EXON_TRANSCRIPT.RANK);
exonUpstreamPhase = exonLeft == null ? -1 : exonLeft.get(EXON.END_PHASE);
exonDownstream = exonRight == null ? 0 : exonRight.get(EXON_TRANSCRIPT.RANK);
exonDownstreamPhase = exonRight == null ? -1 : exonRight.get(EXON.PHASE);
} else {
exonDownstream = exonLeft == null ? 0 : exonLeft.get(EXON_TRANSCRIPT.RANK);
exonDownstreamPhase = exonLeft == null ? -1 : exonLeft.get(EXON.PHASE);
exonUpstream = exonRight == null ? 0 : exonRight.get(EXON_TRANSCRIPT.RANK);
exonUpstreamPhase = exonRight == null ? -1 : exonRight.get(EXON.END_PHASE);
}
if (exonUpstream > 0 && exonDownstream == 0) {
// NERA: past the last exon
return null;
} else {
return new Transcript(parent, transcriptStableId, exonUpstream, exonUpstreamPhase, exonDownstream, exonDownstreamPhase, exonMax, canonical);
}
}
use of com.hartwig.hmftools.svannotation.annotations.Transcript in project hmftools by hartwigmedical.
the class StructuralVariantAnalyzer method toReportableGeneFusions.
@NotNull
private List<GeneFusion> toReportableGeneFusions(@NotNull List<List<Pair<Transcript, Transcript>>> fusionsPerVariant) {
final List<GeneFusion> result = Lists.newArrayList();
for (final List<Pair<Transcript, Transcript>> fusions : fusionsPerVariant) {
Optional<Pair<Transcript, Transcript>> reportableFusion = determineReportableFusion(fusions);
for (final Pair<Transcript, Transcript> fusion : fusions) {
final Transcript upstream = fusion.getLeft();
final Transcript downstream = fusion.getRight();
final CosmicFusionData cosmic = transcriptsMatchKnownFusion(upstream, downstream);
final boolean promiscuousEnd = oneEndPromiscuous(upstream, downstream);
final boolean reportable = reportableFusion.isPresent() && reportableFusion.get() == fusion && (cosmic != null || promiscuousEnd);
final GeneFusion geneFusion = ImmutableGeneFusion.builder().reportable(reportable).upstreamLinkedAnnotation(upstream).downstreamLinkedAnnotation(downstream).cosmicURL(cosmic != null ? cosmic.cosmicURL() : "").build();
result.add(geneFusion);
}
}
return result;
}
Aggregations