use of org.ensembl.database.homo_sapiens_core.Tables.GENE 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;
}
Aggregations