Skip to content

Commit 8ba289d

Browse files
committed
making output less verbose
1 parent 07f244a commit 8ba289d

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@
4040
import org.biojava.nbio.structure.io.mmcif.model.ChemComp;
4141
import org.junit.Assert;
4242
import org.junit.Test;
43+
import org.slf4j.Logger;
44+
import org.slf4j.LoggerFactory;
4345

4446
public class TestHeaderOnly {
4547

48+
private static final Logger logger = LoggerFactory.getLogger(TestHeaderOnly.class);
49+
50+
4651
private final String pdbID = "1REP";
4752

4853
/**
@@ -69,20 +74,14 @@ public void testHeaderOnly() throws StructureException, IOException {
6974
Structure sPDB = StructureIO.getStructure(pdbID);
7075

7176
Assert.assertEquals(false, doSeqResHaveAtoms(sPDB));
72-
73-
for (Chain c : sPDB.getChains()) {
74-
System.out.println(c.getId() + ":" + getSequenceString(c.getSeqResGroups()));
75-
}
76-
77+
7778
// Test 2: with mmCIF
7879
cache.setUseMmCif(true);
7980

8081
Structure sCIF = StructureIO.getStructure(pdbID);
8182
Assert.assertEquals(false, doSeqResHaveAtoms(sCIF));
8283

83-
for (Chain c : sCIF.getChains()) {
84-
System.out.println(c.getId() + ":" + getSequenceString(c.getSeqResGroups()));
85-
}
84+
8685
}
8786

8887
/**
@@ -144,7 +143,7 @@ public void testSpeed() {
144143
}
145144
long stop = System.nanoTime();
146145
double diff = (stop - start) / 1000000000.0;
147-
System.out.println(String.format("[%s] Elapsed time: %.3f s", s.getIdentifier(), diff));
146+
logger.info(String.format("[%s] Elapsed time: %.3f s", s.getIdentifier(), diff));
148147
}
149148

150149
// Test using local files.
@@ -160,28 +159,28 @@ public void testSpeed2() throws StructureException, IOException {
160159
FileParsingParameters params = new FileParsingParameters();
161160
params.setHeaderOnly(true); // Flip this true/false to compare parsing speed.
162161

163-
System.out.println("Testing PDB parsing speed");
162+
logger.info("Testing PDB parsing speed");
164163
PDBFileParser pdbpars = new PDBFileParser();
165164
pdbpars.setFileParsingParameters(params);
166165
//pdbpars.setLoadChemCompInfo(true);
167166
long start = System.nanoTime();
168167
Structure s1 = pdbpars.parsePDBFile(pdbStream) ;
169168
long stop = System.nanoTime();
170169
double diff = (stop - start) / 1000000000.0;
171-
System.out.println(String.format("[%s] Elapsed time: %.3f s", s1.getIdentifier(), diff));
170+
logger.info(String.format("[%s] Elapsed time: %.3f s", s1.getIdentifier(), diff));
172171

173172
MMcifParser mmcifpars = new SimpleMMcifParser();
174173
SimpleMMcifConsumer consumer = new SimpleMMcifConsumer();
175174
consumer.setFileParsingParameters(params);
176175
mmcifpars.addMMcifConsumer(consumer);
177176

178-
System.out.println("Testing mmCIF parsing speed");
177+
logger.info("Testing mmCIF parsing speed");
179178
start = System.nanoTime();
180179
mmcifpars.parse(cifStream) ;
181180
Structure s2 = consumer.getStructure();
182181
stop = System.nanoTime();
183182
diff = (stop - start) / 1000000000.0;
184-
System.out.println(String.format("[%s] Elapsed time: %.3f s", s2.getIdentifier(), diff));
183+
logger.info(String.format("[%s] Elapsed time: %.3f s", s2.getIdentifier(), diff));
185184

186185
/* Running from an SSD..
187186
* PDB .165s (all atom) -> 0.009s (only header) 95% faster.

0 commit comments

Comments
 (0)