use of ubic.basecode.ontology.model.OntologyTerm in project Gemma by PavlidisLab.
the class GeneOntologyServiceTest method testGetTermForId.
@Test
public final void testGetTermForId() {
String id = "GO:0000310";
OntologyTerm termForId = GeneOntologyServiceTest.gos.getTermForId(id);
assertNotNull(termForId);
assertEquals("xanthine phosphoribosyltransferase activity", termForId.getTerm());
}
use of ubic.basecode.ontology.model.OntologyTerm in project Gemma by PavlidisLab.
the class GeneOntologyServiceTest method testAllParents.
@Test
public final void testAllParents() {
String id = "GO:0035242";
OntologyTerm termForId = GeneOntologyServiceTest.gos.getTermForId(id);
assertNotNull(termForId);
Collection<OntologyTerm> terms = GeneOntologyServiceTest.gos.getAllParents(termForId);
assertEquals(9, terms.size());
}
use of ubic.basecode.ontology.model.OntologyTerm in project Gemma by PavlidisLab.
the class GeneOntologyServiceTest method testGetParents.
@Test
public final void testGetParents() {
String id = "GO:0000014";
OntologyTerm termForId = GeneOntologyServiceTest.gos.getTermForId(id);
assertNotNull(termForId);
Collection<OntologyTerm> terms = GeneOntologyServiceTest.gos.getParents(termForId);
for (OntologyTerm term : terms) {
GeneOntologyServiceTest.log.info(term);
}
assertEquals(1, terms.size());
}
use of ubic.basecode.ontology.model.OntologyTerm in project Gemma by PavlidisLab.
the class GeneOntologyServiceTest method testAllParents2.
@Test
public final void testAllParents2() {
String id = "GO:0000006";
OntologyTerm termForId = GeneOntologyServiceTest.gos.getTermForId(id);
assertNotNull(termForId);
Collection<OntologyTerm> terms = GeneOntologyServiceTest.gos.getAllParents(termForId);
assertEquals(11, terms.size());
}
use of ubic.basecode.ontology.model.OntologyTerm in project Gemma by PavlidisLab.
the class DgaDatabaseImporter method processDGAFile.
private void processDGAFile() throws Exception {
this.initFinalOutputFile(false, true);
try (BufferedReader dgaReader = new BufferedReader(new FileReader(dgaFile))) {
String line;
while ((line = dgaReader.readLine()) != null) {
// found a term
if (line.contains("DOID")) {
// this being of the url could change make sure its still correct if something doesn't work
String valueUri = "http://purl.obolibrary.org/obo/DOID_" + this.findStringBetweenSpecialCharacter(line);
String geneId = this.findStringBetweenSpecialCharacter(dgaReader.readLine(), "GeneID");
String pubMedID = this.findStringBetweenSpecialCharacter(dgaReader.readLine(), "PubMedID");
String geneRIF = this.findStringBetweenSpecialCharacter(dgaReader.readLine(), "GeneRIF");
OntologyTerm o = this.findOntologyTermExistAndNotObsolote(valueUri);
if (o != null) {
String geneSymbol = this.geneToSymbol(new Integer(geneId));
// gene do exist
if (geneSymbol != null) {
String key = geneId + pubMedID + geneRIF + o.getUri();
// if deep >3 always keep
int howDeepIdTerm = this.findHowManyParents(o, 0);
// keep leaf or deep enough or uri=DOID_162(cancer)
if (!((o.getChildren(true).size() != 0 && howDeepIdTerm < 2) || o.getUri().contains("DOID_162"))) {
// negative
if ((geneRIF.contains(" is not ") || geneRIF.contains(" not associated ") || geneRIF.contains(" no significant ") || geneRIF.contains(" no association ") || geneRIF.contains(" not significant ") || geneRIF.contains(" not expressed ")) && !geneRIF.contains("is associated") && !geneRIF.contains("is significant") && !geneRIF.contains("is not only") && !geneRIF.contains("is expressed")) {
if (this.lineToInclude(key)) {
outFinalResults.write(geneSymbol + "\t" + geneId + "\t" + pubMedID + "\t" + "IEA" + "\t" + "GeneRIF: " + geneRIF + "\t" + DgaDatabaseImporter.DGA + "\t" + "" + "\t" + "" + "\t" + "" + "\t" + o.getUri() + "\t" + "1" + "\n");
}
} else // positive
{
if (this.lineToInclude(key)) {
outFinalResults.write(geneSymbol + "\t" + geneId + "\t" + pubMedID + "\t" + "IEA" + "\t" + "GeneRIF: " + geneRIF + "\t" + DgaDatabaseImporter.DGA + "\t" + "" + "\t" + "" + "\t" + "" + "\t" + o.getUri() + "\t" + "" + "\n");
}
}
outFinalResults.flush();
}
} else {
AbstractCLI.log.info("gene NCBI no found in Gemma discard this eidence: ncbi: " + geneId);
}
} else {
AbstractCLI.log.info("Ontology term not found in Ontology or obsolete : " + valueUri + " (normal that this happen sometimes)");
}
}
}
dgaReader.close();
outFinalResults.close();
}
}
Aggregations