-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for accessing the whole GO data
- Loading branch information
1 parent
c673e22
commit 4e5a182
Showing
4 changed files
with
89 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.bio4j.data.go.test | ||
|
||
import org.scalatest.FunSuite | ||
import com.bio4j.data.go._ | ||
import scala.xml._ | ||
|
||
class OBOXML extends FunSuite { | ||
|
||
private lazy val MyXML = new factory.XMLLoader[Elem] { | ||
|
||
private lazy val parserFactory = { | ||
val f0 = javax.xml.parsers.SAXParserFactory.newInstance() | ||
f0.setNamespaceAware(false) | ||
f0.setValidating(false) | ||
f0.setXIncludeAware(false) | ||
f0 | ||
} | ||
|
||
private lazy val parser0 = parserFactory.newSAXParser() | ||
|
||
override def parser: SAXParser = parser0 | ||
} | ||
|
||
|
||
test("parse whole GO oboxml file, access all data") { | ||
|
||
val go = oboxml.GOOBOXML(MyXML.loadFile("go_daily-termdb.obo-xml")) | ||
|
||
val terms = go.terms | ||
println { s"number of terms: ${terms.size}" } | ||
|
||
terms foreach { term => | ||
|
||
val id = term.ID | ||
val name = term.name | ||
val definition = term.definition | ||
val namespace = term.namespace | ||
val comments = term.comments | ||
} | ||
|
||
val isA = go.isA | ||
println { s"number of isA: ${isA.size}" } | ||
|
||
isA foreach { rel => | ||
|
||
val source = rel.sourceID | ||
val target = rel.targetID | ||
} | ||
|
||
val partOf = go.partOf | ||
println { s"number of partOf: ${partOf.size}" } | ||
|
||
partOf foreach { rel => | ||
|
||
val source = rel.sourceID | ||
val target = rel.targetID | ||
} | ||
|
||
val regulates = go.regulates | ||
println { s"number of regulates: ${regulates.size}" } | ||
|
||
regulates foreach { rel => | ||
|
||
val source = rel.sourceID | ||
val target = rel.targetID | ||
} | ||
|
||
val positivelyRegulates = go.positivelyRegulates | ||
println { s"number of positivelyRegulates: ${positivelyRegulates.size}" } | ||
|
||
positivelyRegulates foreach { rel => | ||
|
||
val source = rel.sourceID | ||
val target = rel.targetID | ||
} | ||
|
||
val negativelyRegulates = go.negativelyRegulates | ||
println { s"number of negativelyRegulates: ${negativelyRegulates.size}" } | ||
|
||
negativelyRegulates foreach { rel => | ||
|
||
val source = rel.sourceID | ||
val target = rel.targetID | ||
} | ||
} | ||
} |