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.dao.database.DBRegistry; 026import uk.ac.roslin.ensembl.dao.database.DBSpecies; 027import uk.ac.roslin.ensembl.datasourceaware.DAXRef; 028import uk.ac.roslin.ensembl.datasourceaware.core.DAGene; 029import uk.ac.roslin.ensembl.datasourceaware.core.DATranscript; 030import uk.ac.roslin.ensembl.datasourceaware.core.DATranslation; 031 032public class XRefs { 033 034 public static void main(String[] args) throws Exception { 035 036 DBRegistry eReg = DBRegistry.createRegistryForDataSource(DataSource.ENSEMBLDB); 037 DBSpecies sp = eReg.getSpeciesByAlias("human"); 038 039 DAGene g = sp.getGeneByStableID("ENSG00000006128"); 040 int count = 0; 041 System.out.println(g.getStableID() + " " + g.getDisplayName()); 042 for (DAXRef x : g.getAllXRefs()) { 043 044 System.out.println("XREF " + ++count 045 + " : " + x.getPrimaryAccession()); 046 047 System.out.println("\tDBHashID: " + x.getHashID()); 048 System.out.println("\tDBName: " + x.getDBDisplayName()); 049 System.out.println("\tDescription: " + x.getDescription()); 050 System.out.println("\tDisplayID: " + x.getDisplayID()); 051 System.out.println("\tInfo: " + x.getInfo()); 052 System.out.println("\tInfoType: " + x.getInfoType()); 053 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 054 System.out.println("\tVersion: " + x.getVersion()); 055 } 056 System.out.println(""); 057 for (DAXRef x : g.getVegaXRefs()) { 058 059 System.out.println("Vega XREF " + ++count 060 + " : " + x.getPrimaryAccession()); 061 062 System.out.println("\tDBHashID: " + x.getHashID()); 063 System.out.println("\tDBName: " + x.getDBDisplayName()); 064 System.out.println("\tDescription: " + x.getDescription()); 065 System.out.println("\tDisplayID: " + x.getDisplayID()); 066 System.out.println("\tInfo: " + x.getInfo()); 067 System.out.println("\tInfoType: " + x.getInfoType()); 068 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 069 System.out.println("\tVersion: " + x.getVersion()); 070 } 071 System.out.println(""); 072 073 DAXRef dx = g.getDisplayXRef(); 074 System.out.println("Display XREF " + ++count 075 + " : " + dx.getPrimaryAccession()); 076 077 System.out.println("\tDBHashID: " + dx.getHashID()); 078 System.out.println("\tDBName: " + dx.getDBDisplayName()); 079 System.out.println("\tDescription: " + dx.getDescription()); 080 System.out.println("\tDisplayID: " + dx.getDisplayID()); 081 System.out.println("\tInfo: " + dx.getInfo()); 082 System.out.println("\tInfoType: " + dx.getInfoType()); 083 System.out.println("\tPrimaryAccession: " + dx.getPrimaryAccession()); 084 System.out.println("\tVersion: " + dx.getVersion()); 085 086 System.out.println(""); 087 System.out.println(""); 088 System.out.println(""); 089 090 091 DATranscript t = sp.getTranscriptByStableID("ENST00000319273"); 092 count = 0; 093 System.out.println(t.getStableID() + " " + t.getDisplayName()); 094 for (DAXRef x : t.getAllXRefs()) { 095 096 System.out.println("XREF " + ++count 097 + " : " + x.getPrimaryAccession()); 098 099 System.out.println("\tDBHashID: " + x.getHashID()); 100 System.out.println("\tDBName: " + x.getDBDisplayName()); 101 System.out.println("\tDescription: " + x.getDescription()); 102 System.out.println("\tDisplayID: " + x.getDisplayID()); 103 System.out.println("\tInfo: " + x.getInfo()); 104 System.out.println("\tInfoType: " + x.getInfoType()); 105 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 106 System.out.println("\tVersion: " + x.getVersion()); 107 } 108 System.out.println(""); 109 for (DAXRef x : t.getVegaXRefs()) { 110 111 System.out.println("Vega XREF " + ++count 112 + " : " + x.getPrimaryAccession()); 113 114 System.out.println("\tDBHashID: " + x.getHashID()); 115 System.out.println("\tDBName: " + x.getDBDisplayName()); 116 System.out.println("\tDescription: " + x.getDescription()); 117 System.out.println("\tDisplayID: " + x.getDisplayID()); 118 System.out.println("\tInfo: " + x.getInfo()); 119 System.out.println("\tInfoType: " + x.getInfoType()); 120 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 121 System.out.println("\tVersion: " + x.getVersion()); 122 } 123 System.out.println(""); 124 for (DAXRef x : t.getCCDSXRefs()) { 125 126 System.out.println("CCDS XREF " + ++count 127 + " : " + x.getPrimaryAccession()); 128 129 System.out.println("\tDBHashID: " + x.getHashID()); 130 System.out.println("\tDBName: " + x.getDBDisplayName()); 131 System.out.println("\tDescription: " + x.getDescription()); 132 System.out.println("\tDisplayID: " + x.getDisplayID()); 133 System.out.println("\tInfo: " + x.getInfo()); 134 System.out.println("\tInfoType: " + x.getInfoType()); 135 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 136 System.out.println("\tVersion: " + x.getVersion()); 137 } 138 System.out.println(""); 139 140 DAXRef dxr = t.getDisplayXRef(); 141 System.out.println("Display XREF " + ++count 142 + " : " + dxr.getPrimaryAccession()); 143 144 System.out.println("\tDBHashID: " + dxr.getHashID()); 145 System.out.println("\tDBName: " + dxr.getDBDisplayName()); 146 System.out.println("\tDescription: " + dxr.getDescription()); 147 System.out.println("\tDisplayID: " + dxr.getDisplayID()); 148 System.out.println("\tInfo: " + dxr.getInfo()); 149 System.out.println("\tInfoType: " + dxr.getInfoType()); 150 System.out.println("\tPrimaryAccession: " + dxr.getPrimaryAccession()); 151 System.out.println("\tVersion: " + dxr.getVersion()); 152 153 System.out.println(""); 154 System.out.println(""); 155 System.out.println(""); 156 157 DATranslation tr = sp.getTranslationByStableID("ENSP00000321106"); 158 count = 0; 159 System.out.println(tr.getStableID() ); 160 for (DAXRef x : tr.getAllXRefs()) { 161 162 System.out.println("XREF " + ++count 163 + " : " + x.getPrimaryAccession()); 164 165 System.out.println("\tDBHashID: " + x.getHashID()); 166 System.out.println("\tDBName: " + x.getDBDisplayName()); 167 System.out.println("\tDescription: " + x.getDescription()); 168 System.out.println("\tDisplayID: " + x.getDisplayID()); 169 System.out.println("\tInfo: " + x.getInfo()); 170 System.out.println("\tInfoType: " + x.getInfoType()); 171 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 172 System.out.println("\tVersion: " + x.getVersion()); 173 if (x.getEvidence()!=null ) { 174 System.out.println("\tEvidence: " + x.getEvidence()); 175 } 176 } 177 System.out.println(""); 178 for (DAXRef x : tr.getVegaXRefs()) { 179 180 System.out.println("Vega XREF " + ++count 181 + " : " + x.getPrimaryAccession()); 182 183 System.out.println("\tDBHashID: " + x.getHashID()); 184 System.out.println("\tDBName: " + x.getDBDisplayName()); 185 System.out.println("\tDescription: " + x.getDescription()); 186 System.out.println("\tDisplayID: " + x.getDisplayID()); 187 System.out.println("\tInfo: " + x.getInfo()); 188 System.out.println("\tInfoType: " + x.getInfoType()); 189 System.out.println("\tPrimaryAccession: " + x.getPrimaryAccession()); 190 System.out.println("\tVersion: " + x.getVersion()); 191 } 192 System.out.println(""); 193 194 195 196 197 198 } 199}