Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions biojava-genome/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
</dependency>
<dependency>
<groupId>org.biojava</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
import org.biojava.nbio.genome.parsers.gff.Feature;
import org.biojava.nbio.genome.parsers.gff.FeatureList;
import org.biojava.nbio.genome.parsers.gff.Location;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* @author mckeee1
*
*/
public class FeatureListTest {
class FeatureListTest {
@Test
public void testAddIndex() throws Exception
void testAddIndex() throws Exception
{
FeatureList fl = new FeatureList();
fl.add(new Feature("seqname", "source", "type", new Location(1, 2), (double)0, 0, "gene_id \"gene_id_1\"; transcript_id \"transcript_id_1\";"));
fl.addIndex("transcript_id");
Assert.assertEquals(1, fl.selectByAttribute("transcript_id").size());
Assertions.assertEquals(1, fl.selectByAttribute("transcript_id").size());


FeatureList f2 = new FeatureList();
f2.addIndex("transcript_id");
f2.add(new Feature("seqname", "source", "type", new Location(1, 2), (double)0, 0, "gene_id \"gene_id_1\"; transcript_id \"transcript_id_1\";"));
Assert.assertEquals(1, f2.selectByAttribute("transcript_id").size());
Assertions.assertEquals(1, f2.selectByAttribute("transcript_id").size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import org.biojava.nbio.core.sequence.GeneSequence;
import org.biojava.nbio.core.sequence.ProteinSequence;
import org.biojava.nbio.core.sequence.io.FastaWriterHelper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -45,20 +45,20 @@
*
* @author Scooter Willis
*/
public class GeneFeatureHelperTest {
class GeneFeatureHelperTest {

private static final Logger logger = LoggerFactory.getLogger(GeneFeatureHelperTest.class);

@Before
@BeforeEach
public void setUp() throws Exception {
}

@After
@AfterEach
public void tearDown() throws Exception {
}

@Test
public void testZeroLocation() throws Exception {
void testZeroLocation() throws Exception {

@SuppressWarnings("unused")
FeatureList listGenes = GFF3Reader.read("src/test/resources/amphimedon.gff3");
Expand All @@ -71,7 +71,7 @@ public void testZeroLocation() throws Exception {
*/

@Test
public void testLoadFastaAddGeneFeaturesFromUpperCaseExonFastaFile() throws Exception {
void testLoadFastaAddGeneFeaturesFromUpperCaseExonFastaFile() throws Exception {
// logger.info("loadFastaAddGeneFeaturesFromUpperCaseExonFastaFile");
File fastaSequenceFile = new File("src/test/resources/volvox_all.fna");
File uppercaseFastaFile = new File("src/test/resources/volvox_all_genes_exon_uppercase.fna");
Expand All @@ -93,7 +93,7 @@ public void testLoadFastaAddGeneFeaturesFromUpperCaseExonFastaFile() throws Exce
* Test of outputFastaSequenceLengthGFF3 method, of class GeneFeatureHelper.
*/
@Test
public void testOutputFastaSequenceLengthGFF3() throws Exception {
void testOutputFastaSequenceLengthGFF3() throws Exception {
// logger.info("outputFastaSequenceLengthGFF3");

File fastaSequenceFile = new File("src/test/resources/volvox_all.fna");
Expand All @@ -112,7 +112,7 @@ public void testOutputFastaSequenceLengthGFF3() throws Exception {
*/

@Test
public void testAddGFF3Note() throws Exception {
void testAddGFF3Note() throws Exception {
Map<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper
.loadFastaAddGeneFeaturesFromGmodGFF3(new File("src/test/resources/volvox_all.fna"), new File(
"src/test/resources/volvox.gff3"), false);
Expand All @@ -128,7 +128,7 @@ public void testAddGFF3Note() throws Exception {
* output.
*/
@Test
public void testGetProteinSequences() throws Exception {
void testGetProteinSequences() throws Exception {
Map<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper
.loadFastaAddGeneFeaturesFromGmodGFF3(new File("src/test/resources/volvox_all.fna"), new File(
"src/test/resources/volvox.gff3"), false);
Expand All @@ -148,7 +148,7 @@ public void testGetProteinSequences() throws Exception {
* Test of getGeneSequences method, of class GeneFeatureHelper.
*/
@Test
public void testGetGeneSequences() throws Exception {
void testGetGeneSequences() throws Exception {
// logger.info("getGeneSequences");
Map<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper
.loadFastaAddGeneFeaturesFromGmodGFF3(new File("src/test/resources/volvox_all.fna"), new File(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
package org.biojava.nbio.genome;

import org.biojava.nbio.genome.util.ChromosomeMappingTools;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -32,10 +33,10 @@
/**
* Created by Yana Valasatava on 8/14/17.
*/
public class TestChromosomeMappingTools {
class TestChromosomeMappingTools {

@Test
public void testGetCDSLengthForward() {
void testGetCDSLengthForward() {

List<Integer> exonStarts = new ArrayList<>(Arrays.asList(10, 30, 50, 70));
List<Integer> exonEnds = new ArrayList<>(Arrays.asList(20, 40, 60, 80));
Expand All @@ -46,11 +47,11 @@ public void testGetCDSLengthForward() {
ChromosomeMappingTools.setCoordinateSystem(0);
int cdsTest = ChromosomeMappingTools.getCDSLengthForward(exonStarts, exonEnds, cdsStart, cdsEnd);

assertEquals(cdsDesired, cdsTest);
Assertions.assertEquals(cdsDesired, cdsTest);
}

@Test
public void testGetCDSLengthReverseAsc() {
void testGetCDSLengthReverseAsc() {

List<Integer> exonStarts = new ArrayList<>(Arrays.asList(10, 50, 70));
List<Integer> exonEnds = new ArrayList<>(Arrays.asList(20, 60, 80));
Expand All @@ -61,11 +62,11 @@ public void testGetCDSLengthReverseAsc() {
ChromosomeMappingTools.setCoordinateSystem(0);
int cdsTest = ChromosomeMappingTools.getCDSLengthReverse(exonStarts, exonEnds, cdsStart, cdsEnd);

assertEquals(cdsDesired, cdsTest);
Assertions.assertEquals(cdsDesired, cdsTest);
}

@Test
public void testGetCDSLengthReverseDesc() {
void testGetCDSLengthReverseDesc() {

List<Integer> exonStarts = new ArrayList<>(Arrays.asList(70, 50, 10));
List<Integer> exonEnds = new ArrayList<>(Arrays.asList(80, 60, 20));
Expand All @@ -76,6 +77,6 @@ public void testGetCDSLengthReverseDesc() {
ChromosomeMappingTools.setCoordinateSystem(0);
int cdsTest = ChromosomeMappingTools.getCDSLengthReverse(exonStarts, exonEnds, cdsStart, cdsEnd);

assertEquals(cdsDesired, cdsTest);
Assertions.assertEquals(cdsDesired, cdsTest);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import com.google.common.collect.Range;
import org.biojava.nbio.genome.util.ChromosomeMappingTools;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -32,10 +32,10 @@
/**
* Created by andreas on 7/19/16.
*/
public class TestGenomeMapping {
class TestGenomeMapping {

@Test
public void testGenomeMappingToolGetCDSRanges(){
void testGenomeMappingToolGetCDSRanges(){

List<Integer> lst1 = new ArrayList<>(Arrays.asList( 86346823, 86352858, 86354529));
List<Integer> lst2 = new ArrayList<>(Arrays.asList(86348878, 86352984, 86354692));
Expand All @@ -45,21 +45,21 @@ public void testGenomeMappingToolGetCDSRanges(){
List<Range<Integer>> result = ChromosomeMappingTools.getCDSRegions(lst1,lst2,cdsStart,cdsEnd);

// makes sure the first list does not get changed;
Assert.assertEquals(86346823, (int) lst1.get(0));
Assertions.assertEquals(86346823, (int) lst1.get(0));


Assert.assertEquals(86348749, (int) result.get(0).lowerEndpoint());
Assert.assertEquals(86352858, (int) result.get(1).lowerEndpoint());
Assert.assertEquals(86354529, (int) result.get(2).lowerEndpoint());
Assertions.assertEquals(86348749, (int) result.get(0).lowerEndpoint());
Assertions.assertEquals(86352858, (int) result.get(1).lowerEndpoint());
Assertions.assertEquals(86354529, (int) result.get(2).lowerEndpoint());

Assert.assertEquals(86348878, (int) result.get(0).upperEndpoint());
Assert.assertEquals(86352984, (int) result.get(1).upperEndpoint());
Assert.assertEquals(86387027, (int) result.get(2).upperEndpoint());
Assertions.assertEquals(86348878, (int) result.get(0).upperEndpoint());
Assertions.assertEquals(86352984, (int) result.get(1).upperEndpoint());
Assertions.assertEquals(86387027, (int) result.get(2).upperEndpoint());

}

@Test
public void testGenomeMappingToolGetCDSRangesSERINC2(){
void testGenomeMappingToolGetCDSRangesSERINC2(){

List<Integer> lst1 = new ArrayList<>(Arrays.asList(31413812, 31415872, 31423692));
List<Integer> lst2 = new ArrayList<>(Arrays.asList(31414777, 31415907, 31423854));
Expand All @@ -69,7 +69,7 @@ public void testGenomeMappingToolGetCDSRangesSERINC2(){
List<Range<Integer>> result = ChromosomeMappingTools.getCDSRegions(lst1,lst2,cdsStart,cdsEnd);

// makes sure the first list does not get changed;
Assert.assertEquals(31423818, (int) result.get(0).lowerEndpoint());
Assertions.assertEquals(31423818, (int) result.get(0).lowerEndpoint());

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,28 @@
*/
package org.biojava.nbio.genome;

import static org.junit.Assert.*;

import org.biojava.nbio.genome.parsers.gff.Location;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class TestIssue355 {
class TestIssue355 {

@Test
public void testIssue1() {
void testIssue1() {
Location l1 = Location.fromBio(51227320, 51227381, '+');
Location l2 = Location.fromBio(51227323, 51227382, '+');

Location union = l1.union(l2);
assertEquals(51227320,union.bioStart());
assertEquals(51227382,union.bioEnd());
Assertions.assertEquals(51227320, union.bioStart());
Assertions.assertEquals(51227382, union.bioEnd());
}

@Test
public void testIssue2() {
void testIssue2() {
Location l1 = Location.fromBio(100, 200, '+');
Location l2 = Location.fromBio(1, 99, '+');
Location intersection = l1.intersection(l2);
assertNull(intersection);
Assertions.assertNull(intersection);
}

}
Expand Down
Loading
Loading