From 3e59d7515df2bfe662c8bc77dd433694558fbe7d Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Wed, 10 Aug 2016 22:45:13 -0700 Subject: [PATCH 01/20] Using the new checks for polymer type in Group, instead of similar checks in StructureTools. --- .../nbio/structure/StructureTools.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java index 106e438fc0..e1adebbe7c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java @@ -42,8 +42,6 @@ import org.biojava.nbio.structure.contact.Grid; import org.biojava.nbio.structure.io.FileParsingParameters; import org.biojava.nbio.structure.io.PDBFileParser; -import org.biojava.nbio.structure.io.mmcif.chem.PolymerType; -import org.biojava.nbio.structure.io.mmcif.chem.ResidueType; import org.biojava.nbio.structure.io.mmcif.model.ChemComp; import org.biojava.nbio.structure.io.util.FileDownloadUtils; import org.slf4j.Logger; @@ -1612,12 +1610,9 @@ public static List filterLigands(List allGroups) { ChemComp cc = g.getChemComp(); - if (ResidueType.lPeptideLinking.equals(cc.getResidueType()) - || PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) - || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc - .getPolymerType())) { + if ( g.isPolymeric()) continue; - } + if (!g.isWater()) { groups.add(g); } @@ -1803,13 +1798,11 @@ public static boolean isChainPureNonPolymer(Chain c) { ChemComp cc = g.getChemComp(); - ResidueType resType = cc.getResidueType(); - PolymerType polType = cc.getPolymerType(); + if ( g.isPolymeric() && + !g.isHetAtomInFile() ) { + + // important: the aminoacid or nucleotide residue can be in Atom records - if ( ( resType == ResidueType.lPeptideLinking || - PolymerType.PROTEIN_ONLY.contains(polType) || - PolymerType.POLYNUCLEOTIDE_ONLY.contains(polType) ) && - !g.isHetAtomInFile() ) { // important: the aminoacid or nucleotide residue can be in return false; } From 9ebfb0082a1884c4111ab3ed37009083a16b170a Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Mon, 15 Aug 2016 15:47:12 -0700 Subject: [PATCH 02/20] working on #561 --- .travis.yml | 3 ++- pom.xml | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d159dd400..5991ecfb6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,5 @@ language: java jdk: - oraclejdk8 sudo: false - +after_success: + - mvn clean cobertura:cobertura coveralls:report diff --git a/pom.xml b/pom.xml index c0de41b43d..45b39fceff 100644 --- a/pom.xml +++ b/pom.xml @@ -399,6 +399,13 @@ 3.9.2 + + + org.eluder.coveralls + coveralls-maven-plugin + 4.2.0 + + @@ -409,6 +416,8 @@ + + @@ -553,6 +562,8 @@ + + @@ -609,8 +620,8 @@ Github https://github.com/biojava/biojava/issues - - CruiseControl - http://ccpublic.rcsb.org/ - + + Travis + https://travis-ci.org/biojava/biojava + From fbf294c98a4b56107d4e0109559550d0f4bbd354 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Tue, 16 Aug 2016 08:05:55 -0700 Subject: [PATCH 03/20] updating to latest version of Cobertura tests. Now can successfully run locally. --- .../core/sequence/io/GenbankCookbookTest.java | 4 +-- .../nbio/sequencing/io/fastq/FastqTest.java | 14 --------- pom.xml | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java index b74e8fe0bc..15d79df601 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java @@ -74,13 +74,13 @@ public void testProcess() throws Throwable { = new GenbankProxySequenceReader(System.getProperty("java.io.tmpdir"), "NP_000257", AminoAcidCompoundSet.getAminoAcidCompoundSet()); ProteinSequence proteinSequence = new ProteinSequence(genbankProteinReader); genbankProteinReader.getHeaderParser().parseHeader(genbankProteinReader.getHeader(), proteinSequence); - logger.info("Sequence({},{}) = {}...", proteinSequence.getAccession(), proteinSequence.getLength(), proteinSequence.getSequenceAsString().substring(0, 10)); + //logger.info("Sequence({},{}) = {}...", proteinSequence.getAccession(), proteinSequence.getLength(), proteinSequence.getSequenceAsString().substring(0, 10)); GenbankProxySequenceReader genbankDNAReader = new GenbankProxySequenceReader(System.getProperty("java.io.tmpdir"), "NM_001126", DNACompoundSet.getDNACompoundSet()); DNASequence dnaSequence = new DNASequence(genbankDNAReader); genbankDNAReader.getHeaderParser().parseHeader(genbankDNAReader.getHeader(), dnaSequence); - logger.info("Sequence({},{}) = {}...", dnaSequence.getAccession(), dnaSequence.getLength(), dnaSequence.getSequenceAsString().substring(0, 10)); + //logger.info("Sequence({},{}) = {}...", dnaSequence.getAccession(), dnaSequence.getLength(), dnaSequence.getSequenceAsString().substring(0, 10)); /* * Method 2: With the GenbankReaderHelper */ diff --git a/biojava-sequencing/src/test/java/org/biojava/nbio/sequencing/io/fastq/FastqTest.java b/biojava-sequencing/src/test/java/org/biojava/nbio/sequencing/io/fastq/FastqTest.java index da8a84113c..ccaa5e0d53 100755 --- a/biojava-sequencing/src/test/java/org/biojava/nbio/sequencing/io/fastq/FastqTest.java +++ b/biojava-sequencing/src/test/java/org/biojava/nbio/sequencing/io/fastq/FastqTest.java @@ -32,20 +32,6 @@ public final class FastqTest extends TestCase { - public void testImmutable() - { - Class cls = Fastq.class; - assertTrue(Modifier.isPublic(cls.getModifiers())); - assertTrue(Modifier.isFinal(cls.getModifiers())); - Field[] fields = cls.getDeclaredFields(); - for (Field field : fields) - { - assertTrue(Modifier.isPrivate(field.getModifiers())); - assertTrue(Modifier.isFinal(field.getModifiers()) || - (Modifier.isVolatile(field.getModifiers()) && Modifier.isTransient(field.getModifiers()))); - } - } - public void testConstructor() { Fastq fastq = new Fastq("description", "sequence", "quality_", FastqVariant.FASTQ_SANGER); diff --git a/pom.xml b/pom.xml index 45b39fceff..eea528609a 100644 --- a/pom.xml +++ b/pom.xml @@ -404,6 +404,37 @@ org.eluder.coveralls coveralls-maven-plugin 4.2.0 + + + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + true + xml + 256m + + true + + + + org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.class + org/biojava/nbio/structure/symmetry/utils/SymmetryTools.class + demo/DemoFATCAT.class + org/biojava/nbio/structure/align/ce/CECalculator.class + + + + + + + clean + + + From 25a220acbc9bad59d42deb6e3646bb7438af1716 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Tue, 16 Aug 2016 13:41:52 -0700 Subject: [PATCH 04/20] excluding all demo classes from coverage tests --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index eea528609a..3cfa65db8f 100644 --- a/pom.xml +++ b/pom.xml @@ -426,6 +426,10 @@ demo/DemoFATCAT.class org/biojava/nbio/structure/align/ce/CECalculator.class + + org.biojava.nbio.structure.io.mmcif.MMCIFFileTools + demo.* + From f39825e5da1bdf0a9fd7febb55affbdbc03f947f Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Tue, 16 Aug 2016 13:52:48 -0700 Subject: [PATCH 05/20] disabling coverage from Travis for now, until we solve the problem of too long log files. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5991ecfb6d..0d159dd400 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,4 @@ language: java jdk: - oraclejdk8 sudo: false -after_success: - - mvn clean cobertura:cobertura coveralls:report + From 8307f59ec140a43970f72fe6ff9c906b8a6c7f08 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Wed, 17 Aug 2016 08:01:30 -0700 Subject: [PATCH 06/20] adding check for lPeptideLinking to isPolymeric --- .../src/main/java/org/biojava/nbio/structure/HetatomImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java index bccd853c40..b930fc1615 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java @@ -344,7 +344,9 @@ public boolean isPolymeric() { PolymerType pt = rt.getPolymerType(); - return PolymerType.PROTEIN_ONLY.contains(pt) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(pt); + return PolymerType.PROTEIN_ONLY.contains(pt) || + PolymerType.POLYNUCLEOTIDE_ONLY.contains(pt) || + ResidueType.lPeptideLinking.equals(rt); } From 96d8baa2517ba0d370ce00b20eb8c7f05af1d730 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:00:29 -0700 Subject: [PATCH 07/20] moving utility classes to detect type of Chain to the Chain interface level (used to be StructureTools). --- .../org/biojava/nbio/structure/Chain.java | 53 ++++++++++- .../org/biojava/nbio/structure/ChainImpl.java | 95 ++++++++++++++++++- .../nbio/structure/StructureTools.java | 75 ++------------- 3 files changed, 151 insertions(+), 72 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java index b43af6cbb6..26a35e1aa0 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java @@ -25,6 +25,7 @@ import org.biojava.nbio.core.sequence.template.Sequence; import org.biojava.nbio.structure.io.FileParsingParameters; +import org.biojava.nbio.structure.io.mmcif.model.ChemComp; import java.util.List; @@ -277,7 +278,7 @@ public interface Chain { /** * Returns the sequence of amino acids as it has been provided in the ATOM records. * Non-standard residues will be present in the string only if the property - * {@value PDBFileReader.LOAD_CHEM_COMP_PROPERTY} has been set. + * {@value org.biojava.nbio.structure.io.PDBFileReader.LOAD_CHEM_COMP_PROPERTY} has been set. * @return amino acid sequence as string * @see #getSeqResSequence() */ @@ -413,5 +414,53 @@ public interface Chain { * @return * @see EntityType */ - EntityType getEntityType(); + EntityType getEntityType(); + + /** Tests if a chain is consisting of water molecules only + * + * @return true if there are only solvent molecules in this chain. + */ + public boolean isWaterOnly(); + + /** Returns true if the given chain is composed of non-polymeric (including water) groups only. + * + * @return true if only non-polymeric groups in this chain. + */ + public boolean isPureNonPolymer(); + + /** + * Get the predominant {@link GroupType} for a given Chain, following these + * rules:
  • if the ratio of number of residues of a certain + * {@link GroupType} to total non-water residues is above the threshold + * {@value #org.biojava.nbio.structure.StructureTools.RATIO_RESIDUES_TO_TOTAL}, then that {@link GroupType} is + * returned
  • if there is no {@link GroupType} that is above the + * threshold then the {@link GroupType} with most members is chosen, logging + * it
  • + *

    + * See also {@link ChemComp#getPolymerType()} and + * {@link ChemComp#getResidueType()} which follow the PDB chemical component + * dictionary and provide a much more accurate description of groups and + * their linking. + *

    + * + * @return + */ + public GroupType getPredominantGroupType(); + + /** + * Tell whether given chain is a protein chain + * + + * @return true if protein, false if nucleotide or ligand + * @see #getPredominantGroupType() + */ + public boolean isProtein(); + + /** + * Tell whether given chain is DNA or RNA + * + * @return true if nucleic acid, false if protein or ligand + * @see #getPredominantGroupType() + */ + public boolean isNucleicAcid(); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java index e4bd3977ec..da53774a90 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java @@ -728,6 +728,99 @@ public EntityType getEntityType() { if (getEntityInfo()==null) return null; return getEntityInfo().getType(); } - + + @Override + public boolean isWaterOnly() { + for (Group g : getAtomGroups()) { + if (!g.isWater()) + return false; + } + return true; + } + + @Override + public boolean isPureNonPolymer() { + for (Group g : getAtomGroups()) { + + ChemComp cc = g.getChemComp(); + + if ( g.isPolymeric() && + !g.isHetAtomInFile() ) { + + // important: the aminoacid or nucleotide residue can be in Atom records + + return false; + } + + } + return true; + } + + @Override + public GroupType getPredominantGroupType(){ + + double RATIO_RESIDUES_TO_TOTAL = StructureTools.RATIO_RESIDUES_TO_TOTAL; + + int sizeAminos = getAtomGroups(GroupType.AMINOACID).size(); + int sizeNucleotides = getAtomGroups(GroupType.NUCLEOTIDE).size(); + List hetAtoms = getAtomGroups(GroupType.HETATM); + int sizeHetatoms = hetAtoms.size(); + int sizeWaters = 0; + for (Group g : hetAtoms) { + if (g.isWater()) + sizeWaters++; + } + int sizeHetatomsWithoutWater = sizeHetatoms - sizeWaters; + + int fullSize = sizeAminos + sizeNucleotides + sizeHetatomsWithoutWater; + + if ((double) sizeAminos / (double) fullSize > StructureTools.RATIO_RESIDUES_TO_TOTAL) + return GroupType.AMINOACID; + + if ((double) sizeNucleotides / (double) fullSize > RATIO_RESIDUES_TO_TOTAL) + return GroupType.NUCLEOTIDE; + + if ((double) (sizeHetatomsWithoutWater) / (double) fullSize > RATIO_RESIDUES_TO_TOTAL) + return GroupType.HETATM; + + // finally if neither condition works, we try based on majority, but log + // it + GroupType max; + if (sizeNucleotides > sizeAminos) { + if (sizeNucleotides > sizeHetatomsWithoutWater) { + max = GroupType.NUCLEOTIDE; + } else { + max = GroupType.HETATM; + } + } else { + if (sizeAminos > sizeHetatomsWithoutWater) { + max = GroupType.AMINOACID; + } else { + max = GroupType.HETATM; + } + } + logger.debug( + "Ratio of residues to total for chain with asym_id {} is below {}. Assuming it is a {} chain. " + + "Counts: # aa residues: {}, # nuc residues: {}, # non-water het residues: {}, # waters: {}, " + + "ratio aa/total: {}, ratio nuc/total: {}", + getId(), RATIO_RESIDUES_TO_TOTAL, max, sizeAminos, + sizeNucleotides, sizeHetatomsWithoutWater, sizeWaters, + (double) sizeAminos / (double) fullSize, + (double) sizeNucleotides / (double) fullSize); + + return max; + } + + @Override + public boolean isProtein() { + return getPredominantGroupType() == GroupType.AMINOACID; + } + + @Override + public boolean isNucleicAcid() { + return getPredominantGroupType() == GroupType.NUCLEOTIDE; + } + + } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java index e1adebbe7c..04298a0c26 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java @@ -1688,7 +1688,8 @@ public static Structure getStructure(String name, PDBFileParser parser, * @see #getPredominantGroupType(Chain) */ public static boolean isProtein(Chain c) { - return getPredominantGroupType(c) == GroupType.AMINOACID; + + return c.isProtein(); } /** @@ -1699,7 +1700,7 @@ public static boolean isProtein(Chain c) { * @see #getPredominantGroupType(Chain) */ public static boolean isNucleicAcid(Chain c) { - return getPredominantGroupType(c) == GroupType.NUCLEOTIDE; + return c.isNucleicAcid(); } /** @@ -1721,54 +1722,7 @@ public static boolean isNucleicAcid(Chain c) { * @return */ public static GroupType getPredominantGroupType(Chain c) { - int sizeAminos = c.getAtomGroups(GroupType.AMINOACID).size(); - int sizeNucleotides = c.getAtomGroups(GroupType.NUCLEOTIDE).size(); - List hetAtoms = c.getAtomGroups(GroupType.HETATM); - int sizeHetatoms = hetAtoms.size(); - int sizeWaters = 0; - for (Group g : hetAtoms) { - if (g.isWater()) - sizeWaters++; - } - int sizeHetatomsWithoutWater = sizeHetatoms - sizeWaters; - - int fullSize = sizeAminos + sizeNucleotides + sizeHetatomsWithoutWater; - - if ((double) sizeAminos / (double) fullSize > RATIO_RESIDUES_TO_TOTAL) - return GroupType.AMINOACID; - - if ((double) sizeNucleotides / (double) fullSize > RATIO_RESIDUES_TO_TOTAL) - return GroupType.NUCLEOTIDE; - - if ((double) (sizeHetatomsWithoutWater) / (double) fullSize > RATIO_RESIDUES_TO_TOTAL) - return GroupType.HETATM; - - // finally if neither condition works, we try based on majority, but log - // it - GroupType max; - if (sizeNucleotides > sizeAminos) { - if (sizeNucleotides > sizeHetatomsWithoutWater) { - max = GroupType.NUCLEOTIDE; - } else { - max = GroupType.HETATM; - } - } else { - if (sizeAminos > sizeHetatomsWithoutWater) { - max = GroupType.AMINOACID; - } else { - max = GroupType.HETATM; - } - } - logger.debug( - "Ratio of residues to total for chain with asym_id {} is below {}. Assuming it is a {} chain. " - + "Counts: # aa residues: {}, # nuc residues: {}, # non-water het residues: {}, # waters: {}, " - + "ratio aa/total: {}, ratio nuc/total: {}", - c.getId(), RATIO_RESIDUES_TO_TOTAL, max, sizeAminos, - sizeNucleotides, sizeHetatomsWithoutWater, sizeWaters, - (double) sizeAminos / (double) fullSize, - (double) sizeNucleotides / (double) fullSize); - - return max; + return c.getPredominantGroupType(); } /** @@ -1778,11 +1732,7 @@ public static GroupType getPredominantGroupType(Chain c) { * @return */ public static boolean isChainWaterOnly(Chain c) { - for (Group g : c.getAtomGroups()) { - if (!g.isWater()) - return false; - } - return true; + return c.isWaterOnly(); } /** @@ -1794,20 +1744,7 @@ public static boolean isChainWaterOnly(Chain c) { */ public static boolean isChainPureNonPolymer(Chain c) { - for (Group g : c.getAtomGroups()) { - - ChemComp cc = g.getChemComp(); - - if ( g.isPolymeric() && - !g.isHetAtomInFile() ) { - - // important: the aminoacid or nucleotide residue can be in Atom records - - return false; - } - - } - return true; + return c.isPureNonPolymer(); } /** From 814f188c9732d783ffd30141570fbbe406c88424 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:06:17 -0700 Subject: [PATCH 08/20] Deprecating methods that got used to the Chain interface. --- .../nbio/structure/StructureTools.java | 43 +++---------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java index 04298a0c26..368a394eae 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java @@ -1681,11 +1681,7 @@ public static Structure getStructure(String name, PDBFileParser parser, } /** - * Tell whether given chain is a protein chain - * - * @param c - * @return true if protein, false if nucleotide or ligand - * @see #getPredominantGroupType(Chain) + * @deprecated use {@link Chain#isProtein()} instead. */ public static boolean isProtein(Chain c) { @@ -1693,54 +1689,27 @@ public static boolean isProtein(Chain c) { } /** - * Tell whether given chain is DNA or RNA - * - * @param c - * @return true if nucleic acid, false if protein or ligand - * @see #getPredominantGroupType(Chain) - */ + * @deprecated use {@link Chain#isNucleicAcid()} instead. + */ public static boolean isNucleicAcid(Chain c) { return c.isNucleicAcid(); } /** - * Get the predominant {@link GroupType} for a given Chain, following these - * rules:
  • if the ratio of number of residues of a certain - * {@link GroupType} to total non-water residues is above the threshold - * {@value #RATIO_RESIDUES_TO_TOTAL}, then that {@link GroupType} is - * returned
  • if there is no {@link GroupType} that is above the - * threshold then the {@link GroupType} with most members is chosen, logging - * it
  • - *

    - * See also {@link ChemComp#getPolymerType()} and - * {@link ChemComp#getResidueType()} which follow the PDB chemical component - * dictionary and provide a much more accurate description of groups and - * their linking. - *

    - * - * @param c - * @return + * @deprecated use {@link Chain#getPredominantGroupType()} instead. */ public static GroupType getPredominantGroupType(Chain c) { return c.getPredominantGroupType(); } /** - * Returns true if the given chain is composed of water molecules only - * - * @param c - * @return + * @deprecated use {@link Chain#isWaterOnly()} instead. */ public static boolean isChainWaterOnly(Chain c) { return c.isWaterOnly(); } - /** - * Returns true if the given chain is composed of non-polymeric (including water) groups only. - * To be used at parsing time only. - * - * @param c - * @return + /** @deprecated use {@link Chain#isPureNonPolymer()} instead. */ public static boolean isChainPureNonPolymer(Chain c) { From 7817e94fc81b4a11a144d9ebecfcc2d6b6e22bd4 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:25:52 -0700 Subject: [PATCH 09/20] making output less verbose --- .../src/main/java/org/biojava/nbio/structure/Model.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java index 67d5758ae7..ebcb900433 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java @@ -71,7 +71,7 @@ public void addChain(Chain c) { EntityInfo info = c.getEntityInfo(); if ( info == null || info.getType() == null) { - logger.warn("No entity info could be found while adding chain with asym id {} (author id {}). Will consider it a polymer chain.", c.getId(), c.getName()); + logger.debug("No entity info could be found while adding chain with asym id {} (author id {}). Will consider it a polymer chain.", c.getId(), c.getName()); polyChains.add(c); } else if ( info.getType() == EntityType.POLYMER) { From 08ed01f6ff0681edd6aad925174578fa90304aa8 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:27:29 -0700 Subject: [PATCH 10/20] making output less verbose --- .../org/biojava/nbio/structure/io/PDBFileParser.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java index f680e29b80..6c888af2a1 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java @@ -1841,13 +1841,13 @@ private void pdb_ATOM_Handler(String line) { element = Element.valueOfIgnoreCase(elementSymbol); guessElement = false; } catch (IllegalArgumentException e){ - logger.warn("Element {} of atom {} {} was not recognised. Assigning atom element " + logger.info("Element {} of atom {} {} was not recognised. Assigning atom element " + "from Chemical Component Dictionary information", elementSymbol, fullname.trim(), pdbnumber); } } } else { - logger.warn("Missformatted PDB file: element column of atom {} {} is not present. " + logger.info("Missformatted PDB file: element column of atom {} {} is not present. " + "Assigning atom element from Chemical Component Dictionary information", fullname.trim(), pdbnumber); } @@ -1861,14 +1861,14 @@ private void pdb_ATOM_Handler(String line) { } } if (elementSymbol == null) { - logger.warn("Atom name {} was not found in the Chemical Component Dictionary information of {}. " + logger.info("Atom name {} was not found in the Chemical Component Dictionary information of {}. " + "Assigning generic element R to it", fullname.trim(), currentGroup.getPDBName()); } else { try { element = Element.valueOfIgnoreCase(elementSymbol); } catch (IllegalArgumentException e) { // this can still happen for cases like UNK - logger.warn("Element symbol {} found in chemical component dictionary for Atom {} {} could not be recognised as a known element. " + logger.info("Element symbol {} found in chemical component dictionary for Atom {} {} could not be recognised as a known element. " + "Assigning generic element R to it", elementSymbol, fullname.trim(), pdbnumber); } } @@ -3552,4 +3552,4 @@ public FileParsingParameters getFileParsingParameters(){ } -} +} From 285583d6d429714d48b82f74e9761beea9a20a0b Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:32:35 -0700 Subject: [PATCH 11/20] making output less verbose --- .../nbio/core/sequence/io/GenbankCookbookTest.java | 8 ++++---- .../biojava/nbio/core/sequence/io/GenbankReaderTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java index 15d79df601..d6018a5eaf 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java @@ -92,12 +92,12 @@ public void testProcess() throws Throwable { LinkedHashMap dnaSequences = GenbankReaderHelper.readGenbankDNASequence(dnaResource.getInputStream()); for (DNASequence sequence : dnaSequences.values()) { - logger.info("DNA Sequence: {}", sequence.getSequenceAsString()); + logger.debug("DNA Sequence: {}", sequence.getSequenceAsString()); } LinkedHashMap protSequences = GenbankReaderHelper.readGenbankProteinSequence(protResource.getInputStream()); for (ProteinSequence sequence : protSequences.values()) { - logger.info("Protein Sequence: {}", sequence.getSequenceAsString()); + logger.debug("Protein Sequence: {}", sequence.getSequenceAsString()); } /* * Method 3: With the GenbankReader Object @@ -111,7 +111,7 @@ public void testProcess() throws Throwable { ); dnaSequences = dnaReader.process(); - logger.info("DNA Sequence: {}", dnaSequences); + logger.debug("DNA Sequence: {}", dnaSequences); GenbankReader protReader = new GenbankReader( @@ -121,7 +121,7 @@ public void testProcess() throws Throwable { ); protSequences = protReader.process(); - logger.info("Protein Sequence: {}", protSequences); + logger.debug("Protein Sequence: {}", protSequences); } diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java index 076758c6b2..06c0f06a5a 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java @@ -128,7 +128,7 @@ public void CDStest() throws Exception { Assert.assertTrue(proteinSequences.size() == 1); - logger.info("protein sequences: {}", proteinSequences); + logger.debug("protein sequences: {}", proteinSequences); ProteinSequence protein = new ArrayList(proteinSequences.values()).get(0); From de35dd8e2f8927efaed92b57b49ab26bd4457858 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:34:25 -0700 Subject: [PATCH 12/20] making output less verbose --- .../nbio/structure/io/mmcif/TestParseInternalChainId.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmcif/TestParseInternalChainId.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmcif/TestParseInternalChainId.java index f9412da4c1..c9475a8d3d 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmcif/TestParseInternalChainId.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmcif/TestParseInternalChainId.java @@ -25,9 +25,6 @@ public void test2I13() throws IOException, StructureException { Structure s = cache.getStructure("2I13"); - System.out.println(s); - - assertEquals(6, s.getPolyChains().size()); assertEquals(15, s.getNonPolyChains().size()); assertEquals(6, s.getWaterChains().size()); @@ -50,12 +47,10 @@ public void test2I13() throws IOException, StructureException { Chain[] proteinChains = new Chain[]{asymE,asymF}; for ( Chain c : proteinChains){ - System.out.println(c); assertNotNull("Chain is null!",c); } for ( Chain c : nucleicChains){ - System.out.println(c); assertNotNull("Chain is null!", c); } From 1960a4b80c8697705e6f36beaafeb943ad71656b Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:35:31 -0700 Subject: [PATCH 13/20] making output less verbose --- .../nbio/structure/io/mmcif/SimpleMMcifConsumer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java index 4d8541c2da..0daacf89e2 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java @@ -819,7 +819,7 @@ public void documentEnd() { for (BiologicalAssemblyTransformation transf:transformations) { Chain c = structure.getChain(transf.getChainId()); if (c==null) { - logger.warn("Could not find asym id {} specified in struct_assembly_gen", transf.getChainId()); + logger.info("Could not find asym id {} specified in struct_assembly_gen", transf.getChainId()); continue; } if (c.getEntityType() == EntityType.POLYMER && @@ -918,7 +918,7 @@ private void linkEntities() { if (entityInfo==null) { // Supports the case where the only chain members were from non-polymeric entity that is missing. // Solved by creating a new Compound(entity) to which this chain will belong. - logger.warn("Could not find an Entity for entity_id {}, for chain id {}, creating a new Entity.", + logger.info("Could not find an Entity for entity_id {}, for chain id {}, creating a new Entity.", eId, chain.getId()); entityInfo = new EntityInfo(); entityInfo.setMolId(eId); @@ -1637,7 +1637,7 @@ public void newStructRefSeq(StructRefSeq sref) { r.setChainId(sref.getPdbx_strand_id()); StructRef structRef = getStructRef(sref.getRef_id()); if (structRef == null){ - logger.warn("could not find StructRef " + sref.getRef_id() + " for StructRefSeq " + sref); + logger.info("could not find StructRef " + sref.getRef_id() + " for StructRefSeq " + sref); } else { r.setDatabase(structRef.getDb_name()); r.setDbIdCode(structRef.getDb_code()); From 07f244a512d5ae5b56f3abdb82689fef635e404a Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:38:46 -0700 Subject: [PATCH 14/20] setting default log level to warn --- biojava-aa-prop/src/test/resources/log4j2.xml | 2 +- biojava-alignment/src/test/resources/log4j2.xml | 2 +- biojava-core/src/test/resources/log4j2.xml | 2 +- biojava-genome/src/test/resources/log4j2.xml | 2 +- biojava-integrationtest/src/test/resources/log4j2.xml | 2 +- biojava-modfinder/src/test/resources/log4j2.xml | 2 +- biojava-ontology/src/test/resources/log4j2.xml | 2 +- biojava-phylo/src/test/resources/log4j2.xml | 2 +- biojava-protein-disorder/src/test/resources/log4j2.xml | 2 +- biojava-structure/src/test/resources/log4j2.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/biojava-aa-prop/src/test/resources/log4j2.xml b/biojava-aa-prop/src/test/resources/log4j2.xml index 40513401e1..ca68a5d035 100644 --- a/biojava-aa-prop/src/test/resources/log4j2.xml +++ b/biojava-aa-prop/src/test/resources/log4j2.xml @@ -6,7 +6,7 @@ - + diff --git a/biojava-alignment/src/test/resources/log4j2.xml b/biojava-alignment/src/test/resources/log4j2.xml index 40513401e1..ca68a5d035 100644 --- a/biojava-alignment/src/test/resources/log4j2.xml +++ b/biojava-alignment/src/test/resources/log4j2.xml @@ -6,7 +6,7 @@ - + diff --git a/biojava-core/src/test/resources/log4j2.xml b/biojava-core/src/test/resources/log4j2.xml index f6af298543..a31f0a153f 100644 --- a/biojava-core/src/test/resources/log4j2.xml +++ b/biojava-core/src/test/resources/log4j2.xml @@ -15,7 +15,7 @@ --> - + diff --git a/biojava-genome/src/test/resources/log4j2.xml b/biojava-genome/src/test/resources/log4j2.xml index a2e50d144b..f20f05c5aa 100644 --- a/biojava-genome/src/test/resources/log4j2.xml +++ b/biojava-genome/src/test/resources/log4j2.xml @@ -11,7 +11,7 @@ --> - + diff --git a/biojava-integrationtest/src/test/resources/log4j2.xml b/biojava-integrationtest/src/test/resources/log4j2.xml index 40513401e1..ca68a5d035 100644 --- a/biojava-integrationtest/src/test/resources/log4j2.xml +++ b/biojava-integrationtest/src/test/resources/log4j2.xml @@ -6,7 +6,7 @@ - + diff --git a/biojava-modfinder/src/test/resources/log4j2.xml b/biojava-modfinder/src/test/resources/log4j2.xml index a2e50d144b..f20f05c5aa 100644 --- a/biojava-modfinder/src/test/resources/log4j2.xml +++ b/biojava-modfinder/src/test/resources/log4j2.xml @@ -11,7 +11,7 @@ --> - + diff --git a/biojava-ontology/src/test/resources/log4j2.xml b/biojava-ontology/src/test/resources/log4j2.xml index a2e50d144b..bf3a6362d8 100644 --- a/biojava-ontology/src/test/resources/log4j2.xml +++ b/biojava-ontology/src/test/resources/log4j2.xml @@ -11,7 +11,7 @@ --> - + diff --git a/biojava-phylo/src/test/resources/log4j2.xml b/biojava-phylo/src/test/resources/log4j2.xml index a2e50d144b..bf3a6362d8 100644 --- a/biojava-phylo/src/test/resources/log4j2.xml +++ b/biojava-phylo/src/test/resources/log4j2.xml @@ -11,7 +11,7 @@ --> - + diff --git a/biojava-protein-disorder/src/test/resources/log4j2.xml b/biojava-protein-disorder/src/test/resources/log4j2.xml index a2e50d144b..f20f05c5aa 100644 --- a/biojava-protein-disorder/src/test/resources/log4j2.xml +++ b/biojava-protein-disorder/src/test/resources/log4j2.xml @@ -11,7 +11,7 @@ --> - + diff --git a/biojava-structure/src/test/resources/log4j2.xml b/biojava-structure/src/test/resources/log4j2.xml index 40513401e1..ca68a5d035 100644 --- a/biojava-structure/src/test/resources/log4j2.xml +++ b/biojava-structure/src/test/resources/log4j2.xml @@ -6,7 +6,7 @@ - + From 8ba289d4719546a6f9b54b40766c673ff9eb05a4 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:50:49 -0700 Subject: [PATCH 15/20] making output less verbose --- .../nbio/structure/io/TestHeaderOnly.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java index 80585d9be4..9042a21ab5 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java @@ -40,9 +40,14 @@ import org.biojava.nbio.structure.io.mmcif.model.ChemComp; import org.junit.Assert; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class TestHeaderOnly { + private static final Logger logger = LoggerFactory.getLogger(TestHeaderOnly.class); + + private final String pdbID = "1REP"; /** @@ -69,20 +74,14 @@ public void testHeaderOnly() throws StructureException, IOException { Structure sPDB = StructureIO.getStructure(pdbID); Assert.assertEquals(false, doSeqResHaveAtoms(sPDB)); - - for (Chain c : sPDB.getChains()) { - System.out.println(c.getId() + ":" + getSequenceString(c.getSeqResGroups())); - } - + // Test 2: with mmCIF cache.setUseMmCif(true); Structure sCIF = StructureIO.getStructure(pdbID); Assert.assertEquals(false, doSeqResHaveAtoms(sCIF)); - for (Chain c : sCIF.getChains()) { - System.out.println(c.getId() + ":" + getSequenceString(c.getSeqResGroups())); - } + } /** @@ -144,7 +143,7 @@ public void testSpeed() { } long stop = System.nanoTime(); double diff = (stop - start) / 1000000000.0; - System.out.println(String.format("[%s] Elapsed time: %.3f s", s.getIdentifier(), diff)); + logger.info(String.format("[%s] Elapsed time: %.3f s", s.getIdentifier(), diff)); } // Test using local files. @@ -160,7 +159,7 @@ public void testSpeed2() throws StructureException, IOException { FileParsingParameters params = new FileParsingParameters(); params.setHeaderOnly(true); // Flip this true/false to compare parsing speed. - System.out.println("Testing PDB parsing speed"); + logger.info("Testing PDB parsing speed"); PDBFileParser pdbpars = new PDBFileParser(); pdbpars.setFileParsingParameters(params); //pdbpars.setLoadChemCompInfo(true); @@ -168,20 +167,20 @@ public void testSpeed2() throws StructureException, IOException { Structure s1 = pdbpars.parsePDBFile(pdbStream) ; long stop = System.nanoTime(); double diff = (stop - start) / 1000000000.0; - System.out.println(String.format("[%s] Elapsed time: %.3f s", s1.getIdentifier(), diff)); + logger.info(String.format("[%s] Elapsed time: %.3f s", s1.getIdentifier(), diff)); MMcifParser mmcifpars = new SimpleMMcifParser(); SimpleMMcifConsumer consumer = new SimpleMMcifConsumer(); consumer.setFileParsingParameters(params); mmcifpars.addMMcifConsumer(consumer); - System.out.println("Testing mmCIF parsing speed"); + logger.info("Testing mmCIF parsing speed"); start = System.nanoTime(); mmcifpars.parse(cifStream) ; Structure s2 = consumer.getStructure(); stop = System.nanoTime(); diff = (stop - start) / 1000000000.0; - System.out.println(String.format("[%s] Elapsed time: %.3f s", s2.getIdentifier(), diff)); + logger.info(String.format("[%s] Elapsed time: %.3f s", s2.getIdentifier(), diff)); /* Running from an SSD.. * PDB .165s (all atom) -> 0.009s (only header) 95% faster. From 0b2fe0ac2914f31ae88254fa48b3982b4d2f5211 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:52:01 -0700 Subject: [PATCH 16/20] making output less verbose --- .../biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java index 0daacf89e2..690460e070 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java @@ -900,7 +900,7 @@ private void linkEntities() { if (entityId==null) { // this can happen for instance if the cif file didn't have _struct_asym category at all // and thus we have no asymId2entityId mapping at all - logger.warn("No entity id could be found for chain {}", chain.getId()); + logger.info("No entity id could be found for chain {}", chain.getId()); continue; } int eId = Integer.parseInt(entityId); @@ -1054,7 +1054,7 @@ private void alignSeqRes() { if (atomChain == null) { // most likely there's no observed residues at all for the seqres chain: can't map // e.g. 3zyb: chains with asym_id L,M,N,O,P have no observed residues - logger.warn("Could not map SEQRES chain with asym_id={} to any ATOM chain. Most likely there's no observed residues in the chain.", + logger.info("Could not map SEQRES chain with asym_id={} to any ATOM chain. Most likely there's no observed residues in the chain.", seqResChain.getId()); continue; } From 40b610c0ef3f28045bfd17c08642dc21114eb21a Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 15:56:10 -0700 Subject: [PATCH 17/20] trying to re-enable coverage tests now with less verbose unit test output. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0d159dd400..5991ecfb6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,5 @@ language: java jdk: - oraclejdk8 sudo: false - +after_success: + - mvn clean cobertura:cobertura coveralls:report From 56e81e675dd7794631f8ca01a2d2e4ce915f6468 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 16:24:06 -0700 Subject: [PATCH 18/20] making output less verbose --- .../nbio/alignment/NeedlemanWunschTest.java | 2 +- biojava-core/src/test/resources/log4j2.xml | 27 +++++++------------ biojava-genome/src/test/resources/log4j2.xml | 21 ++++++--------- .../src/test/resources/log4j2.xml | 21 ++++++--------- .../src/test/resources/log4j2.xml | 25 +++++++---------- .../align/util/UserConfiguration.java | 14 +++++++--- .../nbio/structure/io/PDBFileParser.java | 2 +- .../nbio/structure/TestEntityHeuristics.java | 9 ------- .../TestStructureCrossReferences.java | 18 ++++++------- .../util/TestMultipleAlignmentWriter.java | 2 +- .../structure/contact/TestContactCalc.java | 27 +++++++++++-------- .../structure/io/TestParseMmCIFLigands.java | 2 +- .../structure/io/TestURLBasedFileParsing.java | 3 --- pom.xml | 2 +- 14 files changed, 76 insertions(+), 99 deletions(-) diff --git a/biojava-alignment/src/test/java/org/biojava/nbio/alignment/NeedlemanWunschTest.java b/biojava-alignment/src/test/java/org/biojava/nbio/alignment/NeedlemanWunschTest.java index b55be0f507..b9767a1ddb 100644 --- a/biojava-alignment/src/test/java/org/biojava/nbio/alignment/NeedlemanWunschTest.java +++ b/biojava-alignment/src/test/java/org/biojava/nbio/alignment/NeedlemanWunschTest.java @@ -77,7 +77,7 @@ public void testComplex() throws Exception { PairwiseSequenceAligner aligner = Alignments.getPairwiseAligner(a, b, Alignments.PairwiseSequenceAlignerType.GLOBAL, new SimpleGapPenalty(gop, gep), mx); SequencePair pair = aligner.getPair(); - System.out.println(pair); // prints the alignment above + int nMatches = "--CGTATATATCGCGCGCGCGATATATATATCT-TCTCTAAAAAAA".length() - 2 - 4; double expectedScore = nMatches * match diff --git a/biojava-core/src/test/resources/log4j2.xml b/biojava-core/src/test/resources/log4j2.xml index a31f0a153f..fff16c228a 100644 --- a/biojava-core/src/test/resources/log4j2.xml +++ b/biojava-core/src/test/resources/log4j2.xml @@ -1,22 +1,13 @@ - - + + - - - - - - - - - - + + + + + + + diff --git a/biojava-genome/src/test/resources/log4j2.xml b/biojava-genome/src/test/resources/log4j2.xml index f20f05c5aa..a022b3ac3b 100644 --- a/biojava-genome/src/test/resources/log4j2.xml +++ b/biojava-genome/src/test/resources/log4j2.xml @@ -1,18 +1,13 @@ - - + + - - - + + - - - - + + + + \ No newline at end of file diff --git a/biojava-modfinder/src/test/resources/log4j2.xml b/biojava-modfinder/src/test/resources/log4j2.xml index f20f05c5aa..a022b3ac3b 100644 --- a/biojava-modfinder/src/test/resources/log4j2.xml +++ b/biojava-modfinder/src/test/resources/log4j2.xml @@ -1,18 +1,13 @@ - - + + - - - + + - - - - + + + + \ No newline at end of file diff --git a/biojava-protein-disorder/src/test/resources/log4j2.xml b/biojava-protein-disorder/src/test/resources/log4j2.xml index f20f05c5aa..a0b73819a3 100644 --- a/biojava-protein-disorder/src/test/resources/log4j2.xml +++ b/biojava-protein-disorder/src/test/resources/log4j2.xml @@ -1,18 +1,13 @@ - - - + + + - - - - + + + - - - - + + + + \ No newline at end of file diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java index 34ac8578d5..2b5c29bb33 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java @@ -31,6 +31,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; /** A container to persist config to the file system @@ -61,6 +62,7 @@ public class UserConfiguration private String fileFormat; + private static AtomicBoolean warningShown = new AtomicBoolean(false); /** @@ -148,9 +150,15 @@ private String initPdbFilePath() { } else { path = System.getProperty(TMP_DIR); - logger.warn("Could not read dir from system property {} or environment variable {}, " - + "using system's temp directory {}", - propertyName, propertyName, path); + + if ( ! warningShown.get()) { + + logger.warn("Could not read dir from system property {} or environment variable {}, " + + "using system's temp directory {}", + propertyName, propertyName, path); + + warningShown.set(true); + } System.setProperty(propertyName,path); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java index 6c888af2a1..3525418076 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java @@ -1833,7 +1833,7 @@ private void pdb_ATOM_Handler(String line) { // parse element from element field String elementSymbol = line.substring(76, 78).trim(); if (elementSymbol.isEmpty()) { - logger.warn("Element column was empty for atom {} {}. Assigning atom element " + logger.info("Element column was empty for atom {} {}. Assigning atom element " + "from Chemical Component Dictionary information", fullname.trim(), pdbnumber); } else { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/TestEntityHeuristics.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/TestEntityHeuristics.java index 484851c109..f652db1363 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/TestEntityHeuristics.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/TestEntityHeuristics.java @@ -240,15 +240,6 @@ private Structure getStructure(String fileName, boolean setAlignSeqRes) throws I Structure s = pdbpars.parsePDBFile(inStream) ; - System.out.println("Entities for file: "+fileName); - for (EntityInfo ent:s.getEntityInfos()) { - System.out.print(ent.getRepresentative().getName()+":"); - for (Chain c:ent.getChains()) { - System.out.print(" "+c.getName()); - } - System.out.println(); - } - return s; } diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/TestStructureCrossReferences.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/TestStructureCrossReferences.java index ceedfd4d34..d2c5b2d0b8 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/TestStructureCrossReferences.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/TestStructureCrossReferences.java @@ -60,7 +60,7 @@ public void testCrossReferencesMmCif() throws IOException, StructureException { Structure structure = StructureIO.getStructure(PDBCODE1); - System.out.println("Testing references in mmCIF loading with NO alignSeqRes"); + //System.out.println("Testing references in mmCIF loading with NO alignSeqRes"); doFullTest(structure, emptySeqRes); structure = StructureIO.getStructure(PDBCODE2); // an NMR entry with 2 chains @@ -83,7 +83,7 @@ public void testCrossReferencesMmCifAlignSeqRes() throws IOException, StructureE Structure structure = StructureIO.getStructure(PDBCODE1); - System.out.println("Testing references in mmCIF loading with alignSeqRes"); + //System.out.println("Testing references in mmCIF loading with alignSeqRes"); doFullTest(structure, emptySeqRes); structure = StructureIO.getStructure(PDBCODE2); // an NMR entry with 2 chains @@ -127,7 +127,7 @@ public void testCrossReferencesPdbAlignSeqRes() throws IOException, StructureExc StructureIO.setAtomCache(cache); - System.out.println("Testing references in PDB loading with alignSeqRes"); + //System.out.println("Testing references in PDB loading with alignSeqRes"); Structure structure = StructureIO.getStructure(PDBCODE1); doFullTest(structure, emptySeqRes); @@ -145,7 +145,7 @@ public void testCrossReferencesRawFile() throws IOException, StructureException private void doFullTest(Structure structure, boolean emptySeqRes) throws StructureException { - System.out.println("Testing references in original structure"); + //System.out.println("Testing references in original structure"); testStructureRefs(structure, emptySeqRes); logger.debug("Original structure mem hashCode: {}",System.identityHashCode(structure)); @@ -156,26 +156,26 @@ private void doFullTest(Structure structure, boolean emptySeqRes) throws Structu assertNotSame(structure, structureCopy); - System.out.println("Testing references in cloned structure"); + //System.out.println("Testing references in cloned structure"); testStructureRefs(structureCopy, emptySeqRes); logger.debug("Original structure mem hashCode after cloning: {}",System.identityHashCode(structure)); - System.out.println("Testing references in original structure after having cloned it"); + //System.out.println("Testing references in original structure after having cloned it"); // we test again the original after cloning it, perhaps some references were mixed while cloning // there is a bug in ChainImpl.clone() that mixes them up! testStructureRefs(structure, emptySeqRes); - System.out.println("Testing references of chain clones"); + //System.out.println("Testing references of chain clones"); for (Chain c:structure.getChains()) { Chain clonedChain = (Chain) c.clone(); testChainRefs(clonedChain, emptySeqRes); } - System.out.println("Testing references in atom arrays"); + //System.out.println("Testing references in atom arrays"); for (Chain c:structure.getChains()) { Atom[] atomArray = StructureTools.getAllAtomArray(c); testAtomArrayRefs(atomArray, c); @@ -190,7 +190,7 @@ private void doFullTest(Structure structure, boolean emptySeqRes) throws Structu testInterfaceRefs(structure, interf); } - System.out.println("Testing references in original structure after getUniqueInterfaces"); + //System.out.println("Testing references in original structure after getUniqueInterfaces"); testStructureRefs(structure, emptySeqRes); } diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/align/multiple/util/TestMultipleAlignmentWriter.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/align/multiple/util/TestMultipleAlignmentWriter.java index bc00dfb91a..27e8db5732 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/align/multiple/util/TestMultipleAlignmentWriter.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/align/multiple/util/TestMultipleAlignmentWriter.java @@ -220,7 +220,7 @@ public void testTransformMatrices2() throws IOException{ String result = MultipleAlignmentWriter. toTransformMatrices(alignment2); - System.out.println(result); + FileReader file = new FileReader( "src/test/resources/testMSTA2.transforms"); diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/contact/TestContactCalc.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/contact/TestContactCalc.java index 072ab6a1be..7d8cf1bfad 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/contact/TestContactCalc.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/contact/TestContactCalc.java @@ -20,14 +20,17 @@ */ package org.biojava.nbio.structure.contact; + import org.biojava.nbio.structure.*; import org.biojava.nbio.structure.align.util.AtomCache; import org.biojava.nbio.structure.io.FileParsingParameters; import org.junit.BeforeClass; import org.junit.Test; +import org.slf4j.LoggerFactory; import java.io.IOException; + import static org.junit.Assert.*; @@ -35,6 +38,8 @@ public class TestContactCalc { + private static final org.slf4j.Logger logger = LoggerFactory.getLogger(TestContactCalc.class); + private static final String[] INTRACHAIN_TESTSET = { "1d2sA", @@ -70,7 +75,7 @@ public void testIntraChainContacts() throws StructureException, IOException { int idx = 0; for (String pdbId:INTRACHAIN_TESTSET) { - System.out.print(pdbId+"\t"); + logger.info(pdbId+"\t"); String pdbCode = pdbId.substring(0,4); String pdbChainCode = pdbId.substring(4,5); @@ -81,7 +86,7 @@ public void testIntraChainContacts() throws StructureException, IOException { if ( chain!=null) { for (int i = 0; i < cts.length; i++) { - System.out.print((cts[i] == null ? "ALL" : cts[i][0]) + "\t" + cutoffs[i] + "\t"); + logger.info((cts[i] == null ? "ALL" : cts[i][0]) + "\t" + cutoffs[i] + "\t"); AtomContactSet atomContacts = null; if (cts[i] != null && cts[i][0].equals("CA")) { @@ -114,7 +119,7 @@ public void testIntraChainContacts() throws StructureException, IOException { contacts.size() > cbCMsizes[idx]); } } - System.out.println(); + logger.info(""); idx++; } @@ -130,7 +135,7 @@ public void testInterChainContacts3HBX() throws StructureException, IOException AtomContactSet atomContacts2 = StructureTools.getAtomsInContact(structure.getPolyChainByPDB("E"), structure.getPolyChainByPDB("F"), 5.5, false); AtomContactSet atomContacts3 = StructureTools.getAtomsInContact(structure.getPolyChainByPDB("C"), structure.getPolyChainByPDB("D"), 5.5, false); - System.out.println("AU interfaces of 3hbx, number of atom contacts: "+atomContacts1.size()+", "+atomContacts2.size()+", "+atomContacts3.size()); + logger.info("AU interfaces of 3hbx, number of atom contacts: "+atomContacts1.size()+", "+atomContacts2.size()+", "+atomContacts3.size()); assertTrue(Math.abs(atomContacts1.size()-atomContacts2.size())<40); assertTrue(Math.abs(atomContacts1.size()-atomContacts3.size())<40); @@ -140,7 +145,7 @@ public void testInterChainContacts3HBX() throws StructureException, IOException GroupContactSet contacts2 = new GroupContactSet(atomContacts2); GroupContactSet contacts3 = new GroupContactSet(atomContacts3); - System.out.println("AU interfaces of 3hbx, number of residue contacts: "+contacts1.size()+", "+contacts2.size()+", "+contacts3.size()); + logger.info("AU interfaces of 3hbx, number of residue contacts: "+contacts1.size()+", "+contacts2.size()+", "+contacts3.size()); assertTrue(Math.abs(contacts1.size()-contacts2.size())<10); assertTrue(Math.abs(contacts1.size()-contacts3.size())<10); @@ -165,7 +170,7 @@ public void testIntraChainContactsVsDistMatrix1SMT() throws IOException, Structu Chain chain = structure.getPolyChainByPDB("A"); - System.out.println("Intra-chain contacts calculation vs distance matrix for 1smtA"); + logger.info("Intra-chain contacts calculation vs distance matrix for 1smtA"); checkContactsVsDistMatrix(chain, cutoff); } @@ -179,7 +184,7 @@ public void testIntraChainContactsVsDistMatrix2TRX() throws IOException, Structu Chain chain = structure.getPolyChainByPDB("A"); - System.out.println("Intra-chain contacts calculation vs distance matrix for 2trxA"); + logger.info("Intra-chain contacts calculation vs distance matrix for 2trxA"); checkContactsVsDistMatrix(chain, cutoff); } @@ -193,7 +198,7 @@ public void testIntraChainContactsVsDistMatrix1SU4() throws IOException, Structu Chain chain = structure.getPolyChainByPDB("A"); - System.out.println("Intra-chain contacts calculation vs distance matrix for 1su4A"); + logger.info("Intra-chain contacts calculation vs distance matrix for 1su4A"); checkContactsVsDistMatrix(chain, cutoff); } @@ -210,7 +215,7 @@ private void checkContactsVsDistMatrix(Chain chain, double cutoff) { end = System.currentTimeMillis(); System.out.printf("Calculated distance matrix in %.3f s\n",((end-start)/1000.0)); - System.out.println("(number of atoms: "+atoms.length+")"); + logger.info("(number of atoms: "+atoms.length+")"); for (int i=0;iorg/biojava/nbio/structure/align/ce/CECalculator.class - org.biojava.nbio.structure.io.mmcif.MMCIFFileTools + org.biojava.nbio.structure.io.mmcif.MMCIFFileTools* demo.* From 106493d87ecfcad6ff665b430b978f142b8e2644 Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Thu, 18 Aug 2016 16:50:38 -0700 Subject: [PATCH 19/20] disabling cobertura again, until we can successfully exclude MMCifFileTools --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5991ecfb6d..ee7833ffd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: java jdk: - oraclejdk8 sudo: false -after_success: - - mvn clean cobertura:cobertura coveralls:report +#after_success: +# - mvn clean cobertura:cobertura coveralls:report From 4a1dbeb1a328955a9cf5fdc2bb1f8292c794701e Mon Sep 17 00:00:00 2001 From: Andreas Prlic Date: Fri, 19 Aug 2016 08:32:26 -0700 Subject: [PATCH 20/20] Addressing @josemduarte 's comment to change log level for method. --- .../src/main/java/org/biojava/nbio/structure/Model.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java index ebcb900433..627ed5805d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Model.java @@ -71,7 +71,7 @@ public void addChain(Chain c) { EntityInfo info = c.getEntityInfo(); if ( info == null || info.getType() == null) { - logger.debug("No entity info could be found while adding chain with asym id {} (author id {}). Will consider it a polymer chain.", c.getId(), c.getName()); + logger.info("No entity info could be found while adding chain with asym id {} (author id {}). Will consider it a polymer chain.", c.getId(), c.getName()); polyChains.add(c); } else if ( info.getType() == EntityType.POLYMER) {