Skip to content

Commit 9bf325e

Browse files
committed
Merge pull request #1 from biojava/master
test
2 parents abe7d98 + b3d749f commit 9bf325e

9 files changed

Lines changed: 119 additions & 31 deletions

File tree

biojava3-structure/src/main/java/org/biojava/bio/structure/align/model/AFPChain.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ public String toDBSearchResult(){
285285
}
286286

287287
protected void calcSimilarity() {
288+
System.out.println("calcSimilarity");
288289
Map<String,Double> idMap = AFPAlignmentDisplay.calcIdSimilarity(alnseq1,alnseq2,alnLength);
289290

290291
//probability = idMap.get("probability");
@@ -1224,8 +1225,10 @@ public void setProbability(double probability)
12241225
* @return a value between 0 and 1
12251226
*/
12261227
public double getIdentity() {
1227-
if ( identity <= 0)
1228+
if ( identity <= 0) {
1229+
System.out.println("recaclulating ID and SIM (" + identity +")");
12281230
calcSimilarity();
1231+
}
12291232
return identity;
12301233
}
12311234

biojava3-structure/src/main/java/org/biojava/bio/structure/align/util/AFPAlignmentDisplay.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ public static Map<String,Double> calcIdSimilarity(char[] seq1, char[] seq2, int
346346
double similarity = 0.0;
347347

348348
if ( seq1 == null || seq2 == null){
349+
System.err.println("AFPAlignmentDisplay can't calc ID if alignment strings are null! ");
349350
Map<String, Double> m = new HashMap<String, Double>();
350351
m.put("similarity", similarity);
351352
m.put("identity", identity);

biojava3-structure/src/main/java/org/biojava/bio/structure/align/xml/AFPChainXMLParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ public static AFPChain[] parseMultiXML(String xml) {
257257

258258
a.setAlignScore(new Double(getAttribute(rootElement,"alignScore")).doubleValue());
259259
a.setChainRmsd(new Double(getAttribute(rootElement,"chainRmsd")).doubleValue());
260-
a.setIdentity(new Double(getAttribute(rootElement,"identity")).doubleValue());
260+
Double identity = new Double(getAttribute(rootElement,"identity")).doubleValue();
261+
a.setIdentity(identity);
262+
261263
a.setNormAlignScore(new Double(getAttribute(rootElement,"normAlignScore")).doubleValue());
262264
a.setProbability(new Double(getAttribute(rootElement,"probability")).doubleValue());
263265
a.setSimilarity(new Double(getAttribute(rootElement,"similarity")).doubleValue());

biojava3-structure/src/main/java/org/biojava/bio/structure/scop/ScopFactory.java

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.biojava.bio.structure.scop;
22

3+
import java.util.HashMap;
4+
import java.util.Map;
5+
36

47

58
/**
@@ -25,19 +28,105 @@
2528
public class ScopFactory {
2629

2730
//private static ScopDatabase scop = new ScopInstallation();
28-
31+
2932
// by default we now request SCOP via web services -> much less memory consumption
3033
private static ScopDatabase scop = new RemoteScopInstallation();
31-
34+
3235
public static ScopDatabase getSCOP(){
3336
return scop;
3437
}
35-
38+
3639
public static void setScopDatabase(ScopDatabase s){
3740
System.out.println("Setting ScopDatabase to type: " + s.getClass().getName());
3841
scop = s;
3942
}
43+
44+
45+
// berkeley
46+
public static final String VERSION_1_75A = "1.75A";
47+
public static final String VERSION_1_75B = "1.75B";
48+
49+
50+
// original SCOP
51+
// latest SCOP release from SCOP website = 1.75;
52+
public static final String VERSION_1_75 = "1.75";
53+
54+
static Map<String,ScopDatabase> versionedScopDBs = new HashMap<String, ScopDatabase>();
55+
56+
57+
public static ScopDatabase getSCOP(String version, boolean useLocalData){
58+
if ( useLocalData) {
59+
if ( version.equalsIgnoreCase(VERSION_1_75A)) {
60+
return getBerkeley_1_75A();
61+
62+
}
63+
else if ( version.equalsIgnoreCase(VERSION_1_75B)) {
64+
return getBerkeley_1_75B();
65+
} else if ( version.equalsIgnoreCase(VERSION_1_75)){
66+
getScop_1_75();
67+
} else {
68+
getScop_1_75();
69+
}
70+
} else {
71+
// should to get proxied via Domain service servlet
72+
return scop;
73+
}
74+
return scop;
75+
}
76+
77+
78+
private static ScopDatabase getScop_1_75() {
79+
ScopInstallation scop = (ScopInstallation)versionedScopDBs.get(VERSION_1_75);
80+
if ( scop == null) {
81+
scop = new ScopInstallation();
82+
scop.setScopVersion(VERSION_1_75);
83+
versionedScopDBs.put(VERSION_1_75, scop);
84+
}
4085

86+
return scop;
87+
88+
}
89+
90+
/** requests a particular version of SCOP
91+
*
92+
* @param version
93+
* @return
94+
*/
95+
public static ScopDatabase getSCOP(String version){
96+
if ( version.equalsIgnoreCase(VERSION_1_75A)) {
97+
return getBerkeley_1_75A();
98+
99+
}
100+
else if ( version.equalsIgnoreCase(VERSION_1_75B)) {
101+
return getBerkeley_1_75B();
102+
} else if ( version.equalsIgnoreCase(VERSION_1_75)) {
103+
return getScop_1_75();
104+
} else {
105+
System.err.println("Unknown SCOP version " + version + " . Returning default");
106+
107+
return scop;
108+
}
109+
}
110+
111+
private static ScopDatabase getBerkeley_1_75A() {
112+
BerkeleyScopInstallation berkeley_1_75A = (BerkeleyScopInstallation) versionedScopDBs.get(VERSION_1_75A);
41113

114+
if ( berkeley_1_75A == null) {
115+
berkeley_1_75A = new BerkeleyScopInstallation();
116+
berkeley_1_75A.setScopVersion(VERSION_1_75A);
117+
versionedScopDBs.put(VERSION_1_75A, berkeley_1_75A);
118+
}
119+
return berkeley_1_75A;
120+
}
121+
122+
private static ScopDatabase getBerkeley_1_75B() {
123+
BerkeleyScopInstallation berkeley_1_75B = (BerkeleyScopInstallation) versionedScopDBs.get(VERSION_1_75B);
42124

125+
if ( berkeley_1_75B == null) {
126+
berkeley_1_75B = new BerkeleyScopInstallation();
127+
berkeley_1_75B.setScopVersion(VERSION_1_75B);
128+
versionedScopDBs.put(VERSION_1_75B, berkeley_1_75B);
129+
}
130+
return berkeley_1_75B;
131+
}
43132
}

integrationtest/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mvn verify</description>
3535
<plugins>
3636
<plugin>
3737
<artifactId>maven-failsafe-plugin</artifactId>
38-
<version>2.6</version>
38+
<version>2.14.1</version>
3939
<executions>
4040
<execution>
4141
<goals>
Binary file not shown.

integrationtest/src/test/java/org/biojava/bio/structure/align/FlipAFPChainTest.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private void flip(String name1, String name2, String algorithmName) throws Struc
9393
afpChain.setName1(name1);
9494
afpChain.setName2(name2);
9595

96-
96+
afpChain.setCalculationTime(0);
9797

9898
String xml = AFPChainXMLConverter.toXML(afpChain, ca1, ca2);
9999

@@ -107,18 +107,7 @@ private void flip(String name1, String name2, String algorithmName) throws Struc
107107
assertEquals(afpChain.getAlgorithmName(),flipped.getAlgorithmName());
108108
assertEquals(afpChain.getVersion(), flipped.getVersion());
109109

110-
//System.out.println(AFPChainXMLConverter.toXML(flipped));
111-
112-
//AFPChainXMLParser.rebuildAFPChain(flipped, ca2, ca1);
113-
114-
//FatCat newCat = new FatCat();
115-
116-
//Group[] twistedGroups = AFPTwister.twistOptimized(flipped,ca2,ca1);
117-
118-
// FatCatAligner aligner = newCat.getFatCatAligner();
119-
//aligner.setTwistedGroups(twistedGroups);
120-
//newCat.display(flipped, ca2, ca1, new ArrayList<Group>(),new ArrayList<Group>(),new ArrayList<Group>(),new ArrayList<Group>());
121-
110+
122111
String xmlNew = AFPChainXMLConverter.toXML(flipped, ca2, ca1);
123112

124113
AFPChain backChain = AFPChainXMLParser.fromXML(xmlNew, ca2, ca1);

integrationtest/src/test/resources/ce_1fdo.A_2iv2.X.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<AFPChain name1="1FDO.A" name2="2IV2.X" method="jCE" version="1.1" alnLength="720" blockNum="1" gapLen="28" optLength="692" totalLenIni="697" alignScore="1551.34" chainRmsd="0.91" identity="0.9957" normAlignScore="0.00" probability="8.40e+00" similarity="0.9957" similarity1="97" similarity2="99" totalRmsdIni="1.36" totalRmsdOpt="0.91" ca1Length="715" ca2Length="697" afpNum="4" alignScoreUpdate="0.00" time="-1">
1+
<AFPChain name1="1FDO.A" name2="2IV2.X" method="jCE" version="1.1" alnLength="720" blockNum="1" gapLen="28" optLength="692" totalLenIni="697" alignScore="1551.34" chainRmsd="0.91" identity="0.9569" normAlignScore="0.00" probability="8.40e+00" similarity="0.9569" similarity1="97" similarity2="99" totalRmsdIni="1.36" totalRmsdOpt="0.91" ca1Length="715" ca2Length="697" afpNum="4" alignScoreUpdate="0.00" time="-1">
22
<block blockNr="0" blockSize="0" blockScore="0.00" blockRmsd="0.91" blockGap="0">
33
<eqr eqrNr="0" pdbres1="1" chain1="A" pdbres2="1" chain2="X" />
44
<eqr eqrNr="1" pdbres1="2" chain1="A" pdbres2="2" chain2="X" />

pom.xml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
</license>
2222
</licenses>
2323
<scm>
24-
<connection>scm:svn:svn://code.open-bio.org/biojava/biojava-live/trunk</connection>
25-
<developerConnection>scm:svn:svn+ssh://dev.open-bio.org/home/svn-repositories/biojava/biojava-live/trunk</developerConnection>
26-
<url>http://code.open-bio.org/svnweb/index.cgi/biojava/browse/biojava-live/trunk</url>
24+
<connection>scm:git:git://github.com/biojava/biojava.git</connection>
25+
<developerConnection>scm:git:git@github.com:biojava/biojava.git</developerConnection>
26+
<url>https://github.com/biojava/biojava</url>
2727
</scm>
2828
<repositories>
2929
<repository>
@@ -94,28 +94,31 @@
9494
</plugin>
9595
<plugin>
9696
<artifactId>maven-compiler-plugin</artifactId>
97-
<version>2.5.1</version>
97+
<version>3.1</version>
9898
<configuration>
9999
<source>${jdk.version}</source>
100100
<target>${jdk.version}</target>
101101
</configuration>
102102
</plugin>
103103
<plugin>
104104
<artifactId>maven-dependency-plugin</artifactId>
105-
<version>2.5.1</version>
105+
<version>2.7</version>
106106
</plugin>
107107
<plugin>
108108
<artifactId>maven-jar-plugin</artifactId>
109109
<version>2.4</version>
110110
</plugin>
111111
<plugin>
112112
<artifactId>maven-scm-plugin</artifactId>
113-
<version>1.8</version>
113+
<version>1.8.1</version>
114+
</plugin>
115+
<plugin>
116+
<artifactId>maven-source-plugin</artifactId>
117+
<version>2.2.1</version>
114118
</plugin>
115-
116119
<plugin>
117120
<artifactId>maven-surefire-plugin</artifactId>
118-
<version>2.12.1</version>
121+
<version>2.14.1</version>
119122
<configuration>
120123
<argLine>-Xms256m -Xmx2000M</argLine>
121124
</configuration>
@@ -128,7 +131,7 @@
128131
<plugin>
129132
<groupId>org.jvnet.jaxb2.maven2</groupId>
130133
<artifactId>maven-jaxb2-plugin</artifactId>
131-
<version>0.8.2</version>
134+
<version>0.8.3</version>
132135
</plugin>
133136
<plugin>
134137
<groupId>org.apache.maven.plugins</groupId>
@@ -215,7 +218,7 @@
215218
<extension>
216219
<groupId>org.apache.maven.wagon</groupId>
217220
<artifactId>wagon-ssh</artifactId>
218-
<version>2.3</version>
221+
<version>2.4</version>
219222
</extension>
220223
</extensions>
221224

@@ -332,4 +335,5 @@
332335
<module>protein-comparison-tool</module>
333336

334337
</modules>
335-
</project>
338+
<inceptionYear>2000</inceptionYear>
339+
</project>

0 commit comments

Comments
 (0)