Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Toxygates/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@
<!-- Set up WEB-INF/lib with jars -->
<delete dir="${wardir}/WEB-INF/lib" failonerror="false" />
<mkdir dir="${wardir}/WEB-INF/lib" />
<ivy:retrieve pattern="${wardir}/WEB-INF/lib/[artifact]-[revision].[ext]" conf="runtime" type="bundle,jar"/>

@jtnystrom jtnystrom Jan 2, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this "ivy:retrieve" to be sequentially prior to the "copy" command just below allows the latter to copy the mlib/ jars (on manual.classpath) over the ivy retrieved jars.
Thus, we retrieve intermine-ws-java and its dependencies into the classpath, and then overwrite its main jar with our custom one, while still keeping its dependencies.


<!-- copy manual.classpath (mlib etc) over ivy:retrieve, so that we can overwrite ivy jars if we wish to -->
<copy todir="${wardir}/WEB-INF/lib">
<path refid="manual.classpath"/>
</copy>
<ivy:retrieve pattern="${wardir}/WEB-INF/lib/[artifact]-[revision].[ext]" conf="runtime" type="bundle,jar"/>

<!-- Set up WEB-INF/classes with additional classes from OTGTool -->
<copy todir="${wardir}/WEB-INF/classes">
Expand Down
Binary file added Toxygates/mlib/intermine-ws-java-3.1.0.jar
Binary file not shown.
105 changes: 37 additions & 68 deletions Toxygates/src/t/server/viewer/intermine/Intermine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,89 +79,58 @@ class IntermineConnector(instance: IntermineInstance,
}
println(s"${filtered take 100} ...")

Some(new StringList(StringList.PROBES_LIST_TYPE,
l.getName(), filtered.toArray))
Some(new StringList(StringList.PROBES_LIST_TYPE, l.getName(), filtered.toArray))
}

/**
* Add a set of probe lists by first mapping them to genes
*/
def addProbeLists(ls: ListService,
lists: Iterable[StringList], replace: Boolean): Unit = {

for (l <- lists) {
addProbeList(ls, l.items(), Some(l.name()), replace)
}
}

/**
* Obtain a valid list name, or None if the export cannot proceed.
* This potentially deletes a pre-existing list.
*/
private def validNameForExport(ls: ListService, name: Option[String],
replace: Boolean): Option[String] = {

var serverList = name.map(n => Option(ls.getList(n))).flatten
if (serverList != None && replace) {
ls.deleteList(serverList.get)
}

//the Set: prefix gets appended by the front-end
if (serverList == None && name != None) {
val altName = name.get.split("Set:")
if (altName.size > 1) {
serverList = Option(ls.getList(altName(1)))
if (serverList != None) {
println(s"Assume list ${name.get} corresponds to ${altName(1)} on server")
}
}
def addProbeLists(ls: ListService, lists: Iterable[StringList], replace: Boolean): Unit =
for { l <- lists } {
addProbeList(ls, l.items(), l.name(), replace)
}
if (serverList != None && replace) {
println(s"Delete list $serverList for replacement")
ls.deleteList(serverList.get)
}

val useName = name.getOrElse("")
if (serverList == None || replace) {
Some(useName)
} else {
val n = name.getOrElse("")
//Could report this message to the user somehow
println(s"Not exporting list '$n' since it already existed (replacement not requested)")
// throw new IntermineException(
// s"Unable to add list, ${name.get} already existed and replacement not requested")
None
}
}

/**
* Add a probe list to InterMine by first mapping it into genes (lazily)
*/
def addProbeList(ls: ListService,
probes: Iterable[String], name: Option[String], replace: Boolean,
tags: Seq[String] = Seq("toxygates")): Option[ItemList] = {
def addProbeList(ls: ListService, probes: Iterable[String], name: String, replace: Boolean,
tags: Seq[String] = Seq("panomicon")): Option[ItemList] =
addEntrezList(ls,
() =>
platforms.resolve(probes.toSeq).flatMap(_.genes.map(_.identifier)),
name, replace, tags)
}
/**
* Add a list of NCBI/Entrez genes to InterMine

/**
* Add a list of NCBI/Entrez genes to InterMine.
* @param ls the ListService
* @param genes the genes (entrez IDs) to be added
* @param name the name of the list to be created
* @param replace whether any existing list with the same name should be replaced
* @param tags any tags to be added to the list (stored on the InterMine server)
* @return the ItemList if it was successfully created, or None if the operation failed.
*/
def addEntrezList(ls: ListService, getGenes: () => Iterable[String],
name: Option[String], replace: Boolean,
tags: Seq[String] = Seq("toxygates")): Option[ItemList] = {
validNameForExport(ls, name, replace) match {
case Some(useName) =>
val ci = new ls.ListCreationInfo("Gene", useName)
//Note: we have the option of doing a fuzzy (e.g. symbol-based) export here
ci.setContent(getGenes().toSeq.asJava)
ci.addTags(tags.asJava)
println(s"Exporting list '$useName'")
Some(ls.createList(ci))
case None =>
None
def addEntrezList(ls: ListService, genes: Seq[String], name: String, replace: Boolean,
tags: Seq[String] = Seq("panomicon")): Option[ItemList] = {

for {existingList <- Option(ls.getList(name))} {
if (replace) {
println(s"Delete list $existingList for replacement")
ls.deleteList(existingList)
} else {
//The list existed and replacement was not requested, so we can't proceed.
//Could report this message to the user somehow
println(s"Not exporting list '$name' since it already existed (replacement not requested)")
//throw new IntermineException(
// s"Unable to add list, ${name.get} already existed and replacement not requested
return None
}
}

val ci = new ls.ListCreationInfo("Gene", name)
//Note: we have the option of doing a fuzzy (e.g. symbol-based) export here
ci.setContent(genes.asJava)
ci.addTags(tags.asJava)
println(s"Exporting list '$name'")
Some(ls.createList(ci))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class IntermineServiceImpl extends TServiceServlet with IntermineService {
ls.setAuthentication(session)
val tags = List()

val tempList = conn.addProbeList(ls, list.items(), Some("temp_enrichment"), false, tags)
val tempList = conn.addProbeList(ls, list.items(), "temp_enrichment", false, tags)

tempList match {
case Some(tl) =>
Expand Down
3 changes: 3 additions & 0 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<exclude module="commons-logging" />
</dependency>

<!-- For intermine -->
<dependency org="antlr" name="antlr" rev="2.7.6" />

<!-- Various logging APIs are included indirectly, e.g. the JCL to SLF4J bridge.
(The 'ant ivyreport' task may be used to inspect the dependency graph.)
SLF4J is our preferred logging framework. -->
Expand Down