Search in sources :

Example 1 with GENE

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;
}
Also used : UInteger(org.jooq.types.UInteger) EXON_TRANSCRIPT(org.ensembl.database.homo_sapiens_core.Tables.EXON_TRANSCRIPT) Arrays(java.util.Arrays) Connection(java.sql.Connection) DSL(org.jooq.impl.DSL) Xref(org.ensembl.database.homo_sapiens_core.tables.Xref) StructuralVariantAnnotation(com.hartwig.hmftools.svannotation.annotations.StructuralVariantAnnotation) SEQ_REGION(org.ensembl.database.homo_sapiens_core.Tables.SEQ_REGION) DSL.decode(org.jooq.impl.DSL.decode) ObjectXrefEnsemblObjectType(org.ensembl.database.homo_sapiens_core.enums.ObjectXrefEnsemblObjectType) TRANSCRIPT(org.ensembl.database.homo_sapiens_core.Tables.TRANSCRIPT) Condition(org.jooq.Condition) SQLException(java.sql.SQLException) Lists(com.google.common.collect.Lists) KARYOTYPE(org.ensembl.database.homo_sapiens_core.Tables.KARYOTYPE) UInteger(org.jooq.types.UInteger) GeneStatus(org.ensembl.database.homo_sapiens_core.enums.GeneStatus) DSLContext(org.jooq.DSLContext) SQLDialect(org.jooq.SQLDialect) EnrichedStructuralVariant(com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant) Record(org.jooq.Record) GeneAnnotation(com.hartwig.hmftools.svannotation.annotations.GeneAnnotation) OBJECT_XREF(org.ensembl.database.homo_sapiens_core.Tables.OBJECT_XREF) Result(org.jooq.Result) Collectors(java.util.stream.Collectors) Transcript(com.hartwig.hmftools.svannotation.annotations.Transcript) XREF(org.ensembl.database.homo_sapiens_core.Tables.XREF) COORD_SYSTEM(org.ensembl.database.homo_sapiens_core.Tables.COORD_SYSTEM) Nullable(org.jetbrains.annotations.Nullable) EXON(org.ensembl.database.homo_sapiens_core.Tables.EXON) List(java.util.List) DSL.groupConcatDistinct(org.jooq.impl.DSL.groupConcatDistinct) GENE(org.ensembl.database.homo_sapiens_core.Tables.GENE) NotNull(org.jetbrains.annotations.NotNull) DriverManager(java.sql.DriverManager) GeneAnnotation(com.hartwig.hmftools.svannotation.annotations.GeneAnnotation) Transcript(com.hartwig.hmftools.svannotation.annotations.Transcript) UInteger(org.jooq.types.UInteger) Record(org.jooq.Record) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Lists (com.google.common.collect.Lists)1 EnrichedStructuralVariant (com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant)1 GeneAnnotation (com.hartwig.hmftools.svannotation.annotations.GeneAnnotation)1 StructuralVariantAnnotation (com.hartwig.hmftools.svannotation.annotations.StructuralVariantAnnotation)1 Transcript (com.hartwig.hmftools.svannotation.annotations.Transcript)1 Connection (java.sql.Connection)1 DriverManager (java.sql.DriverManager)1 SQLException (java.sql.SQLException)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 COORD_SYSTEM (org.ensembl.database.homo_sapiens_core.Tables.COORD_SYSTEM)1 EXON (org.ensembl.database.homo_sapiens_core.Tables.EXON)1 EXON_TRANSCRIPT (org.ensembl.database.homo_sapiens_core.Tables.EXON_TRANSCRIPT)1 GENE (org.ensembl.database.homo_sapiens_core.Tables.GENE)1 KARYOTYPE (org.ensembl.database.homo_sapiens_core.Tables.KARYOTYPE)1 OBJECT_XREF (org.ensembl.database.homo_sapiens_core.Tables.OBJECT_XREF)1 SEQ_REGION (org.ensembl.database.homo_sapiens_core.Tables.SEQ_REGION)1 TRANSCRIPT (org.ensembl.database.homo_sapiens_core.Tables.TRANSCRIPT)1 XREF (org.ensembl.database.homo_sapiens_core.Tables.XREF)1