-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'repr-domains' into develop
# Conflicts: # core/jms-implementation/support-mini-x86-32/work/template/interpro.zip
- Loading branch information
Showing
13 changed files
with
288 additions
and
10 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
core/jms-implementation/support-mini-x86-32/work/kvs/idb/domains.json
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+1.29 MB
(110%)
core/jms-implementation/support-mini-x86-32/work/template/interpro.zip
Binary file not shown.
46 changes: 46 additions & 0 deletions
46
...gement/src/main/java/uk/ac/ebi/interpro/scan/management/model/implementations/Domain.java
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,46 @@ | ||
package uk.ac.ebi.interpro.scan.management.model.implementations; | ||
import uk.ac.ebi.interpro.scan.model.*; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class Domain { | ||
private final Location location; | ||
private final Set<Integer> residues; | ||
private final int databaseRank; | ||
|
||
public Location getLocation() { | ||
return location; | ||
} | ||
|
||
public Set<Integer> getResidues() { | ||
return residues; | ||
} | ||
|
||
public int getDatabaseRank() { | ||
return databaseRank; | ||
} | ||
|
||
public Domain(Location location, int databaseRank) { | ||
this.location = location; | ||
this.residues = new HashSet<>(); | ||
this.databaseRank = databaseRank; | ||
|
||
Set<LocationFragment> fragments = location.getLocationFragments(); | ||
for (LocationFragment fragment: fragments) { | ||
for (int i = fragment.getStart(); i <= fragment.getEnd(); i++) { | ||
this.residues.add(i); | ||
} | ||
} | ||
} | ||
|
||
public boolean overlaps(Domain other, double threshold) { | ||
Set<Integer> overlap = new HashSet<Integer>(this.residues); | ||
overlap.retainAll(other.getResidues()); | ||
if (overlap.size() > 0) { | ||
return ((double) overlap.size() / Math.min(this.residues.size(), other.getResidues().size())) >= threshold; | ||
} | ||
|
||
return false; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...rc/main/java/uk/ac/ebi/interpro/scan/management/model/implementations/DomainResolver.java
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,48 @@ | ||
package uk.ac.ebi.interpro.scan.management.model.implementations; | ||
|
||
import java.util.*; | ||
|
||
public class DomainResolver { | ||
private final Map<Integer, Set<Integer>> graph; | ||
private final List<Set<Integer>> sets; | ||
|
||
public DomainResolver(Map<Integer, Set<Integer>> graph) { | ||
this.graph = graph; | ||
this.sets = new ArrayList<>(); | ||
} | ||
|
||
public List<Set<Integer>> resolve() { | ||
makeSets(new ArrayList<>(), new ArrayList<>(this.graph.keySet())); | ||
return this.sets; | ||
} | ||
|
||
private void makeSets(List<Integer> currentSet, List<Integer> remainingNodes) { | ||
if (isValid(currentSet)) { | ||
if (remainingNodes.isEmpty()) { | ||
this.sets.add(new HashSet<>(currentSet)); | ||
return; | ||
} | ||
} else { | ||
return; | ||
} | ||
|
||
int currentNode = remainingNodes.get(0); | ||
remainingNodes = remainingNodes.subList(1, remainingNodes.size()); | ||
|
||
makeSets(new ArrayList<>(currentSet) {{ | ||
add(currentNode); | ||
}}, remainingNodes); | ||
makeSets(new ArrayList<>(currentSet), remainingNodes); | ||
} | ||
|
||
private boolean isValid(List<Integer> candidate) { | ||
for (int nodeA : candidate) { | ||
for (int nodeB : candidate) { | ||
if (nodeA != nodeB && !this.graph.get(nodeB).contains(nodeA)) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
} |
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 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 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 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
Oops, something went wrong.