001/** 002 * Copyright (C) 2010-2015 The Roslin Institute <contact andy.law@roslin.ed.ac.uk> 003 * 004 * This file is part of JEnsembl: a Java API to Ensembl data sources developed by the 005 * Bioinformatics Group at The Roslin Institute, The Royal (Dick) School of 006 * Veterinary Studies, University of Edinburgh. 007 * 008 * Project hosted at: http://jensembl.sourceforge.net 009 * 010 * This is free software: you can redistribute it and/or modify 011 * it under the terms of the GNU General Public License (version 3) as published by 012 * the Free Software Foundation. 013 * 014 * This software is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public License 020 * in this software distribution. If not, see: http://opensource.org/licenses/gpl-3.0.html 021 */ 022package uk.ac.roslin.ensembl.demo; 023 024import uk.ac.roslin.ensembl.config.DBConnection.DataSource; 025import uk.ac.roslin.ensembl.config.EnsemblDBType; 026import uk.ac.roslin.ensembl.dao.database.DBRegistry; 027import uk.ac.roslin.ensembl.dao.database.DBSingleSpeciesCoreDatabase; 028import uk.ac.roslin.ensembl.dao.database.DBSpecies; 029import uk.ac.roslin.ensembl.dao.database.factory.DBDAOSingleSpeciesCoreFactory; 030import uk.ac.roslin.ensembl.datasourceaware.core.DAGene; 031import uk.ac.roslin.ensembl.datasourceaware.core.DATranscript; 032 033 034public class Analysis { 035 036 public static void main(String[] args) throws Exception { 037 038 DBRegistry reg = DBRegistry.createRegistryForDataSource(DataSource.ENSEMBLDB); 039 DBSpecies hs = reg.getSpeciesByAlias("human"); 040 041 System.out.println("\nvCurrent"); 042 DAGene brca2 = hs.getGeneByStableID("ENSG00000139618"); 043 System.out.println("GENE: "+brca2.getStableID()); 044 System.out.println("DB VERSION: "+brca2.getDaoFactory().getDBVersion()); 045 System.out.println("getAnalysisId "+brca2.getAnalysisID()); 046 System.out.println("getAnalysis "+brca2.getAnalysis().getDisplayLabel()); 047 System.out.println("getAnalysisDescription "+brca2.getAnalysis().getDescription()); 048 049 System.out.println("\nv71"); 050 DAGene brca = hs.getGeneByStableID("ENSG00000139618", "71" ); 051 System.out.println("GENE: "+brca.getStableID()); 052 System.out.println("DB VERSION: "+brca.getDaoFactory().getDBVersion()); 053 System.out.println("getAnalysisId "+brca.getAnalysisID()); 054 System.out.println("getAnalysis "+brca.getAnalysis().getDisplayLabel()); 055 System.out.println("getAnalysisDescription "+brca.getAnalysis().getDescription()); 056 057 System.out.println("\nLazy loaded v69"); 058 DBDAOSingleSpeciesCoreFactory f = ((DBSingleSpeciesCoreDatabase)hs.getDatabaseByTypeAndVersion( 059 EnsemblDBType.core, "69")).getCoreFactory(); 060 DAGene gene = new DAGene(f); 061 gene.setStableID("ENSG00000139618"); 062 //a gene with a factory and stableID can lazyload everything else.... 063 System.out.println("GENE: "+gene.getStableID()); 064 System.out.println("DB VERSION: "+gene.getDaoFactory().getDBVersion()); 065 System.out.println("getAnalysisId "+gene.getAnalysisID()); 066 System.out.println("getAnalysis "+gene.getAnalysis().getDisplayLabel()); 067 System.out.println("getAnalysisDescription "+gene.getAnalysis().getDescription()); 068 069 System.out.println("\nv68"); 070 brca2 = hs.getGeneByStableID("ENSG00000139618", "68"); 071 System.out.println("GENE: "+brca2.getStableID()); 072 System.out.println("DB VERSION: "+brca2.getDaoFactory().getDBVersion()); 073 System.out.println("getAnalysisId "+brca2.getAnalysisID()); 074 System.out.println("getAnalysis "+brca2.getAnalysis().getDisplayLabel()); 075 System.out.println("getAnalysisDescription "+brca2.getAnalysis().getDescription()); 076 077 078 DATranscript canonicalTranscript = brca2.getCanonicalTranscript(); 079 System.out.println("canonical Transcript" + canonicalTranscript.getStableID()); 080 System.out.println("getAnalysisId "+canonicalTranscript.getAnalysisID()); 081 System.out.println("getAnalysis "+canonicalTranscript.getAnalysis().getDisplayLabel()); 082 System.out.println("getAnalysisDescription "+canonicalTranscript.getAnalysis().getDescription()); 083 084 } 085}