Skip to content

Commit

Permalink
Fixed batchmapper.bat. Batchmapper uses transitive mapping by default.
Browse files Browse the repository at this point in the history
Made transitive mapping observe target datasource

git-svn-id: http://svn.bigcat.unimaas.nl/bridgedb/trunk@337 e3f1d335-44b1-4163-9530-9b341189ae98
  • Loading branch information
martijn committed Apr 8, 2010
1 parent 2babf27 commit 3b0a080
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion batchmapper.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -jar dist/bridgedb-batchmapper.jar %*
java -jar dist/org.bridgedb.tools.batchmapper.jar %*
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public void printUsage()
" [-c <input column, 0-based>]\n" +
" [-r <report file>] \n" +
"\n" +
"You should specify at least one -g or -t option \n");
"You should specify at least one -g or -t option.\n" +
"Multiple -g or -t options will be combined transitively.\n");
}

public String parseArgs(Settings settings, String[] args)
Expand Down Expand Up @@ -245,6 +246,7 @@ private void connectGdb() throws IDMapperException
{
gdb.addIDMapper(connectionString);
}
gdb.setTransitive(true);
}

public void writeMapping() throws IOException, IDMapperException
Expand Down
11 changes: 10 additions & 1 deletion org.bridgedb/src/org/bridgedb/IDMapperStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.bridgedb;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -437,13 +438,21 @@ private Set<Xref> mapIDtransitive(Xref ref, DataSource... resultDs) throws IDMap
{
// first round
Set<Xref> result = new HashSet<Xref>();
Set<DataSource> dsFilter = new HashSet<DataSource>(Arrays.asList(resultDs));
for (IDMapper i : gdbs)
{
if (i == null || !i.isConnected()) continue;

// map ref in IDMapper i
Set<Xref> round1 = i.mapID(ref);
result.addAll (round1);

for (Xref r1 : round1)
{
if (resultDs.length == 0 || dsFilter.contains(r1.getDataSource()))
{
result.add (r1);
}
}

// then map the result of that in all IDMappers j (j != i)
for (IDMapper j : gdbs)
Expand Down

0 comments on commit 3b0a080

Please sign in to comment.