-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGenePair.java
executable file
·86 lines (70 loc) · 1.72 KB
/
GenePair.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
public class GenePair{
GeneInfo gene1;
GeneInfo gene2;
int weight;
public GenePair(GeneInfo g1, GeneInfo g2, int w){
gene1 =new GeneInfo(g1);
gene2 = new GeneInfo(g2);
weight = w;
}
public GenePair(GeneInfo g1, GeneInfo g2){
gene1 =new GeneInfo(g1);
gene2 = new GeneInfo(g2);
weight = 0;
}
public GenePair(GenePair agp){
gene1 = new GeneInfo(agp.gene1);
gene2 = new GeneInfo(agp.gene2);
weight = agp.weight;
}
public void print(){
System.out.println("weight "+ weight);
gene1.print();
gene2.print();
}
/* public boolean notInList(String ag, GeneInfo[] gis){
for(int i = 0; i< gis.length; i++){
if(gis[i]!=null){
if(gis[i].name.equals(ag)){
return false;
}
}
}
return true;
}
*/
/*public GeneInfo[] getAllGeneList(GenePair[] gps){
GeneInfo[] allGenes = new GeneInfo[gps.length*2];
int index = 0;
for(int i = 0; i< gps.length; i++){
if(gps[i]!=null){
String g1 = gps[i].gene1.name;
String g2 = gps[i].gene2.name;
if(notInList(g1, allGenes)==true){
allGenes[index] = new GeneInfo(gps[i].gene1);
//frequence[index] = 1;
index++;
}
if(notInList(g2,allGenes)==true){
allGenes[index] = gps[i].gene2;
//frequence[index] = 1;
index++;
}
}
}
GeneInfo[] genes = new GeneInfo[index];
for(int i = 0; i< genes.length; i++){
genes[i] = allGenes[i];
}
return genes;
}*/
public boolean sameGenePair(GenePair gp1, GenePair gp2){
String gn1 = gp1.gene1.name;
String gn2 = gp1.gene2.name;
String gn3 = gp2.gene1.name;
String gn4 = gp2.gene2.name;
if(gn1.equals(gn3) && gn2.equals(gn4)){return true;}
if(gn1.equals(gn4) && gn2.equals(gn3)){return true;}
return false;
}
}