diff --git a/.travis.yml b/.travis.yml index 0d159dd400..ee7833ffd2 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/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/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-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/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..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 @@ -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 */ @@ -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); diff --git a/biojava-core/src/test/resources/log4j2.xml b/biojava-core/src/test/resources/log4j2.xml index f6af298543..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 a2e50d144b..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-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..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-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..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-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 05b93e0aca..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 @@ -31,6 +31,7 @@ public final class FastqTest extends TestCase { + public void testConstructor() { Fastq fastq = new Fastq("description", "sequence", "quality_", FastqVariant.FASTQ_SANGER); 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/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); } 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..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.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.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) { 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..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 @@ -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); } @@ -1686,135 +1681,39 @@ 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) { - return getPredominantGroupType(c) == GroupType.AMINOACID; + + return c.isProtein(); } /** - * 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 getPredominantGroupType(c) == GroupType.NUCLEOTIDE; + 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) { - 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(); } /** - * 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) { - for (Group g : c.getAtomGroups()) { - if (!g.isWater()) - return false; - } - return true; + 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) { - for (Group g : c.getAtomGroups()) { - - ChemComp cc = g.getChemComp(); - - ResidueType resType = cc.getResidueType(); - PolymerType polType = cc.getPolymerType(); - - 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; - } - - } - return true; + return c.isPureNonPolymer(); } /** 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 f680e29b80..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 { @@ -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(){ } -} +} 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..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 @@ -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 && @@ -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); @@ -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); @@ -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; } @@ -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()); 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;i 0.009s (only header) 95% faster. diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestParseMmCIFLigands.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestParseMmCIFLigands.java index 9e0c3a7523..c97aed8d88 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestParseMmCIFLigands.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestParseMmCIFLigands.java @@ -74,7 +74,7 @@ private int countBondedAtomsInLigandGroups(Structure s){ for (Chain c:s.getChains()) { for (Group g:c.getAtomGroups()) { if (!g.isWater() && !PolymerType.ALL_POLYMER_TYPES.contains(g.getChemComp().getPolymerType())) { - System.out.println(g); + for (Atom a:g.getAtoms()) { if (a.getBonds()!=null) count++; } diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestURLBasedFileParsing.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestURLBasedFileParsing.java index e71af5c629..0d07e77c6e 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestURLBasedFileParsing.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestURLBasedFileParsing.java @@ -39,11 +39,8 @@ public void testMMcifURL() throws StructureException, IOException{ String u = "http://ftp.wwpdb.org/pub/pdb/data/biounit/mmCIF/divided/nw/4nwr-assembly1.cif.gz"; - Structure s = StructureIO.getStructure(u); - System.out.println(s); - assertNotNull(s); 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); } 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 @@ - + diff --git a/pom.xml b/pom.xml index ef26a6473f..fb20e6323e 100644 --- a/pom.xml +++ b/pom.xml @@ -399,6 +399,48 @@ 3.9.2 + + + 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 + + + org.biojava.nbio.structure.io.mmcif.MMCIFFileTools* + demo.* + + + + + + + clean + + + + + @@ -409,6 +451,8 @@ + + @@ -553,6 +597,8 @@ + + @@ -609,8 +655,8 @@ Github https://github.com/biojava/biojava/issues - - CruiseControl - http://ccpublic.rcsb.org/ - + + Travis + https://travis-ci.org/biojava/biojava +