Skip to content

Commit

Permalink
Update biojava dependencies to version 4.2.2, fixes #142
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh committed Jun 15, 2016
1 parent f03a07f commit c6f7284
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 56 deletions.
7 changes: 0 additions & 7 deletions README_release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
wget http://www.antlr.org/download/antlr-4.5.1-complete.jar
mvn install:install-file -Dfile=antlr-4.5.1-complete.jar -DgroupId=org.antlr -DartifactId=antlr -Dversion=4.5.1 -Dpackaging=jar

# BioJava
wget http://biojava.org/download/maven/org/biojava/biojava3-core/3.0.7/biojava3-core-3.0.7.jar
mvn install:install-file -Dfile=biojava3-core-3.0.7.jar -DgroupId=org.biojava -DartifactId=biojava3-core -Dversion=3.0.7 -Dpackaging=jar

wget http://biojava.org/download/maven/org/biojava/biojava3-structure/3.0.7/biojava3-structure-3.0.7.jar
mvn install:install-file -Dfile=biojava3-structure-3.0.7.jar -DgroupId=org.biojava -DartifactId=biojava3-structure -Dversion=3.0.7 -Dpackaging=jar

1) Change version numbers:
- Update SnpEff pom.xml
- Update SnpSift pom.xml
Expand Down
20 changes: 14 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,22 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.biojava</groupId>
<artifactId>biojava3-core</artifactId>
<version>3.0.7</version>
<groupId>org.biojava</groupId>
<artifactId>biojava-core</artifactId>
<version>4.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.biojava</groupId>
<artifactId>biojava3-structure</artifactId>
<version>3.0.7</version>
<groupId>org.biojava</groupId>
<artifactId>biojava-structure</artifactId>
<version>4.2.2</version>
<exclusions>
<exclusion>
<groupId>org.biojava.thirdparty</groupId>
<artifactId>forester</artifactId>
</exclusion>
</exclusions>
<scope>compile</scope>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/snpeff/pdb/DistanceResult.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.snpeff.pdb;

import org.biojava.bio.structure.AminoAcid;
import org.biojava.nbio.structure.AminoAcid;
import org.snpeff.interval.Chromosome;
import org.snpeff.interval.Transcript;
import org.snpeff.util.Gpr;
Expand Down Expand Up @@ -184,14 +184,14 @@ public boolean hasValidCoords() {
}

public void setAa1(AminoAcid aa) {
setPdbId(aa.getChain().getParent().getPDBCode());
setPdbId(aa.getChain().getStructure().getPDBCode());
pdbChainId1 = aa.getChainId();
aaPos1 = aa.getResidueNumber().getSeqNum() - 1;
aa1 = aa.getChemComp().getOne_letter_code().charAt(0);
}

public void setAa2(AminoAcid aa) {
setPdbId(aa.getChain().getParent().getPDBCode());
setPdbId(aa.getChain().getStructure().getPDBCode());
pdbChainId2 = aa.getChainId();
aaPos2 = aa.getResidueNumber().getSeqNum() - 1;
aa2 = aa.getChemComp().getOne_letter_code().charAt(0);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/snpeff/pdb/PdbFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import java.io.IOException;
import java.io.InputStream;

import org.biojava.bio.structure.Structure;
import org.biojava.bio.structure.io.FileParsingParameters;
import org.biojava.bio.structure.io.PDBFileParser;
import org.biojava3.core.util.InputStreamProvider;
import org.biojava.nbio.core.util.InputStreamProvider;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.io.FileParsingParameters;
import org.biojava.nbio.structure.io.PDBFileParser;

/**
* A structure that reads PDB files
Expand Down
70 changes: 34 additions & 36 deletions src/main/java/org/snpeff/snpEffect/commandLine/SnpEffCmdPdb.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
import java.util.Set;
import java.util.zip.GZIPOutputStream;

import org.biojava.bio.structure.AminoAcid;
import org.biojava.bio.structure.Atom;
import org.biojava.bio.structure.Calc;
import org.biojava.bio.structure.Chain;
import org.biojava.bio.structure.Compound;
import org.biojava.bio.structure.DBRef;
import org.biojava.bio.structure.Group;
import org.biojava.bio.structure.Structure;
import org.biojava.bio.structure.StructureException;
import org.biojava.bio.structure.io.PDBFileReader;
import org.biojava.nbio.structure.AminoAcid;
import org.biojava.nbio.structure.Atom;
import org.biojava.nbio.structure.Calc;
import org.biojava.nbio.structure.Chain;
import org.biojava.nbio.structure.Compound;
import org.biojava.nbio.structure.DBRef;
import org.biojava.nbio.structure.Group;
import org.biojava.nbio.structure.GroupType;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.io.PDBFileReader;
import org.snpeff.SnpEff;
import org.snpeff.interval.Gene;
import org.snpeff.interval.Transcript;
Expand Down Expand Up @@ -171,7 +172,7 @@ List<IdMapperEntry> checkSequencePdbGenome(Structure pdbStruct, Chain chain, Str
if (debug) Gpr.debug("\tMapping OK :\t" + trId + "\terror: " + err);

int trAaLen = tr.protein().length();
int pdbAaLen = chain.getAtomGroups("amino").size();
int pdbAaLen = chain.getAtomGroups(GroupType.AMINOACID).size();

for (IdMapperEntry idm : idmapsOri) {
if (trId.equals(idm.trId) && pdbId.equals(idm.pdbId)) {
Expand Down Expand Up @@ -261,12 +262,8 @@ void deleteOuptut(String outputPdbFile) {

for (Atom atom1 : aa1.getAtoms())
for (Atom atom2 : aa2.getAtoms()) {
try {
double dist = Calc.getDistance(atom1, atom2);
distMin = Math.min(distMin, dist);
} catch (StructureException e) {
throw new RuntimeException(e);
}
double dist = Calc.getDistance(atom1, atom2);
distMin = Math.min(distMin, dist);
}

return distMin;
Expand Down Expand Up @@ -307,25 +304,15 @@ boolean filterPdb(Structure pdbStruct) {
* I.e.: Organism matches
*/
boolean filterPdbChain(Chain chain) {
if (chain.getHeader() == null) return false;

// Try 'ORGANISM_SCINETIFIC'
String orgs = chain.getHeader().getOrganismScientific();
if (orgs != null && orgs.indexOf(pdbOrganismScientific) >= 0) return true;

// Try 'ORGANISM_COMMON'
orgs = chain.getHeader().getOrganismCommon();
if (orgs == null) return false;

// Multiple organisms?
if (orgs.indexOf(' ') > 0) {
for (String org : orgs.split("\\s"))
if (org.equals(pdbOrganismCommon)) return true;

}

return orgs.equals(pdbOrganismCommon);
}
// note: Compound is replaced by EntityInfo in biojava 5.x
for (Compound compound : chain.getStructure().getCompounds()) {
if (contains(compound.getOrganismCommon(), pdbOrganismCommon) ||
contains(compound.getOrganismScientific(), pdbOrganismScientific)) {
return true;
}
}
return false;
}

/**
* Return true if the transcript passes the criteria
Expand Down Expand Up @@ -876,4 +863,15 @@ public void usage(String message) {
System.exit(-1);
}


/**
* Return true if <code>s1</code> is not null and contains <code>s2</code>.
*
* @param s1 string
* @param s2 string
* @return true if <code>s1</code> is not null and contains <code>s2</code>
*/
private static boolean contains(String s1, String s2) {
return s1 != null && s1.indexOf(s2) >= 0;
}
}

0 comments on commit c6f7284

Please sign in to comment.