Skip to content

Commit e09358e

Browse files
committed
Merge remote-tracking branch 'biojava/master'
2 parents 6b3bdb0 + e449976 commit e09358e

File tree

35 files changed

+935
-1183
lines changed

35 files changed

+935
-1183
lines changed

biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/CookBookTest.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@
3333

3434
public class CookBookTest {
3535

36+
// TODO this test doesn't assert anything, i.e. it is not a test! Should fix! - JD 2016-03-07
37+
3638
private final static Logger logger = LoggerFactory.getLogger(CookBookTest.class);
3739

3840
@Test
3941
public void shortExample1(){
4042
String sequence = "QIKDLLVSSSTDLDTTLVLVNAIYFKGMWKTAFNAEDTREMPFHVTKQESKPVQMMCMNNSFNVATLPAE";
41-
logger.info("Molecular Weight: {}", PeptideProperties.getMolecularWeight(sequence));
43+
logger.debug("Molecular Weight: {}", PeptideProperties.getMolecularWeight(sequence));
4244
}
4345

4446
@Test
4547
public void shortExample2() throws FileNotFoundException, JAXBException{
4648
String sequence = "QIKDLLVSSSTDLDTTLVLVNAIYFKGMWKTAFNAEDTREMPFHVTKQESKPVQMMCMNNSFNVATLPAE";
4749
File aminoAcidCompositionFile = new File("./src/main/resources/AminoAcidComposition.xml");
48-
logger.info("Molecular Weight: {}", PeptideProperties.getMolecularWeight(sequence, aminoAcidCompositionFile));
50+
logger.debug("Molecular Weight: {}", PeptideProperties.getMolecularWeight(sequence, aminoAcidCompositionFile));
4951
}
5052

5153
@Test
@@ -59,7 +61,7 @@ public void shortExample3() throws Exception{
5961
AminoAcidCompositionTable table = PeptideProperties.obtainAminoAcidCompositionTable(aminoAcidCompositionFile);
6062

6163
for(String sequence:sequences){
62-
logger.info("Molecular Weight: {}", PeptideProperties.getMolecularWeightBasedOnXML(sequence, table));
64+
logger.debug("Molecular Weight: {}", PeptideProperties.getMolecularWeightBasedOnXML(sequence, table));
6365
}
6466
}
6567

@@ -68,12 +70,12 @@ public void shortExample4(){
6870
String sequence = "QIKDLLVSSSTDLDTTLVLVNAIYFKGMWKTAFNAEDTREMPFHVTKQESKPVQMMCMNNSFNVATLPAE";
6971

7072
//Enrichment of a specific amino acid type
71-
logger.info("Composition of A: {}", PeptideProperties.getEnrichment(sequence, "A"));
73+
logger.debug("Composition of A: {}", PeptideProperties.getEnrichment(sequence, "A"));
7274

7375
//Enrichment of a list of amino acid types
7476
Map<String, Double> composition = PeptideProperties.getAACompositionString(sequence);
7577
for(String aa:composition.keySet()){
76-
logger.info("Composition of {}: {}", aa, composition.get(aa));
78+
logger.debug("Composition of {}: {}", aa, composition.get(aa));
7779
}
7880
}
7981

@@ -83,26 +85,26 @@ public void shortExample5(){
8385
String sequence = "QIKDLLVSSSTDLDTTLVLVNAIYFKGMWKTAFNAEDTRECMPFHVTKQESKPVQMMCMNNSFNVATLPAE";
8486

8587
//Absorbance
86-
logger.info("Absorbance (Cys Reduced): {}", PeptideProperties.getAbsorbance(sequence, true));
87-
logger.info("Absorbance (Cys Not Reduced): {}", PeptideProperties.getAbsorbance(sequence, false));
88+
logger.debug("Absorbance (Cys Reduced): {}", PeptideProperties.getAbsorbance(sequence, true));
89+
logger.debug("Absorbance (Cys Not Reduced): {}", PeptideProperties.getAbsorbance(sequence, false));
8890

8991
//Extinction Coefficient
90-
logger.info("Extinction Coefficient (Cys Reduced): {}", PeptideProperties.getExtinctionCoefficient(sequence, true));
91-
logger.info("Extinction Coefficient (Cys Not Reduced): {}", PeptideProperties.getExtinctionCoefficient(sequence, false));
92+
logger.debug("Extinction Coefficient (Cys Reduced): {}", PeptideProperties.getExtinctionCoefficient(sequence, true));
93+
logger.debug("Extinction Coefficient (Cys Not Reduced): {}", PeptideProperties.getExtinctionCoefficient(sequence, false));
9294

9395
//Instability Index
94-
logger.info("Instability Index: {}", PeptideProperties.getInstabilityIndex(sequence));
96+
logger.debug("Instability Index: {}", PeptideProperties.getInstabilityIndex(sequence));
9597

9698
//Apliphatic Index
97-
logger.info("Apliphatic Index: {}", PeptideProperties.getApliphaticIndex(sequence));
99+
logger.debug("Apliphatic Index: {}", PeptideProperties.getApliphaticIndex(sequence));
98100

99101
//Average Hydropathy Value
100-
logger.info("Average Hydropathy Value: {}", PeptideProperties.getAvgHydropathy(sequence));
102+
logger.debug("Average Hydropathy Value: {}", PeptideProperties.getAvgHydropathy(sequence));
101103

102104
//Isoelectric Point
103-
logger.info("Isoelectric Point: {}", PeptideProperties.getIsoelectricPoint(sequence));
105+
logger.debug("Isoelectric Point: {}", PeptideProperties.getIsoelectricPoint(sequence));
104106

105107
//Net Charge
106-
logger.info("Net Charge at pH 7: {}", PeptideProperties.getNetCharge(sequence));
108+
logger.debug("Net Charge at pH 7: {}", PeptideProperties.getNetCharge(sequence));
107109
}
108110
}

biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/PeptidePropertiesImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ public void testEnrichment() {
152152

153153
@Test (expected = NullPointerException.class)
154154
public void testEnrichmentNull(){
155-
assertNull(PeptideProperties.getEnrichment(sequence, "1"));
156155
assertEquals(0.0, PeptideProperties.getEnrichment(sequence, ""), delta);
156+
assertNull(PeptideProperties.getEnrichment(sequence, "1"));
157157
}
158158

159159
@Test
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* BioJava development code
3+
*
4+
* This code may be freely distributed and modified under the
5+
* terms of the GNU Lesser General Public Licence. This should
6+
* be distributed with the code. If you do not have a copy,
7+
* see:
8+
*
9+
* http://www.gnu.org/copyleft/lesser.html
10+
*
11+
* Copyright for this code is held jointly by the individual
12+
* authors. These should be listed in @author doc comments.
13+
*
14+
* For more information on the BioJava project and its aims,
15+
* or to join the biojava-l mailing list, visit the home page
16+
* at:
17+
*
18+
* http://www.biojava.org/
19+
*
20+
*/
21+
package org.biojava.nbio.alignment;
22+
23+
import static org.junit.Assert.*;
24+
25+
import org.biojava.nbio.core.alignment.template.Profile;
26+
import org.biojava.nbio.core.exceptions.CompoundNotFoundException;
27+
import org.biojava.nbio.core.sequence.DNASequence;
28+
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
29+
import org.biojava.nbio.core.util.ConcurrencyTools;
30+
import org.junit.Before;
31+
import org.junit.Ignore;
32+
import org.junit.Test;
33+
34+
import java.util.ArrayList;
35+
import java.util.List;
36+
37+
public class TestSubOptimalMSA {
38+
39+
private List<DNASequence> sequences = new ArrayList<DNASequence>();
40+
41+
@Before
42+
public void setUp() {
43+
try {
44+
sequences.add(new DNASequence("TTGGGGCCTCTAAACGGGGTCTT"));
45+
sequences.add(new DNASequence("TTGGGGCCTCTAAACGGGTCTT"));
46+
sequences.add(new DNASequence("TTGGGGCTCTAACGGGTCTT"));
47+
} catch (CompoundNotFoundException e) {
48+
e.printStackTrace();
49+
}
50+
}
51+
52+
@Test
53+
public void gapPenalty52() {
54+
SimpleGapPenalty gapP = new SimpleGapPenalty((short) 5, (short) 2);
55+
Profile<DNASequence, NucleotideCompound> msa = Alignments
56+
.getMultipleSequenceAlignment(sequences, gapP);
57+
58+
assertEquals("TTGGGGCCTCTAAACGGGGTCTT\n"
59+
+ "TTGGGGCCTCTAAACGGG-TCTT\n"
60+
+ "TTGGGGC-TCTAA-CGGG-TCTT\n",
61+
msa.toString());
62+
63+
ConcurrencyTools.shutdown();
64+
}
65+
66+
@Test @Ignore
67+
public void gapPenaltyDefault() {
68+
// Default is currently 10-1
69+
SimpleGapPenalty gapP = new SimpleGapPenalty((short) 10, (short) 1);
70+
Profile<DNASequence, NucleotideCompound> msa = Alignments
71+
.getMultipleSequenceAlignment(sequences, gapP);
72+
73+
// TODO test not passing (see issue 288 in github) - Aleix 03.2016
74+
assertEquals("TTGGGGCCTCTAAACGGGGTCTT\n"
75+
+ "TTGGGGCCTCTAAACGGG-TCTT\n"
76+
+ "TTGGGGC-TCTAA-CGGG-TCTT\n",
77+
msa.toString());
78+
79+
ConcurrencyTools.shutdown();
80+
}
81+
}

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/HeaderOnlyTest.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/MMcifTest.java

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,44 @@
2121
*/
2222
package org.biojava.nbio.structure.test;
2323

24-
import junit.framework.TestCase;
2524
import org.biojava.nbio.structure.*;
2625
import org.biojava.nbio.structure.io.FileParsingParameters;
2726
import org.biojava.nbio.structure.io.PDBFileParser;
2827
import org.biojava.nbio.structure.io.mmcif.MMcifParser;
2928
import org.biojava.nbio.structure.io.mmcif.SimpleMMcifConsumer;
3029
import org.biojava.nbio.structure.io.mmcif.SimpleMMcifParser;
30+
import org.junit.Test;
31+
import static org.junit.Assert.*;
3132

3233
import java.io.BufferedReader;
3334
import java.io.IOException;
3435
import java.io.InputStream;
3536
import java.io.InputStreamReader;
3637
import java.util.List;
3738

38-
public class MMcifTest extends TestCase {
39-
40-
protected boolean headerOnly;
41-
42-
public MMcifTest(){
43-
super();
44-
setHeaderOnly(false);
45-
}
39+
public class MMcifTest {
4640

41+
private static boolean headerOnly;
4742

43+
@Test
44+
public void testLoad() throws IOException {
45+
46+
headerOnly = false;
4847

49-
public boolean isHeaderOnly() {
50-
return headerOnly;
48+
doTestLoad();
49+
5150
}
52-
53-
54-
55-
public void setHeaderOnly(boolean headerOnly) {
56-
this.headerOnly = headerOnly;
51+
52+
@Test
53+
public void testLoadHeaderOnly() throws IOException {
54+
55+
headerOnly = true;
56+
57+
doTestLoad();
58+
5759
}
5860

59-
public void testLoad(){
60-
61+
private void doTestLoad() throws IOException {
6162
// a structure with microheterogeneity
6263
//comparePDB2cif("2CI1","A");
6364

@@ -81,13 +82,10 @@ public void testLoad(){
8182

8283
// test a NMR protein
8384
comparePDB2cif("2kc9","A");
84-
85-
8685
}
8786

88-
89-
protected void comparePDB2cif(String id, String chainId){
90-
String fileName = "/"+id+".cif";
87+
private void comparePDB2cif(String id, String chainId) throws IOException {
88+
String fileName = "/"+id+".cif";
9189
InputStream inStream = this.getClass().getResourceAsStream(fileName);
9290
assertNotNull("Could not find file " + fileName + ". Config problem?" , inStream);
9391

@@ -119,11 +117,9 @@ protected void comparePDB2cif(String id, String chainId){
119117
PDBFileParser pdbpars = new PDBFileParser();
120118
pdbpars.setFileParsingParameters(params);
121119

122-
try {
123-
pdbStructure = pdbpars.parsePDBFile(pinStream) ;
124-
} catch (IOException e) {
125-
e.printStackTrace();
126-
}
120+
121+
pdbStructure = pdbpars.parsePDBFile(pinStream) ;
122+
127123

128124
assertNotNull(pdbStructure);
129125

@@ -249,9 +245,9 @@ private void checkGroups(Group g1, Group g2){
249245
fail("could not get atom for group " + g1);
250246
if (a2 == null)
251247
fail("could not get atom for group " + g2);
252-
assertEquals(a1.getX(),a2.getX());
253-
assertEquals(a1.getOccupancy(),a2.getOccupancy());
254-
assertEquals(a1.getTempFactor(),a2.getTempFactor());
248+
assertEquals(a1.getX(),a2.getX(), 0.0001);
249+
assertEquals(a1.getOccupancy(),a2.getOccupancy(), 0.0001);
250+
assertEquals(a1.getTempFactor(),a2.getTempFactor(), 0.0001);
255251
assertEquals(a1.getName(),a2.getName());
256252

257253

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/StructureTest.java

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.biojava.nbio.structure.*;
2424
import org.biojava.nbio.structure.io.FileParsingParameters;
2525
import org.biojava.nbio.structure.io.PDBFileParser;
26+
import org.biojava.nbio.structure.io.SSBondImpl;
2627
import org.biojava.nbio.structure.jama.Matrix;
2728

2829
import java.io.IOException;
@@ -54,6 +55,7 @@ public static void setUp() throws IOException {
5455
PDBFileParser pdbpars = new PDBFileParser();
5556
FileParsingParameters params = new FileParsingParameters();
5657
params.setAlignSeqRes(true);
58+
params.setCreateAtomBonds(true);
5759
pdbpars.setFileParsingParameters(params);
5860

5961
structure = pdbpars.parsePDBFile(inStream) ;
@@ -125,27 +127,38 @@ public void testReadPDBFile() throws Exception {
125127
public void testSSBondParsing() throws Exception {
126128
assertNotNull(structure);
127129

128-
List<SSBond> ssbonds = structure.getSSBonds();
130+
List<Bond> ssbonds = structure.getSSBonds();
129131
assertEquals("did not find the correct nr of SSBonds ",3,ssbonds.size());
130132

131133
String pdb1 = "SSBOND 1 CYS A 5 CYS A 55";
132134
String pdb2 = "SSBOND 2 CYS A 14 CYS A 38";
133135

134-
SSBond bond1 = ssbonds.get(0);
136+
Bond bond1 = ssbonds.get(0);
137+
assertDisulfideBond("A", "A", 5, 55, bond1);
135138

136-
String b1 = bond1.toPDB();
139+
Bond bond2 = ssbonds.get(1);
140+
assertDisulfideBond("A", "A", 14, 38, bond2);
137141

138-
assertTrue("PDB representation incorrect",pdb1.equals(b1.trim()));
139-
assertTrue("not right resnum1 " , bond1.getResnum1().equals("5"));
140-
assertTrue("not right resnum2 " , bond1.getResnum2().equals("55"));
142+
List<SSBondImpl> list = SSBondImpl.getSsBondListFromBondList(ssbonds);
141143

142-
SSBond bond2 = ssbonds.get(1);
143-
String b2 = bond2.toPDB();
144-
assertTrue("not right resnum1 " , bond2.getResnum1().equals("14"));
145-
assertTrue("not right resnum2 " , bond2.getResnum2().equals("38"));
146-
assertTrue("PDB representation incorrect",pdb2.equals(b2.trim()));
144+
//System.out.println(list.get(0).toPDB());
145+
assertEquals("PDB representation incorrect", pdb1, list.get(0).toPDB().trim());
146+
147+
//System.out.println(list.get(1).toPDB());
148+
assertEquals("PDB representation incorrect", pdb2, list.get(1).toPDB().trim());
147149

148150
}
151+
152+
private void assertDisulfideBond(String expectedChainId1, String expectedChainId2, int expectedResSerial1, int expectedResSerial2, Bond bond) {
153+
String chainId1 = bond.getAtomA().getGroup().getChainId();
154+
String chainId2 = bond.getAtomB().getGroup().getChainId();
155+
ResidueNumber resNum1 = bond.getAtomA().getGroup().getResidueNumber();
156+
ResidueNumber resNum2 = bond.getAtomB().getGroup().getResidueNumber();
157+
assertEquals("disulfide bond first chain id failed ", expectedChainId1, chainId1);
158+
assertEquals("disulfide bond second chain id failed ", expectedChainId2, chainId2);
159+
assertEquals("disulfide bond failed first residue number failed ", new ResidueNumber(expectedChainId1, expectedResSerial1, null), resNum1);
160+
assertEquals("disulfide bond failed second residue number failed ", new ResidueNumber(expectedChainId2, expectedResSerial2, null), resNum2);
161+
}
149162

150163
/**
151164
* Tests that standard amino acids are working properly

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/Test1o2f.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.biojava.nbio.structure.test;
22

33
import org.biojava.nbio.structure.Chain;
4-
import org.biojava.nbio.structure.Group;
54
import org.biojava.nbio.structure.Structure;
65
import org.biojava.nbio.structure.StructureIO;
76
import org.biojava.nbio.structure.align.util.AtomCache;

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/ecod/EcodParseTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
package org.biojava.nbio.structure.test.ecod;
2222

2323
import java.io.IOException;
24-
import java.util.Arrays;
2524
import java.util.List;
2625

2726
import org.biojava.nbio.structure.Atom;

0 commit comments

Comments
 (0)