Skip to content

Commit

Permalink
Little adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsoeromero committed Feb 2, 2014
1 parent 6e14e33 commit 4bd98a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 9 additions & 8 deletions HSM/HSM.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ private void stripDownGeneData(String[] targetGenes) {
this.genes = targetGenes;
this.goIdsByGene = newGene2GO;
boolean nulltest = false;
for (int i = 0; i < newGene2GO.length; i++) {
if (newGene2GO[i] == null) {
for (String[] newGene2GO1 : newGene2GO) {
if (newGene2GO1 == null) {
nulltest = true;
break;
}
Expand All @@ -211,7 +211,7 @@ private void stripDownGeneData(String[] targetGenes) {
* "isAGraphBasedMeasure" should change its value to true for those cases in
* which we are dealing with such a measure (e.g. simGIC).
*
* @returns true if the measure is a graph-based one, false otherwise
* @return true if the measure is a graph-based one, false otherwise
*/
public boolean isAGraphBasedMeasure() {
return isAGraphBasedMeasure;
Expand Down Expand Up @@ -304,7 +304,6 @@ protected Matrix geneWiseSimilarityByMaximum(int ontology) throws IOException, O
Matrix result = new Matrix(NUM_GENES_ONTOLOGY, NUM_GENES_ONTOLOGY);

//which pair of terms annoating the genes is the most similar

for (int i = 0; i < NUM_GENES_ONTOLOGY; ++i) {
//get genes annotating the first gene
final int[] goTerms_i = goIdsPerGene.get(selectedGenes.get(i));
Expand Down Expand Up @@ -375,13 +374,15 @@ private Map<Integer, Set<Integer>> computeDominancies(Matrix x) {
}

protected Matrix calculateGraphGeneWiseSemanticSimilarity(int ontology, GraphSimilarity measure) throws IOException, OutOfMemoryError {

System.err.println("# of genes: " + this.genes.length);
// 1.- we get the set of GO terms for every gene
Map<String, Set<GOTerm>> goTermsPerGene = new HashMap<String, Set<GOTerm>>();
for (int g = 0; g < this.genes.length; g++) {
String gene = genes[g];
for (String gene : this.annotations.getRowIdentifiers()) {
// for (int g = 0; g < this.genes.length; g++) {
// String gene = genes[g];
Set<GOTerm> added = new HashSet<GOTerm>();
for (String go : this.goIdsByGene[g]) {
for (String go : this.annotations.getGOTermScoresForProteinId(gene).keySet()) {
//for (String go : this.goIdsByGene[g]) {
if (ontology == getOntologyFromGOTerm(go)) {
added.addAll(goTermFromID.get(go).getAncestors());
}
Expand Down
5 changes: 2 additions & 3 deletions ISM/HSMInterfacer.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,11 @@ public Matrix returnGeneWiseResults(int matrix) throws IOException {
}

this.originalMatrix = this.chosenHSM.calculateGeneWiseSemanticSimilarity(matrix);

if (this.targetGenes == null || this.targetGenes.length == 0) {

return this.originalMatrix;
} else {
return returnTrimmedMatrixForGenes(this.chosenHSM.calculateGeneWiseSemanticSimilarity(matrix));
return returnTrimmedMatrixForGenes(this.originalMatrix);
}
}

Expand All @@ -140,7 +139,7 @@ public Matrix returnTermWiseResults(int matrix) throws IOException {
if (this.targets == null || this.targets.isEmpty()) {
return this.originalMatrix;
} else {
return returnTrimmedMatrix(this.chosenHSM.calculateTermWiseSemanticSimilarity(matrix), matrix);
return returnTrimmedMatrix(this.originalMatrix, matrix);
}
}

Expand Down

0 comments on commit 4bd98a5

Please sign in to comment.