From 15808673c2e58c816e7a6795cf914edebab36dec Mon Sep 17 00:00:00 2001 From: Jose Manuel Duarte Date: Wed, 10 Mar 2021 17:10:20 -0800 Subject: [PATCH 001/533] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2403e0f6ca..ae187a040b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ BioJava 6.0.0 (future release) * Moved `org.biojava.nbio.structure.io.mmcif.model.DatabasePdbrevRecord` to `org.biojava.nbio.structure.DatabasePDBRevRecord.java` * Moved all chem-comp model classes from `org.biojava.nbio.structure.io.mmcif.chem` to `org.biojava.nbio.structure.chem` * Moved all chem-comp parsing classes from `org.biojava.nbio.structure.io.mmcif.chem` to `org.biojava.nbio.structure.io.cif` +* Moved classes in `org.biojava.nbio.structure.io.mmcif` to `org.biojava.nbio.structure.chem` BioJava 5.4.0 ============= From 6e3627f13fcc9f85f1af82850937bcb133c53122 Mon Sep 17 00:00:00 2001 From: Maximilian Greil Date: Fri, 12 Mar 2021 20:14:10 +0100 Subject: [PATCH 002/533] Fix issue 864 --- .../align/pairwise/AltAligComparator.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java index 1ac6c90e78..85bc21f913 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java @@ -48,20 +48,15 @@ public int compare(AlternativeAlignment a, AlternativeAlignment b) { if ( s1 > s2) return 1; - if ( s1 < s2) + else if ( s1 < s2) return -1; + else { + // seem to have the same length + double rms1 = a.getRmsd(); + double rms2 = b.getRmsd(); + return Double.compare(rms1, rms2); + } - // seem to have the same length - - double rms1 = a.getRmsd(); - double rms2 = b.getRmsd(); - - if ( rms1 < rms2) - return 1; - if ( rms1 < rms2) - return -1; - - return 0; } From 527aca325915b932bb5a8d5d41cf33448a9b6f9b Mon Sep 17 00:00:00 2001 From: Jose Duarte Date: Fri, 12 Mar 2021 16:29:28 -0800 Subject: [PATCH 003/533] Cleanups and logging fixes --- .../nbio/structure/align/AFPTwister.java | 8 ++--- .../align/AbstractStructureAlignment.java | 2 -- .../align/BioJavaStructureAlignment.java | 15 +++------- .../align/CallableStructureAlignment.java | 20 ++++++------- .../nbio/structure/align/ClusterAltAligs.java | 30 +++++++++---------- .../structure/align/StrucAligParameters.java | 6 ++-- .../align/StructureAlignmentFactory.java | 2 +- .../structure/align/StructurePairAligner.java | 30 +++++++++---------- .../align/pairwise/AltAligComparator.java | 11 ++----- 9 files changed, 54 insertions(+), 70 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java index 57ff697730..3718259c56 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java @@ -40,8 +40,6 @@ import javax.vecmath.Matrix4d; -//import org.biojava.nbio.structure.align.gui.jmol.StructureAlignmentJmol; - public class AFPTwister { private final static Logger logger = LoggerFactory .getLogger(AFPTwister.class); @@ -90,7 +88,7 @@ public static Group[] twistPDB(AFPChain afpChain, Atom[] ca1, Atom[] ca2) e2 = 0; b2 = 0; - logger.debug("blockNUm at twister: ", blockNum); + logger.debug("blockNUm at twister: {}", blockNum); for (int bk = 0; bk < blockNum; bk++) { @@ -309,7 +307,7 @@ private static Atom[] getAtoms(Atom[] ca, int[] positions, int length, } atoms.add(a); } - return atoms.toArray(new Atom[atoms.size()]); + return atoms.toArray(new Atom[0]); } /** @@ -329,7 +327,7 @@ private static void cloneAtomRange(Atom[] p1, Atom[] p2, int r1, int r2) // special clone method, can;t use StructureTools.cloneCAArray, since we // access the data // slightly differently here. - List model = new ArrayList(); + List model = new ArrayList<>(); for (int i = r1; i < r2; i++) { Group g = p2[i].getGroup(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AbstractStructureAlignment.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AbstractStructureAlignment.java index 295ea6903a..86944165a3 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AbstractStructureAlignment.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AbstractStructureAlignment.java @@ -28,8 +28,6 @@ public abstract class AbstractStructureAlignment implements StructureAlignment{ - public static String newline = System.getProperty("line.separator"); - @Override abstract public AFPChain align(Atom[] ca1, Atom[] ca2) throws StructureException; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/BioJavaStructureAlignment.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/BioJavaStructureAlignment.java index 6b5b279f20..d0be76dfd8 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/BioJavaStructureAlignment.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/BioJavaStructureAlignment.java @@ -36,18 +36,16 @@ import org.biojava.nbio.structure.jama.Matrix; -/** Wrapper for the BioJava Structure Alignment Implementation +/** + * Wrapper for the BioJava Structure Alignment Implementation * * @author Andreas Prlic - * */ -public class BioJavaStructureAlignment - -implements StructureAlignment { +public class BioJavaStructureAlignment implements StructureAlignment { public static final String algorithmName = "BioJava_structure"; private static final float versionNr = 0.1f; - StrucAligParameters params; + private StrucAligParameters params; public BioJavaStructureAlignment(){ params = new StrucAligParameters(); @@ -81,8 +79,6 @@ public String printHelp() { return "not implemented yet. Algorithm still under development."; } - - @Override public AFPChain align(Atom[] ca1, Atom[] ca2) throws StructureException { StrucAligParameters params = StrucAligParameters.getDefaultParameters(); @@ -90,7 +86,6 @@ public AFPChain align(Atom[] ca1, Atom[] ca2) throws StructureException { } - @Override public AFPChain align(Atom[] ca1, Atom[] ca2, Object params) throws StructureException { @@ -118,8 +113,6 @@ public AFPChain align(Atom[] ca1, Atom[] ca2, Object params) } - - private void copyResults(AFPChain afpChain, AlternativeAlignment altAlig, Atom[] ca1, Atom[] ca2) { afpChain.setAlgorithmName(getAlgorithmName()); afpChain.setVersion(getVersion()); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java index 80087f8e3c..f22e2a31f5 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java @@ -20,16 +20,7 @@ */ package org.biojava.nbio.structure.align; -/** - * Simple Callable Class that calculates a pairwise alignment in a different - * thread, so that multiple pairwise alignments can be run in parallel - * (examples: all-to-all alignments, DB search alignments). - * Adapted to a more general implementation since 4.1.0, because before it - * was thought for DB search only. - * - * @author Aleix Lafita - * - */ + import org.biojava.nbio.structure.Atom; import org.biojava.nbio.structure.Structure; import org.biojava.nbio.structure.StructureTools; @@ -48,6 +39,15 @@ import java.util.concurrent.Callable; import java.util.zip.GZIPOutputStream; +/** + * Simple Callable Class that calculates a pairwise alignment in a different + * thread, so that multiple pairwise alignments can be run in parallel + * (examples: all-to-all alignments, DB search alignments). + * Adapted to a more general implementation since 4.1.0, because before it + * was thought for DB search only. + * + * @author Aleix Lafita + */ public class CallableStructureAlignment implements Callable { private final static Logger logger = LoggerFactory.getLogger( diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java index 3a6150da3b..373bcf1611 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java @@ -27,7 +27,8 @@ import java.util.Iterator; import java.util.List; -/** A class that clusters alternative alignments according to their +/** + * A class that clusters alternative alignments according to their * similarity. * * @author Andreas Prlic @@ -43,15 +44,14 @@ public static void cluster(AlternativeAlignment[] aligs ){ cluster(aligs, DEFAULT_CLUSTER_CUTOFF); } - @SuppressWarnings({ "rawtypes", "unchecked" }) public static void cluster(AlternativeAlignment[] aligs, int cutoff){ - List alist = Arrays.asList(aligs); - List testAligs = new ArrayList(alist); + List alist = Arrays.asList(aligs); + List testAligs = new ArrayList<>(alist); - List clusters = new ArrayList(); - List excludeList = new ArrayList(); + List> clusters = new ArrayList<>(); + List excludeList = new ArrayList<>(); // check how similar the eqrs are... for ( int i=0 ; i< aligs.length;i++){ @@ -61,11 +61,11 @@ public static void cluster(AlternativeAlignment[] aligs, int cutoff){ } int[] idxA = a.getIdx1(); - Iterator iter = testAligs.iterator(); - List remainList = new ArrayList(); - List currentCluster = new ArrayList(); + Iterator iter = testAligs.iterator(); + List remainList = new ArrayList<>(); + List currentCluster = new ArrayList<>(); - currentCluster.add( new Integer(i)); + currentCluster.add(i); excludeList.add(a); int j=-1; @@ -94,7 +94,7 @@ public static void cluster(AlternativeAlignment[] aligs, int cutoff){ // " l1:"+ idxA.length + " l2:" + idxB.length + " perpos:" + perpos); if ( perpos > cutoff){ - currentCluster.add(new Integer(j)); + currentCluster.add(j); excludeList.add(b); } else { remainList.add(b); @@ -109,17 +109,17 @@ public static void cluster(AlternativeAlignment[] aligs, int cutoff){ // now print the clusters... - Iterator iter = clusters.iterator(); + Iterator> iter = clusters.iterator(); int cpos = 0; while (iter.hasNext()){ cpos++; //System.out.println("cluster "+cpos+":"); - List cluster = (List) iter.next(); - Iterator iter2 = cluster.iterator(); + List cluster = iter.next(); + Iterator iter2 = cluster.iterator(); while (iter2.hasNext()){ Integer i = (Integer) iter2.next(); - AlternativeAlignment alig = aligs[i.intValue()]; + AlternativeAlignment alig = aligs[i]; alig.setCluster(cpos); //System.out.println( " ("+ aligs[i.intValue()]+")"); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java index 8851d863e1..c871e46a0f 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java @@ -24,7 +24,8 @@ import org.biojava.nbio.structure.StructureTools; -/** A class that contains all the parameters of the structure alignment algorithm. +/** + * A class that contains all the parameters of the structure alignment algorithm. * * @author Andreas Prlic * @since 1.5 @@ -304,7 +305,8 @@ public void setCreate_co(float create_co) { this.create_co = create_co; } - /** if this is set to false, the time spent to joint the initial fragments (step 2) + /** + * if this is set to false, the time spent to joint the initial fragments (step 2) * is increased. - particular for large structures this increases calc. time a lot. * advantage: more combinations of fragments are used. * diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java index a31012cf25..8b1c2629ef 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java @@ -38,7 +38,7 @@ public class StructureAlignmentFactory { private final static Logger logger = LoggerFactory.getLogger(StructureAlignmentFactory.class); - private static List algorithms = new ArrayList(); + private static List algorithms = new ArrayList<>(); static { algorithms.add( new CeMain() ); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java index fabe4c9bc6..d47dc52502 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java @@ -138,12 +138,12 @@ public class StructurePairAligner { private final static Logger logger = LoggerFactory .getLogger(StructurePairAligner.class); - AlternativeAlignment[] alts; - Matrix distanceMatrix; - StrucAligParameters params; - FragmentPair[] fragPairs; + private AlternativeAlignment[] alts; + private Matrix distanceMatrix; + private StrucAligParameters params; + private FragmentPair[] fragPairs; - List listeners = new ArrayList(); + private final List listeners = new ArrayList<>(); public StructurePairAligner() { super(); @@ -202,7 +202,7 @@ public static void main(String[] args) throws Exception { // the AlternativeAlignment object gives also access to rotation // matrices / shift vectors. for (AlternativeAlignment aa : aligs) { - logger.info("Alternative Alignment: ", aa); + logger.info("Alternative Alignment: {}", aa); } // convert AlternativeAlignemnt 1 to PDB file, so it can be opened with @@ -386,11 +386,9 @@ public Atom[] getAlignmentAtoms(Structure s) { } /** - * calculate the protein structure superimposition, between two sets of + * Calculate the protein structure superimposition, between two sets of * atoms. * - * - * * @param ca1 * set of Atoms of structure 1 * @param ca2 @@ -444,7 +442,7 @@ public void align(Atom[] ca1, Atom[] ca2, StrucAligParameters params) Atom unitvector = new AtomImpl(); unitvector.setCoords(utmp[0]); - List fragments = new ArrayList(); + List fragments = new ArrayList<>(); for (int i = 0; i < rows; i++) { @@ -499,8 +497,7 @@ public void align(Atom[] ca1, Atom[] ca2, StrucAligParameters params) notifyFragmentListeners(fragments); - FragmentPair[] fp = fragments - .toArray(new FragmentPair[fragments.size()]); + FragmentPair[] fp = fragments.toArray(new FragmentPair[0]); setFragmentPairs(fp); logger.debug(" got # fragment pairs: {}", fp.length); @@ -532,11 +529,11 @@ public void align(Atom[] ca1, Atom[] ca2, StrucAligParameters params) notifyJointFragments(frags); - logger.debug(" number joint fragments: ", frags.length); + logger.debug(" number joint fragments: {}", frags.length); logger.debug("step 3 - refine alignments"); - List aas = new ArrayList(); + List aas = new ArrayList<>(); for (int i = 0; i < frags.length; i++) { JointFragments f = frags[i]; AlternativeAlignment a = new AlternativeAlignment(); @@ -556,16 +553,17 @@ public void align(Atom[] ca1, Atom[] ca2, StrucAligParameters params) } catch (StructureException e) { logger.error("Refinement of fragment {} failed", i, e); } + a.calcScores(ca1, ca2); aas.add(a); } // sort the alternative alignments Comparator comp = new AltAligComparator(); - Collections.sort(aas, comp); + aas.sort(comp); Collections.reverse(aas); - alts = aas.toArray(new AlternativeAlignment[aas.size()]); + alts = aas.toArray(new AlternativeAlignment[0]); // do final numbering of alternative solutions int aanbr = 0; for (AlternativeAlignment a : alts) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java index 1ac6c90e78..4034675f6f 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AltAligComparator.java @@ -26,19 +26,14 @@ import java.util.Comparator; -/** a comparator to sort AlternativeAlignments based on their number of equivalent residues +/** + * A comparator to sort AlternativeAlignments based on their number of equivalent residues * and RMSD. * * @author Andreas Prlic * */ -public class AltAligComparator implements Comparator, Serializable { - private static final long serialVersionUID = 1; - - public AltAligComparator() { - super(); - - } +public class AltAligComparator implements Comparator { @Override public int compare(AlternativeAlignment a, AlternativeAlignment b) { From dfd154267cb73ed2278fd99fba2aa573af9f2806 Mon Sep 17 00:00:00 2001 From: Jose Duarte Date: Sat, 13 Mar 2021 00:15:38 -0800 Subject: [PATCH 004/533] Trying sonarcloud in CI --- .travis.yml | 6 ++++++ sonar-project.properties | 1 + 2 files changed, 7 insertions(+) create mode 100644 sonar-project.properties diff --git a/.travis.yml b/.travis.yml index 5c668648ce..e188292892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,9 @@ env: global: - secure: MkIoyU3GmlgDRhO0n1lDKvZ/k0myVY3IsFTRNUFjaBBpohLyOBrs5L8gYmfnHYHB/LvJsP6EWA6i0wCchy8hU/2pn66T12K1+WZHyqCe7RRz2kgcvVgMXTsHgvVyZ3dERcBfEDeZENzEYCYADaysT+A73ofWdJemOqfa7IFEb80= - secure: it5av1icAvJn/6UI0aWS23m+En0ij1hCiPKw1QIbDLCE3oJOE4nHR8qINcnontH4XUQYTkmekStDkXj0WVVgp08zArj9o018XBtadYY+15h2QZBBAIpYb3UdlJoQfkcAx8yCv59BMd/u6DhMtcKSTHptVWvsLAS7YGW5hR6ZNYA= +addons: + sonarcloud: + organization: "biojava_biojava" +script: + # the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis + - mvn clean verify sonar:sonar -Dsonar.projectKey=biojava_biojava diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..0e7a0b311b --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.projectKey=biojava_biojava From 15ce47d9a8618e9af8e7de7b15f0f31b7cc394f2 Mon Sep 17 00:00:00 2001 From: Jose Manuel Duarte Date: Sat, 13 Mar 2021 21:11:18 -0800 Subject: [PATCH 005/533] Fixing organization name --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e188292892..913f287017 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: - secure: it5av1icAvJn/6UI0aWS23m+En0ij1hCiPKw1QIbDLCE3oJOE4nHR8qINcnontH4XUQYTkmekStDkXj0WVVgp08zArj9o018XBtadYY+15h2QZBBAIpYb3UdlJoQfkcAx8yCv59BMd/u6DhMtcKSTHptVWvsLAS7YGW5hR6ZNYA= addons: sonarcloud: - organization: "biojava_biojava" + organization: "biojava" script: # the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis - mvn clean verify sonar:sonar -Dsonar.projectKey=biojava_biojava From 4d1cf58837ca3d661582c3b6343ee47563d6ed04 Mon Sep 17 00:00:00 2001 From: Maximilian Greil Date: Fri, 26 Mar 2021 23:58:30 +0100 Subject: [PATCH 006/533] Github issue 843 - Genebank parser (#919) * Github issue 843 * Changes * Add transl_except to parser * Test * Test changes --- .../sequence/io/GenbankSequenceParser.java | 3 +- .../core/sequence/io/GenbankReaderTest.java | 34 ++++++++++++++++--- biojava-core/src/test/resources/NC_018080.gb | 28 +++++++++++++++ 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 biojava-core/src/test/resources/NC_018080.gb diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java index 70462a9c0b..7d7eab9d43 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java @@ -222,7 +222,8 @@ private void parseFeatureTag(List section) { Qualifier q = new Qualifier(key, val.replace('\n', ' ')); gbFeature.addQualifier(key, q); } else { - if (key.equalsIgnoreCase("translation")) { + if (key.equalsIgnoreCase("translation") || key.equals("anticodon") + || key.equals("transl_except")) { // strip spaces from sequence val = val.replaceAll("\\s+", ""); Qualifier q = new Qualifier(key, val); 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 f38070c710..325e07a5ef 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 @@ -36,10 +36,7 @@ import org.slf4j.LoggerFactory; import java.io.*; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; @@ -333,6 +330,35 @@ public void readSequenceWithZeroSpanFeature() throws IOException, CompoundNotFou assertEquals(Strand.NEGATIVE, fLocation.getStrand()); } + /** + * Biojava fails to parse anticodon and transl_except feature qualifiers when they line wrap. + * https://github.com/biojava/biojava/issues/843 + */ + @Test + public void testGithub843() throws Exception { + CheckableInputStream inStream = new CheckableInputStream(this.getClass().getResourceAsStream("/NC_018080.gb")); + assertNotNull(inStream); + + GenbankReader genbankDNA + = new GenbankReader<>( + inStream, + new GenericGenbankHeaderParser<>(), + new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) + ); + + LinkedHashMap dnaSequences = genbankDNA.process(); + assertNotNull(dnaSequences); + + DNASequence dna = new ArrayList<>(dnaSequences.values()).get(0); + assertNotNull(dna); + + FeatureInterface, NucleotideCompound> tRNAFeature = dna.getFeaturesByType("tRNA").get(0); + String anticodon = tRNAFeature.getQualifiers().get("anticodon").get(0).getValue(); + assertEquals("(pos:complement(1123552..1123554),aa:Leu,seq:caa)", anticodon); + String transl_except = tRNAFeature.getQualifiers().get("transl_except").get(0).getValue(); + assertEquals("(pos:complement(1123552..1123554),aa:Leu)",transl_except); + } + /** * Helper class to be able to verify the closed state of the input stream. */ diff --git a/biojava-core/src/test/resources/NC_018080.gb b/biojava-core/src/test/resources/NC_018080.gb new file mode 100644 index 0000000000..11d2d295ff --- /dev/null +++ b/biojava-core/src/test/resources/NC_018080.gb @@ -0,0 +1,28 @@ +LOCUS NC_018080 6402658 bp DNA circular CON 27-OCT-2020 +DEFINITION Pseudomonas aeruginosa DK2 +ACCESSION +VERSION .0 +KEYWORDS . +FEATURES Location/Qualifiers + source 1..6402658 + /organism="Pseudomonas aeruginosa DK2" + /mol_type="genomic DNA" + /strain="DK2" + /db_xref="taxon:1093787" + gene complement(1123502..1123588) + /locus_tag="PADK2_RS05265" + /old_locus_tag="PADK2_t29613" + tRNA complement(1123502..1123588) + /locus_tag="PADK2_RS05265" + /old_locus_tag="PADK2_t29613" + /product="tRNA-Leu" + /inference="COORDINATES: profile:tRNAscan-SE:2.0.6" + /note="Derived by automated computational analysis using + gene prediction method: tRNAscan-SE." + /anticodon=(pos:complement(1123552..1123554),aa:Leu, + seq:caa) + /transl_except=(pos:complement(1123552..1123554), + aa:Leu) +ORIGIN + 1 tttaaagaga ccggcgattc tagtgaaatc gaacgggcag gtcaatttcc aaccagcgat +// \ No newline at end of file From f1bcdb21ca868b712aac4cc26e2d05ea42327149 Mon Sep 17 00:00:00 2001 From: Jose Duarte Date: Thu, 8 Apr 2021 09:57:36 -0700 Subject: [PATCH 007/533] Removing utility method that shouldn't be here --- CHANGELOG.md | 1 + .../src/main/java/demo/DemoMmtfWriter.java | 2 - .../nbio/structure/io/mmtf/MmtfUtils.java | 48 ------------------- .../nbio/structure/io/mmtf/TestMmtfUtils.java | 27 ++++++++++- 4 files changed, 26 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae187a040b..555c8502b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ BioJava 6.0.0 (future release) * `org.biojava.nbio.structure.PDBStatus`: removed `getReplacement` and `getReplaces` * Removed `org.biojava.nbio.structure.io.mmcif` package * Removed functionality to write isolated CIF headers from `FileConvert` +* Removed `org.biojava.nbio.structure.io.mmtf.MmtfUtils.setUpBioJava()` ### Breaking API changes * Extracted `StructureIO.StructureFiletype` enum to `org.biojava.nbio.structure.io.StructureFiletype` (supports `PDB`, `MMTF`, `CIF`, and `BCIF`) diff --git a/biojava-structure/src/main/java/demo/DemoMmtfWriter.java b/biojava-structure/src/main/java/demo/DemoMmtfWriter.java index c9fcd8166c..b5f8e1f020 100644 --- a/biojava-structure/src/main/java/demo/DemoMmtfWriter.java +++ b/biojava-structure/src/main/java/demo/DemoMmtfWriter.java @@ -27,12 +27,10 @@ import org.biojava.nbio.structure.StructureException; import org.biojava.nbio.structure.StructureIO; import org.biojava.nbio.structure.io.mmtf.MmtfActions; -import org.biojava.nbio.structure.io.mmtf.MmtfUtils; public class DemoMmtfWriter { public static void main(String[] args) throws IOException, StructureException { - MmtfUtils.setUpBioJava(); Structure structure = StructureIO.getStructure("4cup"); MmtfActions.writeToFile(structure, Paths.get("/tmp/4cup.mmtf")); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java index c41eb33033..622f16122f 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java @@ -45,14 +45,9 @@ import org.biojava.nbio.structure.PDBCrystallographicInfo; import org.biojava.nbio.structure.Structure; import org.biojava.nbio.structure.StructureException; -import org.biojava.nbio.structure.io.StructureFiletype; -import org.biojava.nbio.structure.StructureIO; -import org.biojava.nbio.structure.align.util.AtomCache; import org.biojava.nbio.structure.chem.ChemComp; import org.biojava.nbio.structure.chem.ChemCompGroupFactory; import org.biojava.nbio.structure.chem.ChemCompTools; -import org.biojava.nbio.structure.chem.DownloadChemCompProvider; -import org.biojava.nbio.structure.io.FileParsingParameters; import org.biojava.nbio.structure.quaternary.BioAssemblyInfo; import org.biojava.nbio.structure.quaternary.BiologicalAssemblyTransformation; import org.biojava.nbio.structure.secstruc.SecStrucCalc; @@ -74,49 +69,6 @@ public class MmtfUtils { private static final Logger LOGGER = LoggerFactory.getLogger(MmtfUtils.class); - /** - * Set up the configuration parameters for BioJava. - */ - public static AtomCache setUpBioJava() { - // Set up the atom cache etc - AtomCache cache = new AtomCache(); - cache.setFiletype(StructureFiletype.MMTF); - FileParsingParameters params = cache.getFileParsingParams(); - params.setCreateAtomBonds(true); - params.setAlignSeqRes(true); - params.setParseBioAssembly(true); - DownloadChemCompProvider cc = new DownloadChemCompProvider(); - ChemCompGroupFactory.setChemCompProvider(cc); - cc.checkDoFirstInstall(); - cache.setFileParsingParams(params); - StructureIO.setAtomCache(cache); - return cache; - } - - /** - * Set up the configuration parameters for BioJava. - * @param extraUrl the string describing the URL (or file path) from which - * to get missing CCD entries. - */ - public static AtomCache setUpBioJava(String extraUrl) { - // Set up the atom cache etc - AtomCache cache = new AtomCache(); - cache.setFiletype(StructureFiletype.MMTF); - FileParsingParameters params = cache.getFileParsingParams(); - params.setCreateAtomBonds(true); - params.setAlignSeqRes(true); - params.setParseBioAssembly(true); - DownloadChemCompProvider.serverBaseUrl = extraUrl; - DownloadChemCompProvider.useDefaultUrlLayout = false; - DownloadChemCompProvider cc = new DownloadChemCompProvider(); - ChemCompGroupFactory.setChemCompProvider(cc); - cc.checkDoFirstInstall(); - cache.setFileParsingParams(params); - StructureIO.setAtomCache(cache); - return cache; - } - - /** * This sets all microheterogeneous groups * (previously alternate location groups) as separate groups. diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfUtils.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfUtils.java index ed86712893..cecc05a234 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfUtils.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfUtils.java @@ -20,6 +20,11 @@ */ package org.biojava.nbio.structure.io.mmtf; +import org.biojava.nbio.structure.align.util.AtomCache; +import org.biojava.nbio.structure.chem.ChemCompGroupFactory; +import org.biojava.nbio.structure.chem.DownloadChemCompProvider; +import org.biojava.nbio.structure.io.FileParsingParameters; +import org.biojava.nbio.structure.io.StructureFiletype; import org.junit.Test; import static org.junit.Assert.*; @@ -51,7 +56,6 @@ import org.biojava.nbio.structure.StructureException; import org.biojava.nbio.structure.StructureIO; import org.biojava.nbio.structure.StructureImpl; -import org.biojava.nbio.structure.io.mmtf.MmtfUtils; import org.biojava.nbio.structure.quaternary.BioAssemblyInfo; import org.biojava.nbio.structure.quaternary.BiologicalAssemblyTransformation; import org.biojava.nbio.structure.xtal.BravaisLattice; @@ -66,6 +70,25 @@ */ public class TestMmtfUtils { + /** + * Set up the configuration parameters for BioJava. + */ + public static AtomCache setUpBioJava() { + // Set up the atom cache etc + AtomCache cache = new AtomCache(); + cache.setFiletype(StructureFiletype.CIF); + FileParsingParameters params = cache.getFileParsingParams(); + params.setCreateAtomBonds(true); + params.setAlignSeqRes(true); + params.setParseBioAssembly(true); + DownloadChemCompProvider cc = new DownloadChemCompProvider(); + ChemCompGroupFactory.setChemCompProvider(cc); + cc.checkDoFirstInstall(); + cache.setFileParsingParams(params); + StructureIO.setAtomCache(cache); + return cache; + } + /** * Integration test to see that the microheterogenity is being dealt with correctly. * @@ -74,7 +97,7 @@ public class TestMmtfUtils { */ @Test public void microHeterogenity() throws IOException, StructureException { - MmtfUtils.setUpBioJava(); + setUpBioJava(); Structure inputStructure = StructureIO.getStructure("4ck4"); // Count the number of groups Group before = inputStructure.getChains().get(0).getAtomGroup(17); From 687e0290af99ff6fe8cf5a0eaab728486bf20191 Mon Sep 17 00:00:00 2001 From: JonStargaryen Date: Tue, 13 Apr 2021 12:17:30 -0700 Subject: [PATCH 008/533] fix logging in CifStructureConsumerImpl if type symbol is unknown --- .../biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java index c64f1ac412..146281d0dd 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java @@ -332,7 +332,7 @@ public void consumeAtomSite(AtomSite atomSite) { atom.setElement(element); } catch (IllegalArgumentException e) { logger.info("Element {} was not recognised as a BioJava-known element, the element will be " + - "represented as the generic element {}", typeSymbol, Element.R.name()); + "represented as the generic element {}", ts, Element.R.name()); atom.setElement(Element.R); } From 93b053933c14c75e21d3488f37e3a5eae253a561 Mon Sep 17 00:00:00 2001 From: Jose Duarte Date: Tue, 13 Apr 2021 18:20:04 -0700 Subject: [PATCH 009/533] Fixing issue with file parsing params, they weren't passed in Cif reading case --- .../src/main/java/org/biojava/nbio/structure/URLIdentifier.java | 2 +- .../biojava/nbio/structure/io/cif/CifStructureConverter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java index 69b5833766..0581ba3a60 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java @@ -153,7 +153,7 @@ public Structure loadStructure(AtomCache cache) throws StructureException, IOExc switch(format) { case CIF: case BCIF: - return CifStructureConverter.fromURL(url); + return CifStructureConverter.fromURL(url, cache.getFileParsingParams()); case MMTF: return MmtfActions.readFromInputStream(url.openStream()); default: case PDB: diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConverter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConverter.java index 98ef24561b..1351223982 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConverter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConverter.java @@ -57,7 +57,7 @@ public static Structure fromURL(URL url) throws IOException { * @return the target * @throws IOException thrown when reading fails */ - private static Structure fromURL(URL url, FileParsingParameters parameters) throws IOException { + public static Structure fromURL(URL url, FileParsingParameters parameters) throws IOException { return fromInputStream(url.openStream(), parameters); } From 936bfc034925195de7c52c72169474fdc9d8ca59 Mon Sep 17 00:00:00 2001 From: Jose Manuel Duarte Date: Tue, 13 Apr 2021 18:54:27 -0700 Subject: [PATCH 010/533] [maven-release-plugin] prepare release biojava-6.0.0-alpha3 --- biojava-aa-prop/pom.xml | 6 +++--- biojava-alignment/pom.xml | 4 ++-- biojava-core/pom.xml | 2 +- biojava-genome/pom.xml | 6 +++--- biojava-integrationtest/pom.xml | 4 ++-- biojava-modfinder/pom.xml | 4 ++-- biojava-ontology/pom.xml | 2 +- biojava-protein-disorder/pom.xml | 4 ++-- biojava-structure-gui/pom.xml | 6 +++--- biojava-structure/pom.xml | 6 +++--- biojava-survival/pom.xml | 2 +- biojava-ws/pom.xml | 4 ++-- pom.xml | 4 ++-- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/biojava-aa-prop/pom.xml b/biojava-aa-prop/pom.xml index 78344622b1..59a6f762bc 100644 --- a/biojava-aa-prop/pom.xml +++ b/biojava-aa-prop/pom.xml @@ -2,7 +2,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 4.0.0 biojava-aa-prop @@ -70,12 +70,12 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha3 diff --git a/biojava-alignment/pom.xml b/biojava-alignment/pom.xml index a22b560d19..108cdee778 100644 --- a/biojava-alignment/pom.xml +++ b/biojava-alignment/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-alignment biojava-alignment @@ -47,7 +47,7 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 6cc9c6c9af..7b38b5bddd 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 4.0.0 biojava-core diff --git a/biojava-genome/pom.xml b/biojava-genome/pom.xml index c4d667cf50..f23c858b42 100644 --- a/biojava-genome/pom.xml +++ b/biojava-genome/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 4.0.0 biojava-genome @@ -85,13 +85,13 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile org.biojava biojava-alignment - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile diff --git a/biojava-integrationtest/pom.xml b/biojava-integrationtest/pom.xml index 0bd381f989..404c462ad6 100644 --- a/biojava-integrationtest/pom.xml +++ b/biojava-integrationtest/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-integrationtest jar @@ -28,7 +28,7 @@ org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha3 diff --git a/biojava-modfinder/pom.xml b/biojava-modfinder/pom.xml index 4df1148dee..67f3440a0a 100644 --- a/biojava-modfinder/pom.xml +++ b/biojava-modfinder/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-modfinder biojava-modfinder @@ -31,7 +31,7 @@ org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha3 jar compile diff --git a/biojava-ontology/pom.xml b/biojava-ontology/pom.xml index 03787e7d7a..414e38f0b0 100644 --- a/biojava-ontology/pom.xml +++ b/biojava-ontology/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-ontology diff --git a/biojava-protein-disorder/pom.xml b/biojava-protein-disorder/pom.xml index 9153de3e05..06d6ff0013 100644 --- a/biojava-protein-disorder/pom.xml +++ b/biojava-protein-disorder/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-protein-disorder jar @@ -63,7 +63,7 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 diff --git a/biojava-structure-gui/pom.xml b/biojava-structure-gui/pom.xml index 154f7c229d..f09fb9ae90 100644 --- a/biojava-structure-gui/pom.xml +++ b/biojava-structure-gui/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 4.0.0 biojava-structure-gui @@ -27,13 +27,13 @@ org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile diff --git a/biojava-structure/pom.xml b/biojava-structure/pom.xml index 87b34d4dcb..2307cd5f17 100644 --- a/biojava-structure/pom.xml +++ b/biojava-structure/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-structure biojava-structure @@ -44,13 +44,13 @@ org.biojava biojava-alignment - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile diff --git a/biojava-survival/pom.xml b/biojava-survival/pom.xml index 8774d85478..d13042e8dc 100644 --- a/biojava-survival/pom.xml +++ b/biojava-survival/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-survival diff --git a/biojava-ws/pom.xml b/biojava-ws/pom.xml index 65b13c6730..e848c5e84f 100644 --- a/biojava-ws/pom.xml +++ b/biojava-ws/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava-ws biojava-ws @@ -19,7 +19,7 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha3 compile diff --git a/pom.xml b/pom.xml index 6d307acc49..c6b236e951 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.biojava biojava pom - 6.0.0-SNAPSHOT + 6.0.0-alpha3 biojava BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the @@ -51,7 +51,7 @@ scm:git:git@github.com:biojava/biojava.git https://github.com/biojava/biojava - HEAD + biojava-6.0.0-alpha3 diff --git a/biojava-alignment/pom.xml b/biojava-alignment/pom.xml index 108cdee778..a22b560d19 100644 --- a/biojava-alignment/pom.xml +++ b/biojava-alignment/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-alignment biojava-alignment @@ -47,7 +47,7 @@ org.biojava biojava-core - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 7b38b5bddd..6cc9c6c9af 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT 4.0.0 biojava-core diff --git a/biojava-genome/pom.xml b/biojava-genome/pom.xml index f23c858b42..c4d667cf50 100644 --- a/biojava-genome/pom.xml +++ b/biojava-genome/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT 4.0.0 biojava-genome @@ -85,13 +85,13 @@ org.biojava biojava-core - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile org.biojava biojava-alignment - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile diff --git a/biojava-integrationtest/pom.xml b/biojava-integrationtest/pom.xml index 404c462ad6..0bd381f989 100644 --- a/biojava-integrationtest/pom.xml +++ b/biojava-integrationtest/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-integrationtest jar @@ -28,7 +28,7 @@ org.biojava biojava-structure - 6.0.0-alpha3 + 6.0.0-SNAPSHOT diff --git a/biojava-modfinder/pom.xml b/biojava-modfinder/pom.xml index 67f3440a0a..4df1148dee 100644 --- a/biojava-modfinder/pom.xml +++ b/biojava-modfinder/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-modfinder biojava-modfinder @@ -31,7 +31,7 @@ org.biojava biojava-structure - 6.0.0-alpha3 + 6.0.0-SNAPSHOT jar compile diff --git a/biojava-ontology/pom.xml b/biojava-ontology/pom.xml index 414e38f0b0..03787e7d7a 100644 --- a/biojava-ontology/pom.xml +++ b/biojava-ontology/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-ontology diff --git a/biojava-protein-disorder/pom.xml b/biojava-protein-disorder/pom.xml index 06d6ff0013..9153de3e05 100644 --- a/biojava-protein-disorder/pom.xml +++ b/biojava-protein-disorder/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-protein-disorder jar @@ -63,7 +63,7 @@ org.biojava biojava-core - 6.0.0-alpha3 + 6.0.0-SNAPSHOT diff --git a/biojava-structure-gui/pom.xml b/biojava-structure-gui/pom.xml index f09fb9ae90..154f7c229d 100644 --- a/biojava-structure-gui/pom.xml +++ b/biojava-structure-gui/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT 4.0.0 biojava-structure-gui @@ -27,13 +27,13 @@ org.biojava biojava-structure - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile org.biojava biojava-core - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile diff --git a/biojava-structure/pom.xml b/biojava-structure/pom.xml index 2307cd5f17..87b34d4dcb 100644 --- a/biojava-structure/pom.xml +++ b/biojava-structure/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-structure biojava-structure @@ -44,13 +44,13 @@ org.biojava biojava-alignment - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile org.biojava biojava-core - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile diff --git a/biojava-survival/pom.xml b/biojava-survival/pom.xml index d13042e8dc..8774d85478 100644 --- a/biojava-survival/pom.xml +++ b/biojava-survival/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-survival diff --git a/biojava-ws/pom.xml b/biojava-ws/pom.xml index e848c5e84f..65b13c6730 100644 --- a/biojava-ws/pom.xml +++ b/biojava-ws/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava-ws biojava-ws @@ -19,7 +19,7 @@ org.biojava biojava-core - 6.0.0-alpha3 + 6.0.0-SNAPSHOT compile diff --git a/pom.xml b/pom.xml index c6b236e951..6d307acc49 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.biojava biojava pom - 6.0.0-alpha3 + 6.0.0-SNAPSHOT biojava BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the @@ -51,7 +51,7 @@ scm:git:git@github.com:biojava/biojava.git https://github.com/biojava/biojava - biojava-6.0.0-alpha3 + HEAD diff --git a/biojava-alignment/pom.xml b/biojava-alignment/pom.xml index a22b560d19..e23155c7ba 100644 --- a/biojava-alignment/pom.xml +++ b/biojava-alignment/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-alignment biojava-alignment @@ -47,7 +47,7 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 6cc9c6c9af..0413c71f63 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 4.0.0 biojava-core diff --git a/biojava-genome/pom.xml b/biojava-genome/pom.xml index 2fb8e78426..311bb549c7 100644 --- a/biojava-genome/pom.xml +++ b/biojava-genome/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 4.0.0 biojava-genome @@ -85,13 +85,13 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile org.biojava biojava-alignment - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile diff --git a/biojava-integrationtest/pom.xml b/biojava-integrationtest/pom.xml index 0bd381f989..0070072c52 100644 --- a/biojava-integrationtest/pom.xml +++ b/biojava-integrationtest/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-integrationtest jar @@ -28,7 +28,7 @@ org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha4 diff --git a/biojava-modfinder/pom.xml b/biojava-modfinder/pom.xml index 4df1148dee..11d57a9fce 100644 --- a/biojava-modfinder/pom.xml +++ b/biojava-modfinder/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-modfinder biojava-modfinder @@ -31,7 +31,7 @@ org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha4 jar compile diff --git a/biojava-ontology/pom.xml b/biojava-ontology/pom.xml index 03787e7d7a..4542ede6e2 100644 --- a/biojava-ontology/pom.xml +++ b/biojava-ontology/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-ontology diff --git a/biojava-protein-disorder/pom.xml b/biojava-protein-disorder/pom.xml index 9153de3e05..dfe2fbd64e 100644 --- a/biojava-protein-disorder/pom.xml +++ b/biojava-protein-disorder/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-protein-disorder jar @@ -63,7 +63,7 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha4 diff --git a/biojava-structure-gui/pom.xml b/biojava-structure-gui/pom.xml index 154f7c229d..51efcc3262 100644 --- a/biojava-structure-gui/pom.xml +++ b/biojava-structure-gui/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 4.0.0 biojava-structure-gui @@ -27,13 +27,13 @@ org.biojava biojava-structure - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile diff --git a/biojava-structure/pom.xml b/biojava-structure/pom.xml index 87b34d4dcb..fa75d6e5fa 100644 --- a/biojava-structure/pom.xml +++ b/biojava-structure/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-structure biojava-structure @@ -44,13 +44,13 @@ org.biojava biojava-alignment - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile diff --git a/biojava-survival/pom.xml b/biojava-survival/pom.xml index 8774d85478..6f1e37a73e 100644 --- a/biojava-survival/pom.xml +++ b/biojava-survival/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-survival diff --git a/biojava-ws/pom.xml b/biojava-ws/pom.xml index 65b13c6730..1b3941438f 100644 --- a/biojava-ws/pom.xml +++ b/biojava-ws/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava-ws biojava-ws @@ -19,7 +19,7 @@ org.biojava biojava-core - 6.0.0-SNAPSHOT + 6.0.0-alpha4 compile diff --git a/pom.xml b/pom.xml index 6d307acc49..90a22f63b7 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.biojava biojava pom - 6.0.0-SNAPSHOT + 6.0.0-alpha4 biojava BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the @@ -51,7 +51,7 @@ scm:git:git@github.com:biojava/biojava.git https://github.com/biojava/biojava - HEAD + biojava-6.0.0-alpha4 diff --git a/biojava-alignment/pom.xml b/biojava-alignment/pom.xml index e23155c7ba..a22b560d19 100644 --- a/biojava-alignment/pom.xml +++ b/biojava-alignment/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-alignment biojava-alignment @@ -47,7 +47,7 @@ org.biojava biojava-core - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 0413c71f63..6cc9c6c9af 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT 4.0.0 biojava-core diff --git a/biojava-genome/pom.xml b/biojava-genome/pom.xml index 311bb549c7..2fb8e78426 100644 --- a/biojava-genome/pom.xml +++ b/biojava-genome/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT 4.0.0 biojava-genome @@ -85,13 +85,13 @@ org.biojava biojava-core - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile org.biojava biojava-alignment - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile diff --git a/biojava-integrationtest/pom.xml b/biojava-integrationtest/pom.xml index 0070072c52..0bd381f989 100644 --- a/biojava-integrationtest/pom.xml +++ b/biojava-integrationtest/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-integrationtest jar @@ -28,7 +28,7 @@ org.biojava biojava-structure - 6.0.0-alpha4 + 6.0.0-SNAPSHOT diff --git a/biojava-modfinder/pom.xml b/biojava-modfinder/pom.xml index 11d57a9fce..4df1148dee 100644 --- a/biojava-modfinder/pom.xml +++ b/biojava-modfinder/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-modfinder biojava-modfinder @@ -31,7 +31,7 @@ org.biojava biojava-structure - 6.0.0-alpha4 + 6.0.0-SNAPSHOT jar compile diff --git a/biojava-ontology/pom.xml b/biojava-ontology/pom.xml index 4542ede6e2..03787e7d7a 100644 --- a/biojava-ontology/pom.xml +++ b/biojava-ontology/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-ontology diff --git a/biojava-protein-disorder/pom.xml b/biojava-protein-disorder/pom.xml index dfe2fbd64e..9153de3e05 100644 --- a/biojava-protein-disorder/pom.xml +++ b/biojava-protein-disorder/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-protein-disorder jar @@ -63,7 +63,7 @@ org.biojava biojava-core - 6.0.0-alpha4 + 6.0.0-SNAPSHOT diff --git a/biojava-structure-gui/pom.xml b/biojava-structure-gui/pom.xml index 51efcc3262..154f7c229d 100644 --- a/biojava-structure-gui/pom.xml +++ b/biojava-structure-gui/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT 4.0.0 biojava-structure-gui @@ -27,13 +27,13 @@ org.biojava biojava-structure - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile org.biojava biojava-core - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile diff --git a/biojava-structure/pom.xml b/biojava-structure/pom.xml index fa75d6e5fa..87b34d4dcb 100644 --- a/biojava-structure/pom.xml +++ b/biojava-structure/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-structure biojava-structure @@ -44,13 +44,13 @@ org.biojava biojava-alignment - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile org.biojava biojava-core - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile diff --git a/biojava-survival/pom.xml b/biojava-survival/pom.xml index 6f1e37a73e..8774d85478 100644 --- a/biojava-survival/pom.xml +++ b/biojava-survival/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-survival diff --git a/biojava-ws/pom.xml b/biojava-ws/pom.xml index 1b3941438f..65b13c6730 100644 --- a/biojava-ws/pom.xml +++ b/biojava-ws/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava-ws biojava-ws @@ -19,7 +19,7 @@ org.biojava biojava-core - 6.0.0-alpha4 + 6.0.0-SNAPSHOT compile diff --git a/pom.xml b/pom.xml index 90a22f63b7..6d307acc49 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.biojava biojava pom - 6.0.0-alpha4 + 6.0.0-SNAPSHOT biojava BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the @@ -51,7 +51,7 @@ scm:git:git@github.com:biojava/biojava.git https://github.com/biojava/biojava - biojava-6.0.0-alpha4 + HEAD UTF-8 512M - 1.0.9 + 1.0.10 1.7.30 2.14.0 ciftools-java-jdk8 From eac22bc94bf684d92363dd0bff5ea705845af733 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Fri, 2 Jul 2021 17:05:20 +0100 Subject: [PATCH 037/533] test getTrace() to improve test coverage --- .../nbio/core/sequence/io/ABITracerTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java index 89aef23cbb..df77b7c00a 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java @@ -21,9 +21,14 @@ package org.biojava.nbio.core.sequence.io; +import static org.junit.Assert.assertEquals; + import java.awt.image.BufferedImage; import java.io.File; import java.net.URL; +import java.util.Arrays; + +import org.biojava.nbio.core.exceptions.CompoundNotFoundException; import org.junit.*; /** @@ -79,7 +84,8 @@ public void testLocal() throws Exception { Assert.assertNotNull(tracer); //Test length of tracer for file 3730.ab1 - Assert.assertEquals(16302, tracer.getTraceLength()); + final int EXPECTED_TRACE_LENGTH = 16302; + Assert.assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTraceLength()); //Test length of sequence for file 3730.ab1 Assert.assertEquals(1165, tracer.getSequenceLength()); @@ -92,5 +98,10 @@ public void testLocal() throws Exception { //Test image of tracer for file 3730.ab1 BufferedImage image = tracer.getImage(100,100); Assert.assertNotNull(image); + + Assert.assertThrows(CompoundNotFoundException.class, ()->tracer.getTrace("D")); + for (String base: Arrays.asList(new String []{"A","T","C","G"})){ + assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTrace(base).length); + } } } From d8d5a7b4519eef2807948733912c08fc159526ad Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Fri, 2 Jul 2021 17:09:26 +0100 Subject: [PATCH 038/533] organise imports --- .../nbio/core/sequence/io/ABITracerTest.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java index df77b7c00a..6d42ba48fc 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java @@ -21,7 +21,10 @@ package org.biojava.nbio.core.sequence.io; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.awt.image.BufferedImage; import java.io.File; @@ -66,9 +69,9 @@ public void tearDown() { @Test public void testURL() throws Exception { URL resource = this.getClass().getResource("/3730.ab1"); - Assert.assertNotNull(resource); + assertNotNull(resource); ABITrace tracer = new ABITrace(resource); - Assert.assertNotNull(tracer); + assertNotNull(tracer); } /** @@ -77,27 +80,27 @@ public void testURL() throws Exception { @Test public void testLocal() throws Exception { URL resource = this.getClass().getResource("/3730.ab1"); - Assert.assertNotNull(resource); + assertNotNull(resource); File file = new File(resource.toURI()); - Assert.assertNotNull(file); + assertNotNull(file); ABITrace tracer = new ABITrace(file); - Assert.assertNotNull(tracer); + assertNotNull(tracer); //Test length of tracer for file 3730.ab1 final int EXPECTED_TRACE_LENGTH = 16302; - Assert.assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTraceLength()); + assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTraceLength()); //Test length of sequence for file 3730.ab1 - Assert.assertEquals(1165, tracer.getSequenceLength()); + assertEquals(1165, tracer.getSequenceLength()); //Test sequence of tracer for file 3730.ab1 - Assert.assertTrue(sequence.equals(tracer.getSequence().getSequenceAsString())); + assertTrue(sequence.equals(tracer.getSequence().getSequenceAsString())); //Test array that represents the quality of tracer for file 3730.ab1 - Assert.assertArrayEquals(qual, tracer.getQcalls()); + assertArrayEquals(qual, tracer.getQcalls()); //Test array that represents the baseline of tracer for file 3730.ab1 - Assert.assertArrayEquals(base, tracer.getBasecalls()); + assertArrayEquals(base, tracer.getBasecalls()); //Test image of tracer for file 3730.ab1 BufferedImage image = tracer.getImage(100,100); - Assert.assertNotNull(image); + assertNotNull(image); Assert.assertThrows(CompoundNotFoundException.class, ()->tracer.getTrace("D")); for (String base: Arrays.asList(new String []{"A","T","C","G"})){ From 281e915d59aa359fdc3cad36d49b2fe094d945b7 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Sun, 4 Jul 2021 00:19:25 +0100 Subject: [PATCH 039/533] initial addition of junit 5 --- biojava-core/pom.xml | 12 ++++++ .../nbio/core/TestAmbiguityCompoundSet.java | 14 ++++--- pom.xml | 42 ++++++++++++++++--- 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 6cc9c6c9af..4637ab6534 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -44,6 +44,18 @@ junit test + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.vintage + junit-vintage-engine + org.slf4j diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java b/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java index 56abb5d802..6951fbc4d4 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java @@ -30,8 +30,10 @@ import org.biojava.nbio.core.sequence.template.CompoundSet; import org.biojava.nbio.core.sequence.template.Sequence; import org.biojava.nbio.core.sequence.transcription.DNAToRNATranslator; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.DisplayName; + +import static org.junit.jupiter.api.Assertions.assertEquals; /** * A Test case for https://github.com/biojava/biojava/issues/344 @@ -39,9 +41,11 @@ * Created by andreas on 12/4/15. */ + public class TestAmbiguityCompoundSet { @Test + @DisplayName("Convert DNA to RNA") public void testCompountSet() throws Exception { CompoundSet dnaSet = AmbiguityDNACompoundSet.getDNACompoundSet(); @@ -49,13 +53,13 @@ public void testCompountSet() throws Exception { DNASequence dna = new DNASequence("AGTCS", dnaSet); - Assert.assertEquals("AGTCS", dna.toString()); + assertEquals("AGTCS", dna.toString()); RNASequence rna = dna.getRNASequence(); rna = new RNASequence(dna.getSequenceAsString().replaceAll("T", "U"), AmbiguityRNACompoundSet.getRNACompoundSet()); //fails with missing compound S - Assert.assertEquals("AGUCS", rna.toString()); + assertEquals("AGUCS", rna.toString()); /* now, do the translation also using the underlying API (should not be needed for a user) * @@ -65,7 +69,7 @@ public void testCompountSet() throws Exception { Sequence translated = translator.createSequence(dna); - Assert.assertEquals("AGUCS", translated.toString()); + assertEquals("AGUCS", translated.toString()); } diff --git a/pom.xml b/pom.xml index 6e55a71501..d5a7d30e65 100644 --- a/pom.xml +++ b/pom.xml @@ -239,6 +239,24 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + true + true + true + true + + + true + true + true + + + org.apache.maven.plugins maven-shade-plugin @@ -313,11 +331,7 @@ maven-install-plugin 3.0.0-M1 - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M5 - + org.apache.maven.plugins maven-site-plugin @@ -404,6 +418,24 @@ 4.13.2 test + + org.junit.vintage + junit-vintage-engine + 5.7.2 + test + + + org.junit.jupiter + junit-jupiter-api + 5.7.2 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.7.2 + test + org.slf4j slf4j-api From 30cd5ef614166827ce672fcac32a35ecdbc7f4ba Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Sun, 4 Jul 2021 10:29:24 +0100 Subject: [PATCH 040/533] refactor 2 tests to use junit5 features --- biojava-core/pom.xml | 25 ++++---- .../nbio/core/TestAmbiguityCompoundSet.java | 3 +- .../nbio/core/sequence/io/ABITracerTest.java | 60 ++++++++++--------- pom.xml | 52 +++++++--------- 4 files changed, 64 insertions(+), 76 deletions(-) diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 4637ab6534..b61e45194a 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -42,20 +42,19 @@ junit junit - test - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - - org.junit.vintage - junit-vintage-engine - + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-params + + + org.junit.vintage + junit-vintage-engine + org.slf4j @@ -76,5 +75,3 @@ - - diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java b/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java index 6951fbc4d4..9fad78d7b0 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java @@ -45,18 +45,17 @@ public class TestAmbiguityCompoundSet { @Test - @DisplayName("Convert DNA to RNA") public void testCompountSet() throws Exception { CompoundSet dnaSet = AmbiguityDNACompoundSet.getDNACompoundSet(); CompoundSet rnaSet = AmbiguityRNACompoundSet.getRNACompoundSet(); + DNASequence dna = new DNASequence("AGTCS", dnaSet); assertEquals("AGTCS", dna.toString()); RNASequence rna = dna.getRNASequence(); - rna = new RNASequence(dna.getSequenceAsString().replaceAll("T", "U"), AmbiguityRNACompoundSet.getRNACompoundSet()); //fails with missing compound S assertEquals("AGUCS", rna.toString()); diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java index 6d42ba48fc..dce9cc7b58 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java @@ -21,10 +21,11 @@ package org.biojava.nbio.core.sequence.io; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.*; +import org.junit.jupiter.params.provider.ValueSource; +import org.junit.jupiter.params.ParameterizedTest; import java.awt.image.BufferedImage; import java.io.File; @@ -32,35 +33,31 @@ import java.util.Arrays; import org.biojava.nbio.core.exceptions.CompoundNotFoundException; -import org.junit.*; /** * Test file 3730.ab1 is from https://github.com/biopython/biopython/blob/master/Tests/Abi/3730.ab1 * The test data for comparing the results from ABITrace.java for file 3730.ab1 is from https://github.com/biopython/biopython/blob/master/Tests/Abi/test_data */ public class ABITracerTest { + private String sequence = "GGGCGAGCKYYAYATTTTGGCAAGAATTGAGCTCTATGGCCACAACCATGGTGAGCAAGGGCGAGGAGGATAACATGGCCATCATCAAGGAGTTCATGCGCTTCAAGGTGCACATGGAGGGCTCCGTGAACGGCCACGAGTTCGAGATCGAGGGCGAGGGCGAGGGCCGCCCCTACGAGGGCACCCAGACCGCCAAGCTGAAGGTGACCAAGGGTGGCCCCCTGCCCTTCGCCTGGGACATCCTGTCCCCTCAGTTCATGTACGGCTCCAAGGCCTACGTGAAGCACCCCGCCGACATCCCCGACTACTTGAAGCTGTCCTTCCCCGAGGGCTTCAAGTGGGAGCGCGTGATGAACTTCGAGGACGGCGGCGTGGTGACCGTGACCCAGGACTCCTCCCTGCAGGACGGCGAGTTCATCTACAAGGTGAAGCTGCGCGGCACCAACTTCCCCTCCGACGGCCCCGTAATGCAGAAGAAGACCATGGGCTGGGAGGCCTCCTCCGAGCGGATGTACCCCGAGGACGGCGCCCTGAAGGGCGAGATCAAGCAGAGGCTGAAGCTGAAGGACGGCGGCCACTACGACGCTGAGGTCAAGACCACCTACAAGGCCAAGAAGCCCGTGCAGCTGCCCGGCGCCTACAACGTCAACATCAAGTTGGACATCACCTCCCACAACGAGGACTACACCATCGTGGAACAGTACGAACGCGCCGAGGGCCGCCACTCCACCGGCGGCATGGACGAGCTGTACAAGGGCGGCAGCGGCATGGTGAGCAAGGGCGAGGAGCTGTTCACCGGGGTGGTGCCCATCCTGGTCGAGCTGGACGGCGACGTAAACGGCCACAAGTTCAGCGTGTCCGGCGAGGGCGAGGGCGATGCCACCTACGGCAAGCTGACCCTGAAGTTCATCTGCACCACCGGCAAGCTGCCCGTGCCCTGGCCCACCCTCGTGACCACCCTGACCTACGGCGTGCAGTGCTTCAGCCGCTACCCCGACCACATGAAGCAGCACGACTTCTTCAAGTCCGCCATGCCCGAAGGCTACGTCCAGGAGCGCACCATCTTCTTCAAGGACGACGGCAACTACAARACCCGCGCCGAGGTGAARTTCGAGGGCGACACCCTGGTGAACCGCATCGAGCTGAAAGGGGCAYCGCACCTTTC"; private int[] qual = {20, 3, 4, 4, 4, 6, 4, 4, 0, 0, 0, 6, 0, 10, 20, 26, 22, 17, 21, 31, 29, 32, 28, 18, 23, 17, 19, 35, 36, 50, 39, 50, 50, 50, 50, 50, 25, 35, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 39, 33, 20, 35, 31, 50, 50, 50, 50, 50, 50, 50, 50, 50, 31, 50, 35, 31, 23, 28, 31, 21, 43, 39, 35, 24, 30, 26, 35, 31, 50, 50, 50, 50, 50, 50, 50, 50, 50, 39, 31, 24, 39, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 31, 31, 43, 43, 50, 50, 50, 50, 50, 31, 31, 31, 31, 50, 50, 50, 50, 50, 50, 50, 50, 31, 31, 35, 50, 50, 50, 50, 31, 36, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 43, 43, 50, 43, 43, 50, 43, 43, 50, 43, 43, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 43, 43, 50, 43, 43, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 21, 28, 35, 28, 28, 35, 35, 35, 35, 35, 37, 38, 21, 28, 35, 28, 28, 35, 35, 35, 35, 35, 35, 35, 36, 36, 21, 39, 35, 35, 35, 39, 35, 37, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 28, 28, 35, 35, 28, 28, 35, 35, 35, 36, 36, 22, 39, 35, 35, 35, 35, 35, 35, 37, 38, 28, 35, 21, 36, 36, 37, 35, 35, 20, 39, 39, 35, 35, 35, 35, 37, 38, 28, 35, 37, 34, 35, 24, 24, 27, 25, 20, 24, 37, 35, 27, 21, 20, 21, 27, 17, 20, 24, 32, 26, 20, 12, 20, 10, 20, 24, 25, 23, 20, 32, 24, 24, 23, 20, 24, 23, 18, 34, 34, 34, 22, 26, 24, 24, 18, 22, 22, 23, 25, 20, 12, 20, 24, 23, 24, 23, 22, 20, 20, 0, 20, 24, 23, 20, 8, 10, 4, 20, 20, 3, 7, 19, 20, 4, 4, 7, 7, 0, 7, 11, 18, 8, 3, 23, 23, 20, 11, 4, 20, 18, 12, 20, 20, 20, 4, 20, 4, 2, 3, 21, 21, 21, 21, 10, 15, 14, 15, 19, 2, 4, 3, 6, 11, 3, 4, 6, 21, 16, 20, 11, 1, 4, 12, 0, 15, 8, 1, 3, 3, 12, 1, 11, 20, 4}; private int[] base = {2, 13, 38, 51, 67, 78, 92, 118, 138, 162, 181, 191, 210, 222, 239, 253, 266, 280, 288, 304, 317, 333, 347, 359, 375, 386, 394, 406, 418, 433, 444, 457, 472, 482, 496, 506, 519, 529, 544, 557, 569, 579, 590, 601, 614, 626, 638, 649, 663, 673, 686, 706, 715, 731, 740, 753, 765, 777, 787, 799, 813, 826, 838, 854, 863, 876, 892, 901, 913, 929, 937, 948, 960, 970, 981, 993, 1004, 1017, 1034, 1045, 1056, 1068, 1080, 1091, 1103, 1115, 1126, 1138, 1148, 1160, 1177, 1187, 1199, 1211, 1222, 1232, 1243, 1254, 1268, 1279, 1294, 1307, 1319, 1330, 1341, 1352, 1362, 1374, 1388, 1398, 1411, 1422, 1433, 1444, 1456, 1466, 1479, 1497, 1506, 1519, 1531, 1543, 1556, 1567, 1578, 1589, 1604, 1614, 1630, 1641, 1651, 1662, 1675, 1688, 1700, 1711, 1721, 1732, 1748, 1758, 1772, 1784, 1795, 1806, 1820, 1830, 1844, 1855, 1866, 1877, 1892, 1902, 1914, 1926, 1939, 1950, 1965, 1974, 1986, 1999, 2011, 2023, 2037, 2047, 2059, 2072, 2084, 2096, 2107, 2120, 2132, 2144, 2156, 2169, 2180, 2191, 2202, 2217, 2227, 2239, 2251, 2264, 2275, 2286, 2297, 2309, 2321, 2332, 2347, 2358, 2369, 2381, 2394, 2406, 2417, 2429, 2439, 2452, 2465, 2476, 2490, 2501, 2512, 2524, 2536, 2546, 2560, 2570, 2581, 2593, 2605, 2616, 2628, 2640, 2653, 2664, 2676, 2688, 2700, 2712, 2723, 2735, 2748, 2759, 2772, 2784, 2795, 2808, 2820, 2831, 2842, 2854, 2866, 2878, 2888, 2901, 2913, 2927, 2936, 2947, 2958, 2970, 2982, 2994, 3005, 3019, 3030, 3041, 3053, 3064, 3077, 3088, 3099, 3110, 3123, 3135, 3146, 3157, 3168, 3179, 3192, 3203, 3214, 3226, 3238, 3251, 3263, 3275, 3286, 3297, 3308, 3320, 3331, 3344, 3356, 3368, 3380, 3391, 3402, 3415, 3426, 3440, 3451, 3462, 3474, 3485, 3496, 3508, 3520, 3532, 3543, 3556, 3569, 3580, 3593, 3604, 3615, 3626, 3638, 3650, 3661, 3673, 3684, 3698, 3709, 3721, 3732, 3744, 3756, 3767, 3779, 3792, 3803, 3814, 3827, 3838, 3850, 3862, 3873, 3885, 3897, 3909, 3920, 3932, 3943, 3955, 3966, 3980, 3990, 4002, 4014, 4026, 4038, 4050, 4061, 4072, 4083, 4095, 4107, 4119, 4131, 4143, 4156, 4167, 4179, 4191, 4203, 4215, 4227, 4238, 4252, 4262, 4274, 4287, 4298, 4310, 4321, 4333, 4345, 4356, 4370, 4381, 4393, 4406, 4417, 4428, 4440, 4453, 4464, 4477, 4489, 4500, 4513, 4524, 4536, 4548, 4560, 4573, 4583, 4595, 4607, 4620, 4631, 4645, 4655, 4667, 4679, 4690, 4702, 4714, 4728, 4739, 4750, 4762, 4774, 4786, 4798, 4810, 4821, 4833, 4845, 4857, 4869, 4880, 4892, 4905, 4916, 4927, 4940, 4952, 4963, 4977, 4988, 5000, 5012, 5023, 5034, 5045, 5057, 5069, 5081, 5093, 5104, 5115, 5127, 5139, 5151, 5163, 5176, 5188, 5199, 5211, 5223, 5235, 5247, 5259, 5272, 5283, 5296, 5308, 5320, 5331, 5343, 5354, 5366, 5378, 5390, 5402, 5414, 5426, 5438, 5450, 5462, 5474, 5486, 5497, 5510, 5521, 5532, 5544, 5557, 5569, 5581, 5592, 5604, 5617, 5629, 5641, 5652, 5663, 5676, 5687, 5699, 5712, 5724, 5735, 5748, 5760, 5771, 5784, 5794, 5806, 5817, 5829, 5841, 5853, 5866, 5879, 5891, 5903, 5916, 5928, 5941, 5952, 5964, 5976, 5988, 6000, 6012, 6024, 6036, 6048, 6060, 6072, 6085, 6096, 6109, 6121, 6133, 6146, 6157, 6168, 6180, 6192, 6203, 6215, 6227, 6239, 6251, 6265, 6276, 6289, 6302, 6313, 6325, 6337, 6349, 6361, 6374, 6386, 6398, 6410, 6422, 6436, 6448, 6459, 6471, 6483, 6495, 6507, 6520, 6532, 6545, 6555, 6567, 6579, 6591, 6603, 6615, 6627, 6640, 6652, 6664, 6676, 6688, 6700, 6713, 6726, 6738, 6749, 6761, 6774, 6786, 6799, 6811, 6823, 6835, 6848, 6859, 6871, 6883, 6895, 6907, 6920, 6933, 6945, 6956, 6968, 6980, 6992, 7005, 7016, 7030, 7042, 7053, 7066, 7079, 7091, 7104, 7115, 7128, 7140, 7152, 7163, 7175, 7187, 7200, 7212, 7224, 7235, 7248, 7260, 7272, 7285, 7297, 7309, 7321, 7333, 7345, 7358, 7370, 7382, 7394, 7406, 7419, 7431, 7443, 7455, 7468, 7480, 7492, 7505, 7517, 7530, 7542, 7554, 7566, 7578, 7591, 7603, 7615, 7628, 7640, 7653, 7666, 7677, 7690, 7702, 7714, 7727, 7738, 7750, 7762, 7775, 7786, 7799, 7812, 7823, 7836, 7848, 7859, 7871, 7884, 7896, 7909, 7921, 7933, 7946, 7958, 7971, 7984, 7996, 8007, 8019, 8032, 8044, 8056, 8069, 8081, 8094, 8107, 8119, 8131, 8143, 8155, 8167, 8179, 8192, 8205, 8218, 8230, 8244, 8255, 8267, 8279, 8291, 8303, 8315, 8328, 8340, 8353, 8366, 8378, 8392, 8404, 8417, 8431, 8443, 8455, 8467, 8479, 8492, 8504, 8516, 8529, 8543, 8555, 8567, 8580, 8593, 8606, 8619, 8632, 8644, 8658, 8670, 8683, 8695, 8708, 8721, 8733, 8746, 8759, 8771, 8783, 8795, 8808, 8821, 8833, 8845, 8858, 8871, 8885, 8898, 8910, 8923, 8936, 8949, 8960, 8973, 8986, 9000, 9012, 9025, 9038, 9051, 9064, 9076, 9089, 9102, 9114, 9126, 9139, 9151, 9164, 9177, 9191, 9204, 9217, 9230, 9243, 9255, 9268, 9281, 9294, 9307, 9320, 9333, 9345, 9358, 9371, 9384, 9398, 9412, 9424, 9437, 9450, 9462, 9475, 9488, 9501, 9514, 9528, 9542, 9554, 9567, 9581, 9593, 9606, 9619, 9632, 9645, 9658, 9671, 9682, 9695, 9708, 9721, 9735, 9749, 9762, 9776, 9789, 9802, 9815, 9828, 9842, 9855, 9867, 9880, 9893, 9906, 9920, 9933, 9947, 9960, 9974, 9987, 10000, 10014, 10027, 10040, 10054, 10067, 10081, 10095, 10107, 10120, 10134, 10148, 10161, 10175, 10188, 10201, 10214, 10228, 10241, 10254, 10267, 10280, 10294, 10309, 10322, 10335, 10348, 10362, 10374, 10387, 10401, 10415, 10428, 10441, 10455, 10469, 10482, 10497, 10510, 10523, 10537, 10551, 10565, 10579, 10593, 10606, 10621, 10634, 10647, 10661, 10675, 10689, 10704, 10719, 10732, 10746, 10760, 10774, 10788, 10802, 10815, 10829, 10843, 10856, 10871, 10884, 10898, 10913, 10927, 10940, 10955, 10970, 10984, 10999, 11013, 11027, 11042, 11056, 11071, 11086, 11100, 11114, 11128, 11142, 11158, 11171, 11186, 11200, 11213, 11228, 11241, 11255, 11270, 11284, 11299, 11314, 11328, 11342, 11356, 11370, 11385, 11399, 11413, 11429, 11445, 11460, 11474, 11489, 11503, 11518, 11533, 11549, 11563, 11577, 11592, 11607, 11621, 11637, 11651, 11665, 11680, 11694, 11708, 11725, 11740, 11754, 11768, 11784, 11798, 11813, 11828, 11843, 11858, 11874, 11888, 11904, 11920, 11933, 11948, 11964, 11979, 11993, 12009, 12024, 12041, 12058, 12071, 12087, 12102, 12117, 12132, 12148, 12165, 12179, 12195, 12210, 12226, 12241, 12256, 12273, 12288, 12304, 12320, 12335, 12350, 12365, 12382, 12398, 12414, 12430, 12446, 12462, 12478, 12495, 12511, 12525, 12541, 12556, 12575, 12591, 12605, 12622, 12638, 12653, 12671, 12686, 12705, 12721, 12739, 12756, 12772, 12788, 12806, 12822, 12839, 12855, 12873, 12890, 12908, 12923, 12941, 12960, 12975, 12992, 13009, 13024, 13040, 13059, 13076, 13092, 13109, 13128, 13145, 13161, 13179, 13194, 13216, 13233, 13249, 13266, 13287, 13303, 13322, 13337, 13357, 13375, 13392, 13410, 13424, 13446, 13465, 13480, 13499, 13517, 13533, 13559, 13575, 13595, 13612, 13632, 13650, 13670, 13687, 13706, 13726, 13744, 13765, 13783, 13803, 13822, 13841, 13860, 13879, 13897, 13917, 13936, 13960, 13979, 13996, 14019, 14040, 14057, 14077, 14102, 14122, 14141, 14163, 14184, 14202, 14225, 14244, 14265, 14287, 14312, 14336, 14356, 14375, 14393, 14420, 14438, 14465, 14483, 14500, 14536, 14555, 14575, 14604, 14619, 14648, 14668, 14691, 14725, 14748, 14770, 14788, 14818, 14840, 14862, 14888, 14921, 14939, 14969, 14996, 15022, 15051, 15075, 15098, 15130, 15149, 15167, 15218, 15237, 15276, 15297, 15333, 15356, 15379, 15418, 15447, 15481, 15508, 15530, 15574, 15599, 15643, 15680, 15697, 15743, 15759, 15775, 15813, 15845, 15877, 15911, 15931, 15968, 16014, 16049, 16077, 16088, 16138, 16149, 16185, 16200, 16241, 16280, 16296}; - public ABITracerTest() { - } + private ABITrace tracer = null; + //Test length of tracer for file 3730.ab1 + static final int EXPECTED_TRACE_LENGTH = 16302; - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Before - public void setUp() { + @BeforeEach + void setUp() throws Exception { + URL resource = this.getClass().getResource("/3730.ab1"); + assertNotNull(resource); + tracer = new ABITrace(resource); } - @After - public void tearDown() { + @AfterEach + void tearDown() { } /** @@ -68,9 +65,6 @@ public void tearDown() { */ @Test public void testURL() throws Exception { - URL resource = this.getClass().getResource("/3730.ab1"); - assertNotNull(resource); - ABITrace tracer = new ABITrace(resource); assertNotNull(tracer); } @@ -78,7 +72,7 @@ public void testURL() throws Exception { * Test of Local file method, of class ABITracer. */ @Test - public void testLocal() throws Exception { + void testLocal() throws Exception { URL resource = this.getClass().getResource("/3730.ab1"); assertNotNull(resource); File file = new File(resource.toURI()); @@ -86,8 +80,7 @@ public void testLocal() throws Exception { ABITrace tracer = new ABITrace(file); assertNotNull(tracer); - //Test length of tracer for file 3730.ab1 - final int EXPECTED_TRACE_LENGTH = 16302; + assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTraceLength()); //Test length of sequence for file 3730.ab1 assertEquals(1165, tracer.getSequenceLength()); @@ -102,9 +95,18 @@ public void testLocal() throws Exception { BufferedImage image = tracer.getImage(100,100); assertNotNull(image); - Assert.assertThrows(CompoundNotFoundException.class, ()->tracer.getTrace("D")); - for (String base: Arrays.asList(new String []{"A","T","C","G"})){ - assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTrace(base).length); - } + + } + + @DisplayName("getTrace rejects invalid bases") + @Test + void testGetTraceThrowsCNFE() throws Exception { + assertThrows(CompoundNotFoundException.class, ()->tracer.getTrace("D")); + } + + @ParameterizedTest + @ValueSource(strings = {"A","T","C", "G" }) + void testGetTrace(String base) throws Exception {; + assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTrace(base).length); } } diff --git a/pom.xml b/pom.xml index d5a7d30e65..3866c8753e 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,7 @@ 1.0.10 1.7.30 2.14.0 + 5.7.2 ciftools-java-jdk8 2.0.2 @@ -243,20 +244,8 @@ org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5 - - - true - true - true - true - - - true - true - true - - - + + org.apache.maven.plugins maven-shade-plugin @@ -419,23 +408,24 @@ test - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - - - org.junit.jupiter - junit-jupiter-api - 5.7.2 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.7.2 - test - + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + test + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-jupiter.version} + test + org.slf4j slf4j-api From 00bd3b2c610e60dded181e85a8781be588e7b991 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Sun, 4 Jul 2021 10:43:38 +0100 Subject: [PATCH 041/533] formatting --- .../nbio/core/sequence/io/ABITracerTest.java | 159 +++++++++++++++--- 1 file changed, 131 insertions(+), 28 deletions(-) diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java index dce9cc7b58..3024940a07 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java @@ -21,9 +21,8 @@ package org.biojava.nbio.core.sequence.io; - import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.*; import org.junit.jupiter.params.provider.ValueSource; import org.junit.jupiter.params.ParameterizedTest; @@ -35,31 +34,138 @@ import org.biojava.nbio.core.exceptions.CompoundNotFoundException; /** - * Test file 3730.ab1 is from https://github.com/biopython/biopython/blob/master/Tests/Abi/3730.ab1 - * The test data for comparing the results from ABITrace.java for file 3730.ab1 is from https://github.com/biopython/biopython/blob/master/Tests/Abi/test_data + * Test file 3730.ab1 is from https://github.com/biopython/biopython/blob/master/Tests/Abi/3730.ab1 The test data for + * comparing the results from ABITrace.java for file 3730.ab1 is from + * https://github.com/biopython/biopython/blob/master/Tests/Abi/test_data */ public class ABITracerTest { - private String sequence = "GGGCGAGCKYYAYATTTTGGCAAGAATTGAGCTCTATGGCCACAACCATGGTGAGCAAGGGCGAGGAGGATAACATGGCCATCATCAAGGAGTTCATGCGCTTCAAGGTGCACATGGAGGGCTCCGTGAACGGCCACGAGTTCGAGATCGAGGGCGAGGGCGAGGGCCGCCCCTACGAGGGCACCCAGACCGCCAAGCTGAAGGTGACCAAGGGTGGCCCCCTGCCCTTCGCCTGGGACATCCTGTCCCCTCAGTTCATGTACGGCTCCAAGGCCTACGTGAAGCACCCCGCCGACATCCCCGACTACTTGAAGCTGTCCTTCCCCGAGGGCTTCAAGTGGGAGCGCGTGATGAACTTCGAGGACGGCGGCGTGGTGACCGTGACCCAGGACTCCTCCCTGCAGGACGGCGAGTTCATCTACAAGGTGAAGCTGCGCGGCACCAACTTCCCCTCCGACGGCCCCGTAATGCAGAAGAAGACCATGGGCTGGGAGGCCTCCTCCGAGCGGATGTACCCCGAGGACGGCGCCCTGAAGGGCGAGATCAAGCAGAGGCTGAAGCTGAAGGACGGCGGCCACTACGACGCTGAGGTCAAGACCACCTACAAGGCCAAGAAGCCCGTGCAGCTGCCCGGCGCCTACAACGTCAACATCAAGTTGGACATCACCTCCCACAACGAGGACTACACCATCGTGGAACAGTACGAACGCGCCGAGGGCCGCCACTCCACCGGCGGCATGGACGAGCTGTACAAGGGCGGCAGCGGCATGGTGAGCAAGGGCGAGGAGCTGTTCACCGGGGTGGTGCCCATCCTGGTCGAGCTGGACGGCGACGTAAACGGCCACAAGTTCAGCGTGTCCGGCGAGGGCGAGGGCGATGCCACCTACGGCAAGCTGACCCTGAAGTTCATCTGCACCACCGGCAAGCTGCCCGTGCCCTGGCCCACCCTCGTGACCACCCTGACCTACGGCGTGCAGTGCTTCAGCCGCTACCCCGACCACATGAAGCAGCACGACTTCTTCAAGTCCGCCATGCCCGAAGGCTACGTCCAGGAGCGCACCATCTTCTTCAAGGACGACGGCAACTACAARACCCGCGCCGAGGTGAARTTCGAGGGCGACACCCTGGTGAACCGCATCGAGCTGAAAGGGGCAYCGCACCTTTC"; - private int[] qual = {20, 3, 4, 4, 4, 6, 4, 4, 0, 0, 0, 6, 0, 10, 20, 26, 22, 17, 21, 31, 29, 32, 28, 18, 23, 17, 19, 35, 36, 50, 39, 50, 50, 50, 50, 50, 25, 35, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 39, 33, 20, 35, 31, 50, 50, 50, 50, 50, 50, 50, 50, 50, 31, 50, 35, 31, 23, 28, 31, 21, 43, 39, 35, 24, 30, 26, 35, 31, 50, 50, 50, 50, 50, 50, 50, 50, 50, 39, 31, 24, 39, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 31, 31, 43, 43, 50, 50, 50, 50, 50, 31, 31, 31, 31, 50, 50, 50, 50, 50, 50, 50, 50, 31, 31, 35, 50, 50, 50, 50, 31, 36, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 43, 43, 50, 43, 43, 50, 43, 43, 50, 43, 43, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 43, 43, 50, 43, 43, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 21, 28, 35, 28, 28, 35, 35, 35, 35, 35, 37, 38, 21, 28, 35, 28, 28, 35, 35, 35, 35, 35, 35, 35, 36, 36, 21, 39, 35, 35, 35, 39, 35, 37, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 28, 28, 35, 35, 28, 28, 35, 35, 35, 36, 36, 22, 39, 35, 35, 35, 35, 35, 35, 37, 38, 28, 35, 21, 36, 36, 37, 35, 35, 20, 39, 39, 35, 35, 35, 35, 37, 38, 28, 35, 37, 34, 35, 24, 24, 27, 25, 20, 24, 37, 35, 27, 21, 20, 21, 27, 17, 20, 24, 32, 26, 20, 12, 20, 10, 20, 24, 25, 23, 20, 32, 24, 24, 23, 20, 24, 23, 18, 34, 34, 34, 22, 26, 24, 24, 18, 22, 22, 23, 25, 20, 12, 20, 24, 23, 24, 23, 22, 20, 20, 0, 20, 24, 23, 20, 8, 10, 4, 20, 20, 3, 7, 19, 20, 4, 4, 7, 7, 0, 7, 11, 18, 8, 3, 23, 23, 20, 11, 4, 20, 18, 12, 20, 20, 20, 4, 20, 4, 2, 3, 21, 21, 21, 21, 10, 15, 14, 15, 19, 2, 4, 3, 6, 11, 3, 4, 6, 21, 16, 20, 11, 1, 4, 12, 0, 15, 8, 1, 3, 3, 12, 1, 11, 20, 4}; - private int[] base = {2, 13, 38, 51, 67, 78, 92, 118, 138, 162, 181, 191, 210, 222, 239, 253, 266, 280, 288, 304, 317, 333, 347, 359, 375, 386, 394, 406, 418, 433, 444, 457, 472, 482, 496, 506, 519, 529, 544, 557, 569, 579, 590, 601, 614, 626, 638, 649, 663, 673, 686, 706, 715, 731, 740, 753, 765, 777, 787, 799, 813, 826, 838, 854, 863, 876, 892, 901, 913, 929, 937, 948, 960, 970, 981, 993, 1004, 1017, 1034, 1045, 1056, 1068, 1080, 1091, 1103, 1115, 1126, 1138, 1148, 1160, 1177, 1187, 1199, 1211, 1222, 1232, 1243, 1254, 1268, 1279, 1294, 1307, 1319, 1330, 1341, 1352, 1362, 1374, 1388, 1398, 1411, 1422, 1433, 1444, 1456, 1466, 1479, 1497, 1506, 1519, 1531, 1543, 1556, 1567, 1578, 1589, 1604, 1614, 1630, 1641, 1651, 1662, 1675, 1688, 1700, 1711, 1721, 1732, 1748, 1758, 1772, 1784, 1795, 1806, 1820, 1830, 1844, 1855, 1866, 1877, 1892, 1902, 1914, 1926, 1939, 1950, 1965, 1974, 1986, 1999, 2011, 2023, 2037, 2047, 2059, 2072, 2084, 2096, 2107, 2120, 2132, 2144, 2156, 2169, 2180, 2191, 2202, 2217, 2227, 2239, 2251, 2264, 2275, 2286, 2297, 2309, 2321, 2332, 2347, 2358, 2369, 2381, 2394, 2406, 2417, 2429, 2439, 2452, 2465, 2476, 2490, 2501, 2512, 2524, 2536, 2546, 2560, 2570, 2581, 2593, 2605, 2616, 2628, 2640, 2653, 2664, 2676, 2688, 2700, 2712, 2723, 2735, 2748, 2759, 2772, 2784, 2795, 2808, 2820, 2831, 2842, 2854, 2866, 2878, 2888, 2901, 2913, 2927, 2936, 2947, 2958, 2970, 2982, 2994, 3005, 3019, 3030, 3041, 3053, 3064, 3077, 3088, 3099, 3110, 3123, 3135, 3146, 3157, 3168, 3179, 3192, 3203, 3214, 3226, 3238, 3251, 3263, 3275, 3286, 3297, 3308, 3320, 3331, 3344, 3356, 3368, 3380, 3391, 3402, 3415, 3426, 3440, 3451, 3462, 3474, 3485, 3496, 3508, 3520, 3532, 3543, 3556, 3569, 3580, 3593, 3604, 3615, 3626, 3638, 3650, 3661, 3673, 3684, 3698, 3709, 3721, 3732, 3744, 3756, 3767, 3779, 3792, 3803, 3814, 3827, 3838, 3850, 3862, 3873, 3885, 3897, 3909, 3920, 3932, 3943, 3955, 3966, 3980, 3990, 4002, 4014, 4026, 4038, 4050, 4061, 4072, 4083, 4095, 4107, 4119, 4131, 4143, 4156, 4167, 4179, 4191, 4203, 4215, 4227, 4238, 4252, 4262, 4274, 4287, 4298, 4310, 4321, 4333, 4345, 4356, 4370, 4381, 4393, 4406, 4417, 4428, 4440, 4453, 4464, 4477, 4489, 4500, 4513, 4524, 4536, 4548, 4560, 4573, 4583, 4595, 4607, 4620, 4631, 4645, 4655, 4667, 4679, 4690, 4702, 4714, 4728, 4739, 4750, 4762, 4774, 4786, 4798, 4810, 4821, 4833, 4845, 4857, 4869, 4880, 4892, 4905, 4916, 4927, 4940, 4952, 4963, 4977, 4988, 5000, 5012, 5023, 5034, 5045, 5057, 5069, 5081, 5093, 5104, 5115, 5127, 5139, 5151, 5163, 5176, 5188, 5199, 5211, 5223, 5235, 5247, 5259, 5272, 5283, 5296, 5308, 5320, 5331, 5343, 5354, 5366, 5378, 5390, 5402, 5414, 5426, 5438, 5450, 5462, 5474, 5486, 5497, 5510, 5521, 5532, 5544, 5557, 5569, 5581, 5592, 5604, 5617, 5629, 5641, 5652, 5663, 5676, 5687, 5699, 5712, 5724, 5735, 5748, 5760, 5771, 5784, 5794, 5806, 5817, 5829, 5841, 5853, 5866, 5879, 5891, 5903, 5916, 5928, 5941, 5952, 5964, 5976, 5988, 6000, 6012, 6024, 6036, 6048, 6060, 6072, 6085, 6096, 6109, 6121, 6133, 6146, 6157, 6168, 6180, 6192, 6203, 6215, 6227, 6239, 6251, 6265, 6276, 6289, 6302, 6313, 6325, 6337, 6349, 6361, 6374, 6386, 6398, 6410, 6422, 6436, 6448, 6459, 6471, 6483, 6495, 6507, 6520, 6532, 6545, 6555, 6567, 6579, 6591, 6603, 6615, 6627, 6640, 6652, 6664, 6676, 6688, 6700, 6713, 6726, 6738, 6749, 6761, 6774, 6786, 6799, 6811, 6823, 6835, 6848, 6859, 6871, 6883, 6895, 6907, 6920, 6933, 6945, 6956, 6968, 6980, 6992, 7005, 7016, 7030, 7042, 7053, 7066, 7079, 7091, 7104, 7115, 7128, 7140, 7152, 7163, 7175, 7187, 7200, 7212, 7224, 7235, 7248, 7260, 7272, 7285, 7297, 7309, 7321, 7333, 7345, 7358, 7370, 7382, 7394, 7406, 7419, 7431, 7443, 7455, 7468, 7480, 7492, 7505, 7517, 7530, 7542, 7554, 7566, 7578, 7591, 7603, 7615, 7628, 7640, 7653, 7666, 7677, 7690, 7702, 7714, 7727, 7738, 7750, 7762, 7775, 7786, 7799, 7812, 7823, 7836, 7848, 7859, 7871, 7884, 7896, 7909, 7921, 7933, 7946, 7958, 7971, 7984, 7996, 8007, 8019, 8032, 8044, 8056, 8069, 8081, 8094, 8107, 8119, 8131, 8143, 8155, 8167, 8179, 8192, 8205, 8218, 8230, 8244, 8255, 8267, 8279, 8291, 8303, 8315, 8328, 8340, 8353, 8366, 8378, 8392, 8404, 8417, 8431, 8443, 8455, 8467, 8479, 8492, 8504, 8516, 8529, 8543, 8555, 8567, 8580, 8593, 8606, 8619, 8632, 8644, 8658, 8670, 8683, 8695, 8708, 8721, 8733, 8746, 8759, 8771, 8783, 8795, 8808, 8821, 8833, 8845, 8858, 8871, 8885, 8898, 8910, 8923, 8936, 8949, 8960, 8973, 8986, 9000, 9012, 9025, 9038, 9051, 9064, 9076, 9089, 9102, 9114, 9126, 9139, 9151, 9164, 9177, 9191, 9204, 9217, 9230, 9243, 9255, 9268, 9281, 9294, 9307, 9320, 9333, 9345, 9358, 9371, 9384, 9398, 9412, 9424, 9437, 9450, 9462, 9475, 9488, 9501, 9514, 9528, 9542, 9554, 9567, 9581, 9593, 9606, 9619, 9632, 9645, 9658, 9671, 9682, 9695, 9708, 9721, 9735, 9749, 9762, 9776, 9789, 9802, 9815, 9828, 9842, 9855, 9867, 9880, 9893, 9906, 9920, 9933, 9947, 9960, 9974, 9987, 10000, 10014, 10027, 10040, 10054, 10067, 10081, 10095, 10107, 10120, 10134, 10148, 10161, 10175, 10188, 10201, 10214, 10228, 10241, 10254, 10267, 10280, 10294, 10309, 10322, 10335, 10348, 10362, 10374, 10387, 10401, 10415, 10428, 10441, 10455, 10469, 10482, 10497, 10510, 10523, 10537, 10551, 10565, 10579, 10593, 10606, 10621, 10634, 10647, 10661, 10675, 10689, 10704, 10719, 10732, 10746, 10760, 10774, 10788, 10802, 10815, 10829, 10843, 10856, 10871, 10884, 10898, 10913, 10927, 10940, 10955, 10970, 10984, 10999, 11013, 11027, 11042, 11056, 11071, 11086, 11100, 11114, 11128, 11142, 11158, 11171, 11186, 11200, 11213, 11228, 11241, 11255, 11270, 11284, 11299, 11314, 11328, 11342, 11356, 11370, 11385, 11399, 11413, 11429, 11445, 11460, 11474, 11489, 11503, 11518, 11533, 11549, 11563, 11577, 11592, 11607, 11621, 11637, 11651, 11665, 11680, 11694, 11708, 11725, 11740, 11754, 11768, 11784, 11798, 11813, 11828, 11843, 11858, 11874, 11888, 11904, 11920, 11933, 11948, 11964, 11979, 11993, 12009, 12024, 12041, 12058, 12071, 12087, 12102, 12117, 12132, 12148, 12165, 12179, 12195, 12210, 12226, 12241, 12256, 12273, 12288, 12304, 12320, 12335, 12350, 12365, 12382, 12398, 12414, 12430, 12446, 12462, 12478, 12495, 12511, 12525, 12541, 12556, 12575, 12591, 12605, 12622, 12638, 12653, 12671, 12686, 12705, 12721, 12739, 12756, 12772, 12788, 12806, 12822, 12839, 12855, 12873, 12890, 12908, 12923, 12941, 12960, 12975, 12992, 13009, 13024, 13040, 13059, 13076, 13092, 13109, 13128, 13145, 13161, 13179, 13194, 13216, 13233, 13249, 13266, 13287, 13303, 13322, 13337, 13357, 13375, 13392, 13410, 13424, 13446, 13465, 13480, 13499, 13517, 13533, 13559, 13575, 13595, 13612, 13632, 13650, 13670, 13687, 13706, 13726, 13744, 13765, 13783, 13803, 13822, 13841, 13860, 13879, 13897, 13917, 13936, 13960, 13979, 13996, 14019, 14040, 14057, 14077, 14102, 14122, 14141, 14163, 14184, 14202, 14225, 14244, 14265, 14287, 14312, 14336, 14356, 14375, 14393, 14420, 14438, 14465, 14483, 14500, 14536, 14555, 14575, 14604, 14619, 14648, 14668, 14691, 14725, 14748, 14770, 14788, 14818, 14840, 14862, 14888, 14921, 14939, 14969, 14996, 15022, 15051, 15075, 15098, 15130, 15149, 15167, 15218, 15237, 15276, 15297, 15333, 15356, 15379, 15418, 15447, 15481, 15508, 15530, 15574, 15599, 15643, 15680, 15697, 15743, 15759, 15775, 15813, 15845, 15877, 15911, 15931, 15968, 16014, 16049, 16077, 16088, 16138, 16149, 16185, 16200, 16241, 16280, 16296}; + private int[] qual = { 20, 3, 4, 4, 4, 6, 4, 4, 0, 0, 0, 6, 0, 10, 20, 26, 22, 17, 21, 31, 29, 32, 28, 18, 23, 17, + 19, 35, 36, 50, 39, 50, 50, 50, 50, 50, 25, 35, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 39, 33, 20, 35, + 31, 50, 50, 50, 50, 50, 50, 50, 50, 50, 31, 50, 35, 31, 23, 28, 31, 21, 43, 39, 35, 24, 30, 26, 35, 31, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 39, 31, 24, 39, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 31, 31, 43, 43, 50, 50, 50, 50, 50, 31, 31, 31, 31, 50, 50, 50, 50, 50, + 50, 50, 50, 31, 31, 35, 50, 50, 50, 50, 31, 36, 55, 55, 55, 55, 36, 55, 55, 55, 55, 55, 36, 55, 55, 55, 55, + 55, 36, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 36, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 43, 43, 50, 43, 43, 50, 43, 43, 50, 43, 43, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 43, 43, 50, 43, 43, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, 28, 35, 28, + 21, 28, 35, 28, 28, 35, 35, 35, 35, 35, 37, 38, 21, 28, 35, 28, 28, 35, 35, 35, 35, 35, 35, 35, 36, 36, 21, + 39, 35, 35, 35, 39, 35, 37, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 28, 28, 35, 35, 28, 28, 35, 35, + 35, 36, 36, 22, 39, 35, 35, 35, 35, 35, 35, 37, 38, 28, 35, 21, 36, 36, 37, 35, 35, 20, 39, 39, 35, 35, 35, + 35, 37, 38, 28, 35, 37, 34, 35, 24, 24, 27, 25, 20, 24, 37, 35, 27, 21, 20, 21, 27, 17, 20, 24, 32, 26, 20, + 12, 20, 10, 20, 24, 25, 23, 20, 32, 24, 24, 23, 20, 24, 23, 18, 34, 34, 34, 22, 26, 24, 24, 18, 22, 22, 23, + 25, 20, 12, 20, 24, 23, 24, 23, 22, 20, 20, 0, 20, 24, 23, 20, 8, 10, 4, 20, 20, 3, 7, 19, 20, 4, 4, 7, 7, + 0, 7, 11, 18, 8, 3, 23, 23, 20, 11, 4, 20, 18, 12, 20, 20, 20, 4, 20, 4, 2, 3, 21, 21, 21, 21, 10, 15, 14, + 15, 19, 2, 4, 3, 6, 11, 3, 4, 6, 21, 16, 20, 11, 1, 4, 12, 0, 15, 8, 1, 3, 3, 12, 1, 11, 20, 4 }; + private int[] base = { 2, 13, 38, 51, 67, 78, 92, 118, 138, 162, 181, 191, 210, 222, 239, 253, 266, 280, 288, 304, + 317, 333, 347, 359, 375, 386, 394, 406, 418, 433, 444, 457, 472, 482, 496, 506, 519, 529, 544, 557, 569, + 579, 590, 601, 614, 626, 638, 649, 663, 673, 686, 706, 715, 731, 740, 753, 765, 777, 787, 799, 813, 826, + 838, 854, 863, 876, 892, 901, 913, 929, 937, 948, 960, 970, 981, 993, 1004, 1017, 1034, 1045, 1056, 1068, + 1080, 1091, 1103, 1115, 1126, 1138, 1148, 1160, 1177, 1187, 1199, 1211, 1222, 1232, 1243, 1254, 1268, 1279, + 1294, 1307, 1319, 1330, 1341, 1352, 1362, 1374, 1388, 1398, 1411, 1422, 1433, 1444, 1456, 1466, 1479, 1497, + 1506, 1519, 1531, 1543, 1556, 1567, 1578, 1589, 1604, 1614, 1630, 1641, 1651, 1662, 1675, 1688, 1700, 1711, + 1721, 1732, 1748, 1758, 1772, 1784, 1795, 1806, 1820, 1830, 1844, 1855, 1866, 1877, 1892, 1902, 1914, 1926, + 1939, 1950, 1965, 1974, 1986, 1999, 2011, 2023, 2037, 2047, 2059, 2072, 2084, 2096, 2107, 2120, 2132, 2144, + 2156, 2169, 2180, 2191, 2202, 2217, 2227, 2239, 2251, 2264, 2275, 2286, 2297, 2309, 2321, 2332, 2347, 2358, + 2369, 2381, 2394, 2406, 2417, 2429, 2439, 2452, 2465, 2476, 2490, 2501, 2512, 2524, 2536, 2546, 2560, 2570, + 2581, 2593, 2605, 2616, 2628, 2640, 2653, 2664, 2676, 2688, 2700, 2712, 2723, 2735, 2748, 2759, 2772, 2784, + 2795, 2808, 2820, 2831, 2842, 2854, 2866, 2878, 2888, 2901, 2913, 2927, 2936, 2947, 2958, 2970, 2982, 2994, + 3005, 3019, 3030, 3041, 3053, 3064, 3077, 3088, 3099, 3110, 3123, 3135, 3146, 3157, 3168, 3179, 3192, 3203, + 3214, 3226, 3238, 3251, 3263, 3275, 3286, 3297, 3308, 3320, 3331, 3344, 3356, 3368, 3380, 3391, 3402, 3415, + 3426, 3440, 3451, 3462, 3474, 3485, 3496, 3508, 3520, 3532, 3543, 3556, 3569, 3580, 3593, 3604, 3615, 3626, + 3638, 3650, 3661, 3673, 3684, 3698, 3709, 3721, 3732, 3744, 3756, 3767, 3779, 3792, 3803, 3814, 3827, 3838, + 3850, 3862, 3873, 3885, 3897, 3909, 3920, 3932, 3943, 3955, 3966, 3980, 3990, 4002, 4014, 4026, 4038, 4050, + 4061, 4072, 4083, 4095, 4107, 4119, 4131, 4143, 4156, 4167, 4179, 4191, 4203, 4215, 4227, 4238, 4252, 4262, + 4274, 4287, 4298, 4310, 4321, 4333, 4345, 4356, 4370, 4381, 4393, 4406, 4417, 4428, 4440, 4453, 4464, 4477, + 4489, 4500, 4513, 4524, 4536, 4548, 4560, 4573, 4583, 4595, 4607, 4620, 4631, 4645, 4655, 4667, 4679, 4690, + 4702, 4714, 4728, 4739, 4750, 4762, 4774, 4786, 4798, 4810, 4821, 4833, 4845, 4857, 4869, 4880, 4892, 4905, + 4916, 4927, 4940, 4952, 4963, 4977, 4988, 5000, 5012, 5023, 5034, 5045, 5057, 5069, 5081, 5093, 5104, 5115, + 5127, 5139, 5151, 5163, 5176, 5188, 5199, 5211, 5223, 5235, 5247, 5259, 5272, 5283, 5296, 5308, 5320, 5331, + 5343, 5354, 5366, 5378, 5390, 5402, 5414, 5426, 5438, 5450, 5462, 5474, 5486, 5497, 5510, 5521, 5532, 5544, + 5557, 5569, 5581, 5592, 5604, 5617, 5629, 5641, 5652, 5663, 5676, 5687, 5699, 5712, 5724, 5735, 5748, 5760, + 5771, 5784, 5794, 5806, 5817, 5829, 5841, 5853, 5866, 5879, 5891, 5903, 5916, 5928, 5941, 5952, 5964, 5976, + 5988, 6000, 6012, 6024, 6036, 6048, 6060, 6072, 6085, 6096, 6109, 6121, 6133, 6146, 6157, 6168, 6180, 6192, + 6203, 6215, 6227, 6239, 6251, 6265, 6276, 6289, 6302, 6313, 6325, 6337, 6349, 6361, 6374, 6386, 6398, 6410, + 6422, 6436, 6448, 6459, 6471, 6483, 6495, 6507, 6520, 6532, 6545, 6555, 6567, 6579, 6591, 6603, 6615, 6627, + 6640, 6652, 6664, 6676, 6688, 6700, 6713, 6726, 6738, 6749, 6761, 6774, 6786, 6799, 6811, 6823, 6835, 6848, + 6859, 6871, 6883, 6895, 6907, 6920, 6933, 6945, 6956, 6968, 6980, 6992, 7005, 7016, 7030, 7042, 7053, 7066, + 7079, 7091, 7104, 7115, 7128, 7140, 7152, 7163, 7175, 7187, 7200, 7212, 7224, 7235, 7248, 7260, 7272, 7285, + 7297, 7309, 7321, 7333, 7345, 7358, 7370, 7382, 7394, 7406, 7419, 7431, 7443, 7455, 7468, 7480, 7492, 7505, + 7517, 7530, 7542, 7554, 7566, 7578, 7591, 7603, 7615, 7628, 7640, 7653, 7666, 7677, 7690, 7702, 7714, 7727, + 7738, 7750, 7762, 7775, 7786, 7799, 7812, 7823, 7836, 7848, 7859, 7871, 7884, 7896, 7909, 7921, 7933, 7946, + 7958, 7971, 7984, 7996, 8007, 8019, 8032, 8044, 8056, 8069, 8081, 8094, 8107, 8119, 8131, 8143, 8155, 8167, + 8179, 8192, 8205, 8218, 8230, 8244, 8255, 8267, 8279, 8291, 8303, 8315, 8328, 8340, 8353, 8366, 8378, 8392, + 8404, 8417, 8431, 8443, 8455, 8467, 8479, 8492, 8504, 8516, 8529, 8543, 8555, 8567, 8580, 8593, 8606, 8619, + 8632, 8644, 8658, 8670, 8683, 8695, 8708, 8721, 8733, 8746, 8759, 8771, 8783, 8795, 8808, 8821, 8833, 8845, + 8858, 8871, 8885, 8898, 8910, 8923, 8936, 8949, 8960, 8973, 8986, 9000, 9012, 9025, 9038, 9051, 9064, 9076, + 9089, 9102, 9114, 9126, 9139, 9151, 9164, 9177, 9191, 9204, 9217, 9230, 9243, 9255, 9268, 9281, 9294, 9307, + 9320, 9333, 9345, 9358, 9371, 9384, 9398, 9412, 9424, 9437, 9450, 9462, 9475, 9488, 9501, 9514, 9528, 9542, + 9554, 9567, 9581, 9593, 9606, 9619, 9632, 9645, 9658, 9671, 9682, 9695, 9708, 9721, 9735, 9749, 9762, 9776, + 9789, 9802, 9815, 9828, 9842, 9855, 9867, 9880, 9893, 9906, 9920, 9933, 9947, 9960, 9974, 9987, 10000, + 10014, 10027, 10040, 10054, 10067, 10081, 10095, 10107, 10120, 10134, 10148, 10161, 10175, 10188, 10201, + 10214, 10228, 10241, 10254, 10267, 10280, 10294, 10309, 10322, 10335, 10348, 10362, 10374, 10387, 10401, + 10415, 10428, 10441, 10455, 10469, 10482, 10497, 10510, 10523, 10537, 10551, 10565, 10579, 10593, 10606, + 10621, 10634, 10647, 10661, 10675, 10689, 10704, 10719, 10732, 10746, 10760, 10774, 10788, 10802, 10815, + 10829, 10843, 10856, 10871, 10884, 10898, 10913, 10927, 10940, 10955, 10970, 10984, 10999, 11013, 11027, + 11042, 11056, 11071, 11086, 11100, 11114, 11128, 11142, 11158, 11171, 11186, 11200, 11213, 11228, 11241, + 11255, 11270, 11284, 11299, 11314, 11328, 11342, 11356, 11370, 11385, 11399, 11413, 11429, 11445, 11460, + 11474, 11489, 11503, 11518, 11533, 11549, 11563, 11577, 11592, 11607, 11621, 11637, 11651, 11665, 11680, + 11694, 11708, 11725, 11740, 11754, 11768, 11784, 11798, 11813, 11828, 11843, 11858, 11874, 11888, 11904, + 11920, 11933, 11948, 11964, 11979, 11993, 12009, 12024, 12041, 12058, 12071, 12087, 12102, 12117, 12132, + 12148, 12165, 12179, 12195, 12210, 12226, 12241, 12256, 12273, 12288, 12304, 12320, 12335, 12350, 12365, + 12382, 12398, 12414, 12430, 12446, 12462, 12478, 12495, 12511, 12525, 12541, 12556, 12575, 12591, 12605, + 12622, 12638, 12653, 12671, 12686, 12705, 12721, 12739, 12756, 12772, 12788, 12806, 12822, 12839, 12855, + 12873, 12890, 12908, 12923, 12941, 12960, 12975, 12992, 13009, 13024, 13040, 13059, 13076, 13092, 13109, + 13128, 13145, 13161, 13179, 13194, 13216, 13233, 13249, 13266, 13287, 13303, 13322, 13337, 13357, 13375, + 13392, 13410, 13424, 13446, 13465, 13480, 13499, 13517, 13533, 13559, 13575, 13595, 13612, 13632, 13650, + 13670, 13687, 13706, 13726, 13744, 13765, 13783, 13803, 13822, 13841, 13860, 13879, 13897, 13917, 13936, + 13960, 13979, 13996, 14019, 14040, 14057, 14077, 14102, 14122, 14141, 14163, 14184, 14202, 14225, 14244, + 14265, 14287, 14312, 14336, 14356, 14375, 14393, 14420, 14438, 14465, 14483, 14500, 14536, 14555, 14575, + 14604, 14619, 14648, 14668, 14691, 14725, 14748, 14770, 14788, 14818, 14840, 14862, 14888, 14921, 14939, + 14969, 14996, 15022, 15051, 15075, 15098, 15130, 15149, 15167, 15218, 15237, 15276, 15297, 15333, 15356, + 15379, 15418, 15447, 15481, 15508, 15530, 15574, 15599, 15643, 15680, 15697, 15743, 15759, 15775, 15813, + 15845, 15877, 15911, 15931, 15968, 16014, 16049, 16077, 16088, 16138, 16149, 16185, 16200, 16241, 16280, + 16296 }; private ABITrace tracer = null; - //Test length of tracer for file 3730.ab1 + + // Test length of tracer for file 3730.ab1 static final int EXPECTED_TRACE_LENGTH = 16302; @BeforeEach - void setUp() throws Exception { + void setUp() throws Exception { URL resource = this.getClass().getResource("/3730.ab1"); assertNotNull(resource); tracer = new ABITrace(resource); } - @AfterEach - void tearDown() { - } - /** * Test of URL method, of class ABITracer. */ @@ -72,41 +178,38 @@ public void testURL() throws Exception { * Test of Local file method, of class ABITracer. */ @Test - void testLocal() throws Exception { + void testLocal() throws Exception { URL resource = this.getClass().getResource("/3730.ab1"); - assertNotNull(resource); File file = new File(resource.toURI()); assertNotNull(file); ABITrace tracer = new ABITrace(file); assertNotNull(tracer); - assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTraceLength()); - //Test length of sequence for file 3730.ab1 + // Test length of sequence for file 3730.ab1 assertEquals(1165, tracer.getSequenceLength()); - //Test sequence of tracer for file 3730.ab1 + // Test sequence of tracer for file 3730.ab1 assertTrue(sequence.equals(tracer.getSequence().getSequenceAsString())); - //Test array that represents the quality of tracer for file 3730.ab1 + // Test array that represents the quality of tracer for file 3730.ab1 assertArrayEquals(qual, tracer.getQcalls()); - //Test array that represents the baseline of tracer for file 3730.ab1 + // Test array that represents the baseline of tracer for file 3730.ab1 assertArrayEquals(base, tracer.getBasecalls()); - //Test image of tracer for file 3730.ab1 - BufferedImage image = tracer.getImage(100,100); + // Test image of tracer for file 3730.ab1 + BufferedImage image = tracer.getImage(100, 100); assertNotNull(image); - - } @DisplayName("getTrace rejects invalid bases") @Test void testGetTraceThrowsCNFE() throws Exception { - assertThrows(CompoundNotFoundException.class, ()->tracer.getTrace("D")); + assertThrows(CompoundNotFoundException.class, () -> tracer.getTrace("D")); } - @ParameterizedTest - @ValueSource(strings = {"A","T","C", "G" }) - void testGetTrace(String base) throws Exception {; + @DisplayName("Traces are equal length for 4 nucleotides") + @ParameterizedTest(name="Base: {0}") + @ValueSource(strings = { "A", "T", "C", "G" }) + void testGetTrace(String base) throws Exception { assertEquals(EXPECTED_TRACE_LENGTH, tracer.getTrace(base).length); } } From 3669911f7f109833607be9b09691fa104e9197b2 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Sun, 4 Jul 2021 10:56:56 +0100 Subject: [PATCH 042/533] more formatting --- .../nbio/core/TestAmbiguityCompoundSet.java | 6 ++---- .../nbio/core/sequence/io/ABITracerTest.java | 15 ++++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java b/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java index 9fad78d7b0..714f418280 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java @@ -20,7 +20,8 @@ */ package org.biojava.nbio.core; -import org.biojava.nbio.core.exceptions.CompoundNotFoundException; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.biojava.nbio.core.sequence.DNASequence; import org.biojava.nbio.core.sequence.RNASequence; import org.biojava.nbio.core.sequence.compound.AmbiguityDNACompoundSet; @@ -31,9 +32,6 @@ import org.biojava.nbio.core.sequence.template.Sequence; import org.biojava.nbio.core.sequence.transcription.DNAToRNATranslator; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.DisplayName; - -import static org.junit.jupiter.api.Assertions.assertEquals; /** * A Test case for https://github.com/biojava/biojava/issues/344 diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java index 3024940a07..be87905e04 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java @@ -21,17 +21,22 @@ package org.biojava.nbio.core.sequence.io; -import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.*; -import org.junit.jupiter.params.provider.ValueSource; -import org.junit.jupiter.params.ParameterizedTest; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.awt.image.BufferedImage; import java.io.File; import java.net.URL; -import java.util.Arrays; import org.biojava.nbio.core.exceptions.CompoundNotFoundException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; /** * Test file 3730.ab1 is from https://github.com/biopython/biopython/blob/master/Tests/Abi/3730.ab1 The test data for From 704bda6c582d049dab109586fe0949e7b8e63ab2 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Sun, 4 Jul 2021 11:32:26 +0100 Subject: [PATCH 043/533] update junit3->junit4 test, remove doc references to ju3 --- .../nbio/structure/test/TestSECalignment.java | 16 +++++++++++----- .../test/align/ce/OptimalCECPMainTest.java | 8 +------- .../org/biojava/nbio/structure/ElementTest.java | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/TestSECalignment.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/TestSECalignment.java index 6a9516251b..b8ec8ed89c 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/TestSECalignment.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/TestSECalignment.java @@ -22,7 +22,14 @@ */ package org.biojava.nbio.structure.test; -import junit.framework.TestCase; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.InputStream; + +import org.biojava.nbio.core.util.StringManipulationHelper; import org.biojava.nbio.structure.Atom; import org.biojava.nbio.structure.align.StructureAlignment; import org.biojava.nbio.structure.align.StructureAlignmentFactory; @@ -33,9 +40,7 @@ import org.biojava.nbio.structure.align.xml.AFPChainXMLParser; import org.biojava.nbio.structure.test.align.fatcat.FlipAFPChainTest; import org.biojava.nbio.structure.test.util.StringManipulationTestsHelper; -import org.biojava.nbio.core.util.StringManipulationHelper; - -import java.io.InputStream; +import org.junit.Test; /** This test makes sure that the new representation of selenocysteins as SEC amino acids does not * affect the structure alignment results. @@ -43,8 +48,9 @@ * @author andreas * */ -public class TestSECalignment extends TestCase { +public class TestSECalignment { + @Test public void testOldSecOutput() throws Exception { String fileName = "/ce_1fdo.A_2iv2.X.out"; diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/ce/OptimalCECPMainTest.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/ce/OptimalCECPMainTest.java index bf7ee56be4..81eb35c9b9 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/ce/OptimalCECPMainTest.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/ce/OptimalCECPMainTest.java @@ -46,13 +46,7 @@ public class OptimalCECPMainTest { private AtomCache cache = new AtomCache(); - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ - @Before - public void setUp() throws Exception { - } - + /** * Basic test that alignPermuted(..., 0) is equivalent to a normal CE alignment. * diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/ElementTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/ElementTest.java index 81ce22d087..7dd8cda993 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/ElementTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/ElementTest.java @@ -21,7 +21,7 @@ package org.biojava.nbio.structure; -import junit.framework.TestCase; + import org.junit.Assert; import org.junit.Test; From 3cc243e6660acc3d0ca98320d1863a58841c04ca Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Fri, 9 Jul 2021 18:34:48 +0100 Subject: [PATCH 044/533] example of new nested test, with bug in SequenceTools#permuteCyclic detected and fixed --- .../biojava/nbio/core/util/SequenceTools.java | 15 ++++ .../nbio/core/util/SequenceToolsTest.java | 74 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java index f23d4e7417..2dd32af6c9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java @@ -50,6 +50,21 @@ public static String permuteCyclic(String string, int n) { return String.valueOf(p); } + /** + * Improved implementation that is generally 10-100x faster, and fixes some edge-case bugs. + * @param string The string to permute + * @param n The number of characters to permute by; can be positive or negative; values greater than the length of the array are acceptable + * @return + */ + public static String permuteCyclic2(String string, int n) { + String toMutate = string + string; + n = n % string.length(); + if (n < 0) { + n = string.length() + n; + } + return toMutate.substring(n, n + string.length()); + } + /** * Cyclically permute {@code array} forward by {@code n} elements. * @param array The original result; will not be changed diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java new file mode 100644 index 0000000000..819c40e9b0 --- /dev/null +++ b/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java @@ -0,0 +1,74 @@ +package org.biojava.nbio.core.util; + +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Random; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +class SequenceToolsTest { + + String randomDNA(int n) { + String[] nucs = new String[] { "A", "T", "C", "G" }; + Random r = new Random(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < n; i++) { + sb.append(nucs[r.nextInt(4)]); + } + return sb.toString(); + } + + @Nested + class PermuteCyclic { + + @ParameterizedTest + @CsvSource(value = { "ATCGT,1,TCGTA", "ATCGT,-1,TATCG", "ATCGT,0,ATCGT", "ATCGT,25,ATCGT","12345,1,23451" }) + void permuteCyclicBasic(String original, int n, String expected) { + assertEquals(expected, SequenceTools.permuteCyclic(original, n)); + } + + @ParameterizedTest + @CsvSource(value = { "ATCGT,CGTAT", "ATCGT,CGTAT" }) + @Disabled("fails with current implementation") + void permuteCycleIntMaxMin(String original, String expected) { + assertAll( + ()->assertEquals(expected, SequenceTools.permuteCyclic(original, Integer.MAX_VALUE)), + ()->assertEquals(expected, SequenceTools.permuteCyclic(original, Integer.MIN_VALUE)) + ); + } + + @ParameterizedTest + @CsvSource(value = { "ATCGT,CGTAT", "ATCGT,CGTAT" }) + @DisplayName("Edge case fixed") + void permuteCycleIntMaxMin2(String original, String expected) { + assertAll( + ()->assertEquals(expected, SequenceTools.permuteCyclic2(original, Integer.MAX_VALUE)), + ()->assertEquals(expected, SequenceTools.permuteCyclic2(original, Integer.MIN_VALUE)) + ); + } + + @Test + void permuteCyclicPerformance() { + String dna = randomDNA(10_000_000); + long start = System.currentTimeMillis(); + String rotated = SequenceTools.permuteCyclic(dna, 5_000_000); + long end = System.currentTimeMillis(); + System.err.println(end-start); + + long start2 = System.currentTimeMillis(); + String rotated2 = SequenceTools.permuteCyclic2(dna, 5_000_000); + long end2 = System.currentTimeMillis(); + System.err.println(end2-start2); + assertTrue((end-start)/(end2-start2) > 5); + } + + } + +} From 43fafd0a40a523422c1f8d16d7a2a0b504881a01 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Sat, 10 Jul 2021 21:41:39 +0100 Subject: [PATCH 045/533] add tests for other SequenceToolsMethods --- .gitignore | 1 + .../biojava/nbio/core/util/SequenceTools.java | 18 ++++ .../nbio/core/util/SequenceToolsTest.java | 95 +++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/.gitignore b/.gitignore index 4c968aac08..89345576ab 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .profile .settings .classpath +.factorypath .DS_Store .idea *.iml diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java index 2dd32af6c9..61f7e44135 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java @@ -119,6 +119,23 @@ public static boolean isNucleotideSequence(String sequence) return true; } + /** + * Attempts to parse String as a DNA sequence first.
+ * If this fails it tries to parse as a ProteinSequence. + *
+ * This method does not attempt to create an RNASequence. + *

+ * Also, a sequence such as 'ATCGTA' which is both a + * peptide sequence and a DNA sequence, will always be returned + * as a DNA sequence. + *

+ *

+ * An empty string argument returns a ProteinSequence of length 0. + * A null argument throws a {@link NullPointerException} + * @param sequence + * @return Either a DNASequence or a ProteinSequence + * @throws CompoundNotFoundException + */ public Sequence getSequenceFromString(String sequence) throws CompoundNotFoundException { @@ -126,6 +143,7 @@ public Sequence getSequenceFromString(String sequence) throws CompoundNotFoun return new DNASequence(sequence); } else { return new ProteinSequence(sequence); + } } diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java index 819c40e9b0..420e574c28 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/util/SequenceToolsTest.java @@ -1,17 +1,25 @@ package org.biojava.nbio.core.util; +import static org.junit.Assert.assertThrows; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Random; +import org.biojava.nbio.core.exceptions.CompoundNotFoundException; +import org.biojava.nbio.core.sequence.ProteinSequence; +import org.biojava.nbio.core.sequence.template.Sequence; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.EmptySource; +import org.junit.jupiter.params.provider.NullAndEmptySource; +import org.junit.jupiter.params.provider.NullSource; class SequenceToolsTest { @@ -68,7 +76,94 @@ void permuteCyclicPerformance() { System.err.println(end2-start2); assertTrue((end-start)/(end2-start2) > 5); } + } + + @Nested + class PercentNucleotideContent { + + @ParameterizedTest + @NullAndEmptySource + @DisplayName("percent nucleotide sequence returns 0 for null "+ + "or empty string") + void nucleotideContentInvalidValues(String empty){ + assertEquals(0, SequenceTools.percentNucleotideSequence(empty)); + } + + @Test + void nucleotideContentTest(){ + assertEquals(100, SequenceTools.percentNucleotideSequence("ATCGCAA")); + assertEquals(100, SequenceTools.percentNucleotideSequence("UUACG")); + assertEquals(100, SequenceTools.percentNucleotideSequence(randomDNA(1_000_000))); + assertEquals(50, SequenceTools.percentNucleotideSequence("123CCG")); + assertEquals(66, SequenceTools.percentNucleotideSequence("12TTAC")); assertEquals(0, SequenceTools.percentNucleotideSequence(" HH")); + assertEquals(0, SequenceTools.percentNucleotideSequence("actg")); + } + + @Test + void isNucleotideSequence () { + assertTrue(SequenceTools.isNucleotideSequence("AACGAA")); + assertFalse(SequenceTools.isNucleotideSequence("aacgaa")); + assertFalse(SequenceTools.isNucleotideSequence(" HH")); + } + @ParameterizedTest + @NullAndEmptySource + @DisplayName("isNucleotide is false for null "+ + "or empty string") + void isnucleotideInvalidValues(String empty){ + assertFalse(SequenceTools.isNucleotideSequence(empty)); + } } + @Nested + @DisplayName("SequenceFromString") + class SequenceFromString{ + SequenceTools tools = new SequenceTools(); + @Test + void acceptsUpperCaseDNA() throws CompoundNotFoundException { + Sequencenuc = tools.getSequenceFromString("ATCG"); + assertEquals(4, nuc.getLength()); + } + + @Test + void acceptsLowerCaseDNA() throws CompoundNotFoundException { + Sequencenuc = tools.getSequenceFromString("atcg"); + assertEquals(4, nuc.getLength()); + } + + @Test + void rejectsRNA()throws CompoundNotFoundException { + assertThrows(CompoundNotFoundException.class, + ()->tools.getSequenceFromString("AUCG")); + } + + @Test + void acceptsSingleLetterProtein()throws CompoundNotFoundException { + Sequence protein = tools.getSequenceFromString("HYDESS"); + assertEquals(6, protein.getLength()); + } + + @Test + void interpets3LetterAACodeAsSingleLetter()throws CompoundNotFoundException { + Sequence protein = tools.getSequenceFromString("AlaGlySer"); + assertEquals(9, protein.getLength()); + } + + @EmptySource + @ParameterizedTest + @DisplayName("empty string return 0-length protein sequence") + void emptyString(String empty) throws CompoundNotFoundException{ + Sequence protein = tools.getSequenceFromString(empty); + assertEquals(0, protein.getLength()); + assertTrue(protein instanceof ProteinSequence); + } + + @NullSource + @ParameterizedTest + @DisplayName("null string throws NPE") + void nullString(String nullStr) throws CompoundNotFoundException{ + assertThrows(NullPointerException.class, + ()-> tools.getSequenceFromString(nullStr)); + } + } } From 190b55fc016fe78a9d0d11295e2fbe03d5e146c9 Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Wed, 21 Jul 2021 23:08:28 +0100 Subject: [PATCH 046/533] padleft/right tests --- .../core/util/StringManipulationHelper.java | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java index f8aef6b35e..ca7edcb3b2 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java @@ -23,6 +23,19 @@ */ package org.biojava.nbio.core.util; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.AbstractCollection; +import java.util.Iterator; +import java.util.Scanner; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -31,14 +44,6 @@ import org.w3c.dom.Node; import org.xml.sax.SAXException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.io.*; -import java.util.AbstractCollection; -import java.util.Iterator; -import java.util.Scanner; - /** * A utility class for common {@link String} manipulation tasks. @@ -62,10 +67,6 @@ private StringManipulationHelper() { // to prevent instantiation } - - - - /** * @author andreas * @param stream @@ -174,14 +175,36 @@ public static boolean equalsToXml(String expected, String actual) { throw new UnsupportedOperationException("not yet implemented"); } + /** + * Adds padding to left of supplied string + * @param s The String to pad + * @param n an integer >= 1 + * @return The left-padded string. + * @throws IllegalArgumentException if n <= 0 + */ public static String padLeft(String s, int n) { + validatePadding(n); return String.format("%1$" + n + "s", s); } + /** + * Adds padding to right of supplied string + * @param s The String to pad + * @param n an integer >= 1 + * @return The right-padded string. + * @throws IllegalArgumentException if n <= 0 + */ public static String padRight(String s, int n) { + validatePadding(n); return String.format("%1$-" + n + "s", s); } + private static void validatePadding(int n) { + if (n <=0 ) { + throw new IllegalArgumentException("padding must be >= 1"); + } + } + public static String join(AbstractCollection s, String delimiter) { if (s == null || s.isEmpty()) return ""; Iterator iter = s.iterator(); From fda5184389db3e05b9d825e03ab0049b958af60a Mon Sep 17 00:00:00 2001 From: Richard Adams Date: Thu, 22 Jul 2021 09:12:01 +0100 Subject: [PATCH 047/533] tests and docs for convertStreamToString --- .../core/util/StringManipulationHelper.java | 22 +++-- .../util/StringManipulationHelperTest.java | 83 +++++++++++++++++++ 2 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 biojava-core/src/test/java/org/biojava/nbio/core/util/StringManipulationHelperTest.java diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java index ca7edcb3b2..88f100b4d2 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java @@ -68,9 +68,18 @@ private StringManipulationHelper() { } /** + * Converts an InputStream of text to a String, closing the stream + * before returning. + *