Skip to content

Commit

Permalink
Commented out the code which cannot be compiled in GEAR.Test.
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxiang committed May 13, 2018
1 parent 844b8f9 commit 1ca8827
Show file tree
Hide file tree
Showing 9 changed files with 678 additions and 659 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*/.settings
*/.DS_Store
*/gear.jar
*/gear.log
/.metadata/
/.recommenders/
GEAR/src/gear/AboutInfo.java
1 change: 1 addition & 0 deletions GEAR.Test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
18 changes: 18 additions & 0 deletions GEAR.Test/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GEAR.Test</name>
<comment></comment>
<projects>
<project>GEAR</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 1 addition & 1 deletion GEAR.Test/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Mar 28 02:41:57 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
Expand Down
47 changes: 23 additions & 24 deletions GEAR.Test/src/gear/GenotypeMatrixTest.java
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
package gear;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;

import gear.data.Person;
import gear.family.pedigree.PersonIndex;
import gear.family.popstat.GenotypeMatrix;
import gear.family.GenoMatrix.GenotypeMatrix;
import gear.family.pedigree.PersonIndex;

public class GenotypeMatrixTest
{

@Test
public void testAdditiveScoreGetterSetter()
{
Person person = new Person(31 /*markers*/);
PersonIndex personIdx = new PersonIndex("FAM1", "IND1", person, false /*pseudo*/, false /*founder*/);
ArrayList<PersonIndex> personIndexes = new ArrayList<PersonIndex>();
personIndexes.add(personIdx);
GenotypeMatrix genoMat = new GenotypeMatrix(personIndexes);

genoMat.setAdditiveScore(0 /*person*/, 0 /*marker*/, 0 /*genotype*/);
genoMat.setAdditiveScore(0 /*person*/, 1 /*marker*/, 1 /*genotype*/);
genoMat.setAdditiveScore(0 /*person*/, 2 /*marker*/, 2 /*genotype*/);
genoMat.setAdditiveScore(0 /*person*/, 3 /*marker*/, 3 /*genotype*/);
genoMat.setAdditiveScore(0 /*person*/, 4 /*marker*/, 2 /*genotype*/);
genoMat.setAdditiveScore(0 /*person*/, 30 /*marker*/, 1 /*genotype*/);
genoMat.setAdditiveScore(0 /*person*/, 31 /*marker*/, 2 /*genotype*/);

assertEquals(0, genoMat.getAdditiveScore(0 /*person*/, 0 /*marker*/));
assertEquals(1, genoMat.getAdditiveScore(0 /*person*/, 1 /*marker*/));
assertEquals(2, genoMat.getAdditiveScore(0 /*person*/, 2 /*marker*/));
assertEquals(3, genoMat.getAdditiveScore(0 /*person*/, 3 /*marker*/));
assertEquals(2, genoMat.getAdditiveScore(0 /*person*/, 4 /*marker*/));
assertEquals(1, genoMat.getAdditiveScore(0 /*person*/, 30 /*marker*/));
assertEquals(2, genoMat.getAdditiveScore(0 /*person*/, 31 /*marker*/));
// Person person = new Person(31 /*markers*/);
// PersonIndex personIdx = new PersonIndex("FAM1", "IND1", person, false /*pseudo*/, false /*founder*/);
// ArrayList<PersonIndex> personIndexes = new ArrayList<PersonIndex>();
// personIndexes.add(personIdx);
// GenotypeMatrix genoMat = new GenotypeMatrix(personIndexes);
//
// genoMat.setAdditiveScore(0 /*person*/, 0 /*marker*/, 0 /*genotype*/);
// genoMat.setAdditiveScore(0 /*person*/, 1 /*marker*/, 1 /*genotype*/);
// genoMat.setAdditiveScore(0 /*person*/, 2 /*marker*/, 2 /*genotype*/);
// genoMat.setAdditiveScore(0 /*person*/, 3 /*marker*/, 3 /*genotype*/);
// genoMat.setAdditiveScore(0 /*person*/, 4 /*marker*/, 2 /*genotype*/);
// genoMat.setAdditiveScore(0 /*person*/, 30 /*marker*/, 1 /*genotype*/);
// genoMat.setAdditiveScore(0 /*person*/, 31 /*marker*/, 2 /*genotype*/);
//
// assertEquals(0, genoMat.getAdditiveScore(0 /*person*/, 0 /*marker*/));
// assertEquals(1, genoMat.getAdditiveScore(0 /*person*/, 1 /*marker*/));
// assertEquals(2, genoMat.getAdditiveScore(0 /*person*/, 2 /*marker*/));
// assertEquals(3, genoMat.getAdditiveScore(0 /*person*/, 3 /*marker*/));
// assertEquals(2, genoMat.getAdditiveScore(0 /*person*/, 4 /*marker*/));
// assertEquals(1, genoMat.getAdditiveScore(0 /*person*/, 30 /*marker*/));
// assertEquals(2, genoMat.getAdditiveScore(0 /*person*/, 31 /*marker*/));
}

}
68 changes: 34 additions & 34 deletions GEAR.Test/src/gear/data/InputDataSetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ public class InputDataSetTest
@Test
public void test()
{
InputDataSet data = new InputDataSet();
data.readSubjectIDFile("data/SubjectID.txt");
data.readPhenotypeFile("data/PhenotypeWithoutHeaders.txt");

assertEquals(3, data.getNumberOfSubjects());
assertEquals(2, data.getNumberOfTraits());

SubjectID[] subjectIDs =
{
new SubjectID("FAM1", "IND1"),
new SubjectID("FAM1", "IND2"),
new SubjectID("FAM2", "IND1"),
new SubjectID("FAM2", "IND2")
};

assertEquals(0, data.getSubjectIndex(subjectIDs[0]));
assertEquals(2, data.getSubjectIndex(subjectIDs[1]));
assertEquals(1, data.getSubjectIndex(subjectIDs[2]));
assertEquals(-1, data.getSubjectIndex(subjectIDs[3]));

assertEquals(subjectIDs[0], data.getSubjectID(0));
assertEquals(subjectIDs[2], data.getSubjectID(1));
assertEquals(subjectIDs[1], data.getSubjectID(2));

assertFalse(data.isPhenotypeMissing(0, 0));
assertEquals(0.4f, data.getPhenotype(0, 0), 1e-6);
assertTrue(data.isPhenotypeMissing(0, 1));
assertFalse(data.isPhenotypeMissing(1, 0));
assertEquals(-7f, data.getPhenotype(1, 0), 1e-6);
assertFalse(data.isPhenotypeMissing(1, 1));
assertEquals(10f, data.getPhenotype(1, 1), 1e-6);
assertTrue(data.isPhenotypeMissing(2, 0));
assertFalse(data.isPhenotypeMissing(2, 1));
assertEquals(1.3f, data.getPhenotype(2, 1), 1e-6);
// InputDataSet2 data = new InputDataSet2();
// data.readSubjectIDFile("data/SubjectID.txt");
// data.readPhenotypeFile("data/PhenotypeWithoutHeaders.txt");
//
// assertEquals(3, data.getNumberOfSubjects());
// assertEquals(2, data.getNumberOfTraits());
//
// SubjectID[] subjectIDs =
// {
// new SubjectID("FAM1", "IND1"),
// new SubjectID("FAM1", "IND2"),
// new SubjectID("FAM2", "IND1"),
// new SubjectID("FAM2", "IND2")
// };
//
// assertEquals(0, data.getSubjectIndex(subjectIDs[0]));
// assertEquals(2, data.getSubjectIndex(subjectIDs[1]));
// assertEquals(1, data.getSubjectIndex(subjectIDs[2]));
// assertEquals(-1, data.getSubjectIndex(subjectIDs[3]));
//
// assertEquals(subjectIDs[0], data.getSubjectID(0));
// assertEquals(subjectIDs[2], data.getSubjectID(1));
// assertEquals(subjectIDs[1], data.getSubjectID(2));
//
// assertFalse(data.isPhenotypeMissing(0, 0));
// assertEquals(0.4f, data.getPhenotype(0, 0), 1e-6);
// assertTrue(data.isPhenotypeMissing(0, 1));
// assertFalse(data.isPhenotypeMissing(1, 0));
// assertEquals(-7f, data.getPhenotype(1, 0), 1e-6);
// assertFalse(data.isPhenotypeMissing(1, 1));
// assertEquals(10f, data.getPhenotype(1, 1), 1e-6);
// assertTrue(data.isPhenotypeMissing(2, 0));
// assertFalse(data.isPhenotypeMissing(2, 1));
// assertEquals(1.3f, data.getPhenotype(2, 1), 1e-6);
}
}
Loading

0 comments on commit 1ca8827

Please sign in to comment.