return al.getAlignmentAnnotation();
}
- //@formatter:on
-
+ // @formatter:on
+
@BeforeMethod(alwaysRun = true)
public void setUp()
{
SequenceI alignFrom = new Sequence("Seq2", alignModel);
alignFrom.createDatasetSequence();
AlignedCodonFrame acf = new AlignedCodonFrame();
- acf.addMap(alignMe.getDatasetSequence(), alignFrom.getDatasetSequence(), map);
+ acf.addMap(alignMe.getDatasetSequence(),
+ alignFrom.getDatasetSequence(), map);
AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "---", '-',
preserveMappedGaps, preserveUnmappedGaps);
* CDS sequences are 'discovered' from dna-to-protein mappings on the alignment
* dataset (e.g. added from dbrefs by CrossRef.findXrefSequences)
*/
- MapList mapfordna1 = new MapList(new int[] { 4, 6, 10, 12 },
- new int[] { 1, 2 }, 3, 1);
+ MapList mapfordna1 = new MapList(new int[] { 4, 6, 10, 12 }, new int[] {
+ 1, 2 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(),
mapfordna1);
dna.addCodonFrame(acf);
MapList mapfordna2 = new MapList(new int[] { 1, 3, 7, 9, 13, 15 },
- new int[] { 1, 3 },
- 3, 1);
+ new int[] { 1, 3 }, 3, 1);
acf = new AlignedCodonFrame();
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(),
mapfordna2);
.findMappingsForSequence(cds.get(0), dnaMappings);
Mapping mapping = dnaToCds1Mappings.get(0).getMappings().get(0)
.getMapping();
- assertSame(cds.get(0).getDatasetSequence(), mapping
- .getTo());
+ assertSame(cds.get(0).getDatasetSequence(), mapping.getTo());
assertEquals("G(1) in CDS should map to G(4) in DNA", 4, mapping
.getMap().getToPosition(1));
* @throws IOException
*/
@Test(groups = { "Functional" })
- public void testMapCdnaToProtein_forSubsequence()
- throws IOException
+ public void testMapCdnaToProtein_forSubsequence() throws IOException
{
SequenceI prot = new Sequence("UNIPROT|V12345", "E-I--Q", 10, 12);
prot.createDatasetSequence();
@Test(groups = { "Functional" })
public void testAlignSequenceAs_mappedProteinProtein()
{
-
+
SequenceI alignMe = new Sequence("Match", "MGAASEV");
alignMe.createDatasetSequence();
SequenceI alignFrom = new Sequence("Query", "LQTGYMGAASEVMFSPTRR");
MapList map = new MapList(new int[] { 6, 12 }, new int[] { 1, 7 }, 1, 1);
acf.addMap(alignFrom.getDatasetSequence(),
alignMe.getDatasetSequence(), map);
-
+
AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "-", '-', true,
true);
assertEquals("-----MGAASEV-------", alignMe.getSequenceAsString());
{
// map first 3 codons to KPF; G is a trailing unmapped residue
MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1);
-
+
checkAlignSequenceAs("AAACCCTTT", "K-PFG", true, true, map,
"AAA---CCCTTT---");
}
MapList map = new MapList(new int[] { 4, 6, 10, 12 },
new int[] { 1, 6 }, 1, 1);
-
+
// [5, 11] maps to [2, 5]
dna.addSequenceFeature(new SequenceFeature("type4", "desc4", 5, 11, 4f,
null));
// [12, 12] maps to [6, 6]
dna.addSequenceFeature(new SequenceFeature("type8", "desc8", 12, 12,
8f, null));
-
+
// desc4 and desc8 are the 'omit these' varargs
AlignmentUtils.transferFeatures(dna, cds, map, null, "type4", "type8");
SequenceFeature[] sfs = cds.getSequenceFeatures();
assertEquals(1, sfs.length);
-
+
SequenceFeature sf = sfs[0];
assertEquals("type5", sf.getType());
assertEquals(1, sf.getBegin());
{
SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt");
SequenceI cds = new Sequence("cds/10-15", "TAGGCC");
-
+
MapList map = new MapList(new int[] { 4, 6, 10, 12 },
new int[] { 1, 6 }, 1, 1);
-
+
// [5, 11] maps to [2, 5]
dna.addSequenceFeature(new SequenceFeature("type4", "desc4", 5, 11, 4f,
null));
// [12, 12] maps to [6, 6]
dna.addSequenceFeature(new SequenceFeature("type8", "desc8", 12, 12,
8f, null));
-
+
// "type5" is the 'select this type' argument
AlignmentUtils.transferFeatures(dna, cds, map, "type5");
SequenceFeature[] sfs = cds.getSequenceFeatures();
assertEquals(1, sfs.length);
-
+
SequenceFeature sf = sfs[0];
assertEquals("type5", sf.getType());
assertEquals(1, sf.getBegin());
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 });
dna.setDataset(null);
-
+
MapList map = new MapList(new int[] { 4, 12, 16, 18 },
new int[] { 1, 4 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map);
dna.addCodonFrame(acf);
map = new MapList(new int[] { 4, 8, 12, 12, 16, 18 },
- new int[] { 1, 3 },
- 3, 1);
+ new int[] { 1, 3 }, 3, 1);
acf = new AlignedCodonFrame();
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map);
dna.addCodonFrame(acf);
-
+
AlignmentI cds = AlignmentUtils.makeCdsAlignment(new SequenceI[] {
dna1, dna2, dna3 }, dna.getDataset(), null);
List<SequenceI> cdsSeqs = cds.getSequences();
assertEquals(2, cdsSeqs.size());
assertEquals("GGGCCCTTTGGG", cdsSeqs.get(0).getSequenceAsString());
assertEquals("GGGCCTGGG", cdsSeqs.get(1).getSequenceAsString());
-
+
/*
* verify shared, extended alignment dataset
*/
*/
List<AlignedCodonFrame> mappings = cds.getCodonFrames();
assertEquals(6, mappings.size());
-
+
/*
* 2 mappings involve pep1
*/
pep1CdsMappings);
assertEquals(1, sr.getResults().size());
Match m = sr.getResults().get(0);
- assertEquals(cds.getSequenceAt(0).getDatasetSequence(),
- m.getSequence());
+ assertEquals(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence());
assertEquals(1, m.getStart());
assertEquals(3, m.getEnd());
sr = MappingUtils.buildSearchResults(pep1, 2, pep1CdsMappings);
m = sr.getResults().get(0);
assertEquals(10, m.getStart());
assertEquals(12, m.getEnd());
-
+
/*
* Get mapping of pep2 to cds2 and verify it
* maps GPG in pep2 to 1-3,4-6,7-9 in second CDS sequence
sr = MappingUtils.buildSearchResults(pep2, 1, pep2CdsMappings);
assertEquals(1, sr.getResults().size());
m = sr.getResults().get(0);
- assertEquals(cds.getSequenceAt(1).getDatasetSequence(),
- m.getSequence());
+ assertEquals(cds.getSequenceAt(1).getDatasetSequence(), m.getSequence());
assertEquals(1, m.getStart());
assertEquals(3, m.getEnd());
sr = MappingUtils.buildSearchResults(pep2, 2, pep2CdsMappings);
SequenceI dna3 = new Sequence("Seq3", "ccaaa-ttt-GGG-");
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 });
dna.setDataset(null);
-
+
// prot1 has 'X' for incomplete start codon (not mapped)
SequenceI prot1 = new Sequence("Seq1", "XKFG"); // X for incomplete start
SequenceI prot2 = new Sequence("Seq2", "NG");
AlignmentI protein = new Alignment(new SequenceI[] { prot1, prot2,
prot3 });
protein.setDataset(null);
-
+
// map dna1 [3, 11] to prot1 [2, 4] KFG
MapList map = new MapList(new int[] { 3, 11 }, new int[] { 2, 4 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
SequenceI dnaSeq = new Sequence("dna", "aaagGGCCCaaaTTTttt");
dnaSeq.createDatasetSequence();
SequenceI ds = dnaSeq.getDatasetSequence();
-
+
// CDS for dna 5-6 (incomplete codon), 7-9
SequenceFeature sf = new SequenceFeature("CDS", "", 5, 9, 0f, null);
sf.setPhase("2"); // skip 2 bases to start of next codon
// CDS for dna 13-15
sf = new SequenceFeature("CDS_predicted", "", 13, 15, 0f, null);
ds.addSequenceFeature(sf);
-
+
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq);
-
+
/*
* check the mapping starts with the first complete codon
*/
SequenceI dnaSeq = new Sequence("dna", "aaaGGGcccAAATTTttt");
dnaSeq.createDatasetSequence();
SequenceI ds = dnaSeq.getDatasetSequence();
-
+
// CDS for dna 10-12
SequenceFeature sf = new SequenceFeature("CDS_predicted", "", 10, 12,
0f, null);
// exon feature should be ignored here
sf = new SequenceFeature("exon", "", 7, 9, 0f, null);
ds.addSequenceFeature(sf);
-
+
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq);
/*
* verify ranges { [4-6], [12-10] }
SequenceI dnaSeq = new Sequence("dna", "aaaGGGcccAAATTTttt");
dnaSeq.createDatasetSequence();
SequenceI ds = dnaSeq.getDatasetSequence();
-
+
// CDS for dna 4-6
SequenceFeature sf = new SequenceFeature("CDS", "", 4, 6, 0f, null);
sf.setStrand("-");
sf = new SequenceFeature("CDS_predicted", "", 10, 12, 0f, null);
sf.setStrand("-");
ds.addSequenceFeature(sf);
-
+
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq);
/*
* verify ranges { [12-10], [6-4] }
SequenceI dnaSeq = new Sequence("dna", "aaagGGCCCaaaTTTttt");
dnaSeq.createDatasetSequence();
SequenceI ds = dnaSeq.getDatasetSequence();
-
+
// CDS for dna 5-9
SequenceFeature sf = new SequenceFeature("CDS", "", 5, 9, 0f, null);
sf.setStrand("-");
sf.setStrand("-");
sf.setPhase("2"); // skip 2 bases to start of next codon
ds.addSequenceFeature(sf);
-
+
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq);
-
+
/*
* check the mapping starts with the first complete codon
* expect ranges [13, 13], [9, 5]
from.createDatasetSequence();
seq1.createDatasetSequence();
Mapping mapping = new Mapping(seq1, new MapList(
- new int[] { 3, 6, 9, 10 },
- new int[] { 1, 6 }, 1, 1));
+ new int[] { 3, 6, 9, 10 }, new int[] { 1, 6 }, 1, 1));
Map<Integer, Map<SequenceI, Character>> map = new TreeMap<Integer, Map<SequenceI, Character>>();
AlignmentUtils.addMappedPositions(seq1, from, mapping, map);
from.createDatasetSequence();
seq1.createDatasetSequence();
Mapping mapping = new Mapping(seq1, new MapList(
- new int[] { 3, 6, 9, 10 },
- new int[] { 1, 6 }, 1, 1));
+ new int[] { 3, 6, 9, 10 }, new int[] { 1, 6 }, 1, 1));
Map<Integer, Map<SequenceI, Character>> map = new TreeMap<Integer, Map<SequenceI, Character>>();
AlignmentUtils.addMappedPositions(seq1, from, mapping, map);
-
+
/*
* verify map has seq1 residues in columns 3,4,6,7,11,12
*/
dna.setDataset(null);
AlignmentI emblPeptides = new Alignment(new SequenceI[] { pep3, pep4 });
emblPeptides.setDataset(null);
-
+
AlignedCodonFrame acf = new AlignedCodonFrame();
MapList map = new MapList(new int[] { 4, 6, 10, 12 },
new int[] { 1, 2 }, 3, 1);
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map);
acf.addMap(dna2.getDatasetSequence(), pep4.getDatasetSequence(), map);
dna.addCodonFrame(acf);
-
+
/*
* execute method under test to find CDS for EMBL peptides only
*/
AlignmentI cds = AlignmentUtils.makeCdsAlignment(new SequenceI[] {
dna1, dna2 }, dna.getDataset(), emblPeptides.getSequencesArray());
-
+
assertEquals(2, cds.getSequences().size());
assertEquals("GGGTTT", cds.getSequenceAt(0).getSequenceAsString());
assertEquals("GGGTTTCCC", cds.getSequenceAt(1).getSequenceAsString());
-
+
/*
* verify shared, extended alignment dataset
*/
.contains(cds.getSequenceAt(0).getDatasetSequence()));
assertTrue(dna.getDataset().getSequences()
.contains(cds.getSequenceAt(1).getDatasetSequence()));
-
+
/*
* Verify mappings from CDS to peptide, cDNA to CDS, and cDNA to peptide
* the mappings are on the shared alignment dataset
* 6 mappings, 2*(DNA->CDS), 2*(DNA->Pep), 2*(CDS->Pep)
*/
assertEquals(6, cdsMappings.size());
-
+
/*
* verify that mapping sets for dna and cds alignments are different
* [not current behaviour - all mappings are on the alignment dataset]
// Assert.assertNotSame(dna.getCodonFrames(), cds.getCodonFrames());
// assertEquals(4, dna.getCodonFrames().size());
// assertEquals(4, cds.getCodonFrames().size());
-
+
/*
* Two mappings involve pep3 (dna to pep3, cds to pep3)
* Mapping from pep3 to GGGTTT in first new exon sequence
List<AlignedCodonFrame> mappings = MappingUtils
.findMappingsForSequence(cds.getSequenceAt(0), pep3Mappings);
assertEquals(1, mappings.size());
-
+
// map G to GGG
SearchResults sr = MappingUtils.buildSearchResults(pep3, 1, mappings);
assertEquals(1, sr.getResults().size());
assertSame(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence());
assertEquals(4, m.getStart());
assertEquals(6, m.getEnd());
-
+
/*
* Two mappings involve pep4 (dna to pep4, cds to pep4)
* Verify mapping from pep4 to GGGTTTCCC in second new exon sequence
dna4.setSequence(seq2);
AlignmentI al2 = new Alignment(new SequenceI[] { dna3, dna4 });
((Alignment) al2).createDatasetAlignment();
-
+
assertTrue(AlignmentUtils.alignAsSameSequences(al1, al2));
assertEquals(seq1, al1.getSequenceAt(0).getSequenceAsString());
assertEquals(seq2, al1.getSequenceAt(1).getSequenceAsString());
assertEquals(s_as2, uas2.getSequenceAsString());
assertEquals(s_as3, uas3.getSequenceAsString());
}
-
+
}
*/
SequenceI dna1 = new Sequence("AF039662", "GGGGCAGCACAAGAAC");
Mapping map = new Mapping(new Sequence("pep2", "MLAVSRG"), new MapList(
- new int[] { 1, 21 }, new int[] {
- 1, 7 }, 3, 1));
+ new int[] { 1, 21 }, new int[] { 1, 7 }, 3, 1));
DBRefEntry dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2", map);
dna1.addDBRef(dbref);
dna1.addDBRef(new DBRefEntry("EMBL", "0", "AF039662"));
dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2");
found = testee.searchDataset(!dna1.isProtein(), dna1, dbref, result,
acf, false); // search dataset with a protein xref from a dna
- // sequence to locate the protein product
+ // sequence to locate the protein product
assertTrue(found);
assertEquals(1, result.size());
assertSame(pep1, result.get(0));
dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2");
found = testee.searchDataset(!pep1.isProtein(), pep1, dbref, result,
acf, false); // search dataset with a protein's direct dbref to
- // locate dna sequences with matching xref
+ // locate dna sequences with matching xref
assertTrue(found);
assertEquals(1, result.size());
assertSame(dna1, result.get(0));
String seqDsRev = new StringBuilder(seqDs).reverse().toString();
SequenceI dna = new Sequence("Seq1", seq);
- Alignment al = new Alignment(new SequenceI[] {dna});
+ Alignment al = new Alignment(new SequenceI[] { dna });
al.createDatasetAlignment();
assertEquals(seqDs, al.getSequenceAt(0).getDatasetSequence()
.getSequenceAsString());
Sequence s5 = new Sequence("s5", "AAAADDEDTTEE");
- SequenceGroup sg_12 = new SequenceGroup(Arrays.asList(new SequenceI[] { s1,
- s2 }), "Group1", null, false, false, false, 0, 5);
+ SequenceGroup sg_12 = new SequenceGroup(Arrays.asList(new SequenceI[] {
+ s1, s2 }), "Group1", null, false, false, false, 0, 5);
- SequenceGroup sg_345 = new SequenceGroup(Arrays.asList(new SequenceI[] { s3,
- s4, s5 }), "Group2", null, false, false, false, 0, 5);
+ SequenceGroup sg_345 = new SequenceGroup(Arrays.asList(new SequenceI[] {
+ s3, s4, s5 }), "Group2", null, false, false, false, 0, 5);
AlignmentI alignment = new Alignment(
new SequenceI[] { s1, s2, s3, s4, s5 });
{
String s = String.valueOf((char) i);
String ss = Rna.getRNASecStrucState(s);
-
+
/*
* valid SS chars are a-z, A-Z, and various brackets;
* anything else is returned as a space
assertEquals(" ", ss);
}
}
-
+
/*
* a string is processed character by character
*/
public void testIsRnaSecondaryStructureSymbol()
{
assertFalse(Rna.isRnaSecondaryStructureSymbol(null));
-
+
/*
* only A-Z, a-z, ()[]{}<> are valid symbols
*/
{
AlignFrame alf = getTestAlignmentFrame();
FeatureScoreModel fsm = new FeatureScoreModel();
- Assert.assertTrue(fsm.configureFromAlignmentView(alf
- .getCurrentView().getAlignPanel()));
+ Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
+ .getAlignPanel()));
alf.selectAllSequenceMenuItem_actionPerformed(null);
float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView(
true));
alf.selectAllSequenceMenuItem_actionPerformed(null);
float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView(
true));
- Assert.assertTrue(dm[0][2] == 0f,
+ Assert.assertTrue(
+ dm[0][2] == 0f,
"After hiding last two columns FER1_MESCR (0) should still be identical with RAPSA (2)");
- Assert.assertTrue(dm[0][1] == 0f,
+ Assert.assertTrue(
+ dm[0][1] == 0f,
"After hiding last two columns FER1_MESCR (0) should now also be identical with SPIOL (1)");
- for (int s=0;s<3;s++)
+ for (int s = 0; s < 3; s++)
{
Assert.assertTrue(dm[s][3] > 0f, "After hiding last two columns "
+ alf.getViewport().getAlignment().getSequenceAt(s).getName()
assertEquals(2, bs.cardinality());
assertTrue(bs.get(1));
assertTrue(bs.get(2));
-
+
/*
* select the first four columns: Metal in seq1 2:4, seq2 4:4
*/
sg.setEndRes(3);
bs.clear();
- seqCount = AlignViewController.findColumnsWithFeature("Metal", sg,
- bs);
+ seqCount = AlignViewController.findColumnsWithFeature("Metal", sg, bs);
assertEquals(2, seqCount);
assertEquals(3, bs.cardinality());
assertTrue(bs.get(1));
seq1.createDatasetSequence();
final Sequence aseq1 = new Sequence("Seq1", "-V-L");
aseq1.createDatasetSequence();
-
+
AlignedCodonFrame acf = new AlignedCodonFrame();
MapList map = new MapList(new int[] { 2, 4, 6, 6, 8, 9 }, new int[] {
1, 2 }, 3, 1);
* - the alignmentI object to verify (either alignment or dataset)
* @param raiseAssert
* - when set, testng assertions are raised.
- * @param message
- * - null or a string message to prepend to the assert failed messages.
+ * @param message
+ * - null or a string message to prepend to the assert failed
+ * messages.
* @return true if alignment references were in order, otherwise false.
*/
public static boolean verifyAlignmentDatasetRefs(AlignmentI alignment,
boolean raiseAssert, String message)
{
- if (message==null) { message = ""; }
+ if (message == null)
+ {
+ message = "";
+ }
if (alignment == null)
{
if (raiseAssert)
{
- Assert.fail(message+"Alignment for verification was null.");
+ Assert.fail(message + "Alignment for verification was null.");
}
return false;
}
{
if (raiseAssert)
{
- Assert.fail(message+" Alignment contained a sequence who's dataset sequence has a second dataset reference.");
+ Assert.fail(message
+ + " Alignment contained a sequence who's dataset sequence has a second dataset reference.");
}
return false;
}
{
if (raiseAssert)
{
- Assert.fail(message+" Alignment contained a sequence who's dataset sequence was not in the dataset.");
+ Assert.fail(message
+ + " Alignment contained a sequence who's dataset sequence was not in the dataset.");
}
return false;
}
}
- return verifyAlignmentDatasetRefs(alignment.getDataset(), raiseAssert, message);
+ return verifyAlignmentDatasetRefs(alignment.getDataset(),
+ raiseAssert, message);
}
else
{
{
if (raiseAssert)
{
- Assert.fail(message+" Dataset contained a sequence with non-null dataset reference (ie not a dataset sequence!)");
+ Assert.fail(message
+ + " Dataset contained a sequence with non-null dataset reference (ie not a dataset sequence!)");
}
return false;
}
{
if (raiseAssert)
{
- Assert.fail(message+" DBRefEntry for sequence in alignment had map to sequence which was not a dataset sequence");
+ Assert.fail(message
+ + " DBRefEntry for sequence in alignment had map to sequence which was not a dataset sequence");
}
return false;
{
if (raiseAssert)
{
- Assert.fail(message+" DBRefEntry for sequence in alignment had map to sequence not in dataset");
+ Assert.fail(message
+ + " DBRefEntry for sequence in alignment had map to sequence not in dataset");
}
return false;
}
{
if (raiseAssert)
{
- Assert.fail(message+" CodonFrame-SSM-FromSeq is not a dataset sequence");
+ Assert.fail(message
+ + " CodonFrame-SSM-FromSeq is not a dataset sequence");
}
return false;
}
if (raiseAssert)
{
- Assert.fail(message+" CodonFrame-SSM-FromSeq is not contained in dataset");
+ Assert.fail(message
+ + " CodonFrame-SSM-FromSeq is not contained in dataset");
}
return false;
}
{
if (raiseAssert)
{
- Assert.fail(message+" CodonFrame-SSM-Mapping-ToSeq is not a dataset sequence");
+ Assert.fail(message
+ + " CodonFrame-SSM-Mapping-ToSeq is not a dataset sequence");
}
return false;
}
if (raiseAssert)
{
- Assert.fail(message+" CodonFrame-SSM-Mapping-ToSeq is not contained in dataset");
+ Assert.fail(message
+ + " CodonFrame-SSM-Mapping-ToSeq is not contained in dataset");
}
return false;
}
+ msg);
}
}
+
@Test(groups = { "Functional" })
public void testVerifyAlignmentDatasetRefs()
{
"TTTTTT");
// construct simple valid alignment dataset
- Alignment al = new Alignment(new SequenceI[] {
- sq1, sq2 });
+ Alignment al = new Alignment(new SequenceI[] { sq1, sq2 });
// expect this to pass
assertVerifyAlignment(al, true, "Simple valid alignment didn't verify");
// check test for sequence->datasetSequence validity
sq1.setDatasetSequence(sq2);
- assertVerifyAlignment(
- al,
- false,
+ assertVerifyAlignment(al, false,
"didn't detect dataset sequence with a dataset sequence reference.");
sq1.setDatasetSequence(null);
*/
public static void assertDatasetIsNormalised(AlignmentI al, String message)
{
- if (al.getDataset()!=null)
+ if (al.getDataset() != null)
{
assertDatasetIsNormalised(al.getDataset(), message);
return;
* look for pairs of sequences with same ID, start, end, and sequence
*/
List<SequenceI> seqSet = al.getSequences();
- for (int p=0;p<seqSet.size(); p++)
+ for (int p = 0; p < seqSet.size(); p++)
{
SequenceI pSeq = seqSet.get(p);
- for (int q=p+1; q<seqSet.size(); q++)
+ for (int q = p + 1; q < seqSet.size(); q++)
{
SequenceI qSeq = seqSet.get(q);
- if (pSeq.getStart()!=qSeq.getStart())
+ if (pSeq.getStart() != qSeq.getStart())
{
continue;
}
- if (pSeq.getEnd()!=qSeq.getEnd())
+ if (pSeq.getEnd() != qSeq.getEnd())
{
continue;
}
}
}
}
-
+
@Test(groups = { "Functional", "Asserts" })
public void testAssertDatasetIsNormalised()
{
Assert.fail("Expected identical sequence to raise exception.");
}
}
+
/*
* Read in Stockholm format test data including secondary structure
* annotations.
assertAlignmentDatasetRefs(align,
"addSequence broke dataset reference integrity");
}
+
@Test(groups = "Functional")
public void getVisibleStartAndEndIndexTest()
{
SequenceI pep = new Sequence("pep", "ASD");
SequenceI dna = new Sequence("dna", "aaaGCCTCGGATggg");
SequenceI cds = new Sequence("cds", "GCCTCGGAT");
-
+
// add dbref from dna to peptide
DBRefEntry dbr = new DBRefEntry("UNIPROT", "", "pep");
dbr.setMap(new Mapping(pep, new MapList(new int[] { 4, 15 }, new int[] {
pep.addDBRef(dbr4);
AlignmentI protein = new Alignment(new SequenceI[] { pep });
-
+
/*
* create the alignment dataset
*/
((Alignment) protein).createDatasetAlignment();
-
+
AlignmentI ds = protein.getDataset();
-
+
// should be 3 sequences in dataset
assertEquals(3, ds.getHeight());
assertTrue(ds.getSequences().contains(pep.getDatasetSequence()));
}
- @Test(groups={"Functional"})
+ @Test(groups = { "Functional" })
public void testLocateVisibleBoundsPathologicals()
{
// test some pathological cases we missed
- AlignmentI al = new Alignment(new SequenceI[] { new Sequence("refseqGaptest","KTDVTI----------NFI-----G----L")});
+ AlignmentI al = new Alignment(new SequenceI[] { new Sequence(
+ "refseqGaptest", "KTDVTI----------NFI-----G----L") });
ColumnSelection cs = new ColumnSelection();
cs.hideInsertionsFor(al.getSequenceAt(0));
assertEquals(
+ al.getSequenceAt(0).getCharAt(
cs.adjustForHiddenColumns(9)));
-
}
+
@Test(groups = { "Functional" })
public void testHideColumns()
{
cs.addElement(1);
cs.hideColumns(3);
cs.hideColumns(7);
- cs.hideColumns(5,9);
+ cs.hideColumns(5, 9);
// same selections added in a different order
ColumnSelection cs2 = new ColumnSelection();
cs2.hideColumns(6, 9);
cs2.hideColumns(5, 8);
cs2.hideColumns(3);
-
+
assertTrue(cs.equals(cs2));
assertTrue(cs.equals(cs));
assertTrue(cs2.equals(cs));
assertTrue(ref1.updateFrom(ref2));
assertEquals("UNIPROT", ref1.getSource()); // unchanged
assertEquals("V71633", ref1.getAccessionId()); // unchanged
-
+
/*
* ref1 has no mapping, acquires mapping from ref2
*/
static int SEQ_COUNT = 10;
SequenceI[] seqs;
-
+
/**
* Set up an alignment of 10 sequences
*/
sr2.addResult(seq1, 6, 8);
assertEquals(sr1.hashCode(), sr2.hashCode());
}
-
+
/**
* Verify that SearchResults$Match constructor normalises start/end to the
* 'forwards' direction
}
}
}
+
/*
* refactored 'as is' from main method
*
public void testIsProtein()
{
// test Protein
- assertTrue(new Sequence("prot","ASDFASDFASDF").isProtein());
+ assertTrue(new Sequence("prot", "ASDFASDFASDF").isProtein());
// test DNA
- assertFalse(new Sequence("prot","ACGTACGTACGT").isProtein());
+ assertFalse(new Sequence("prot", "ACGTACGTACGT").isProtein());
// test RNA
- SequenceI sq = new Sequence("prot","ACGUACGUACGU");
+ SequenceI sq = new Sequence("prot", "ACGUACGUACGU");
assertFalse(sq.isProtein());
// change sequence, should trigger an update of cached result
sq.setSequence("ASDFASDFADSF");
assertEquals(1, sfs.length);
assertSame(sf, sfs[0]);
-
/*
* SequenceFeature on sequence and dataset sequence; returns that on
* sequence
@Test(groups = { "Functional" })
public void testCreateDatasetSequence()
{
- SequenceI sq = new Sequence("my","ASDASD");
+ SequenceI sq = new Sequence("my", "ASDASD");
assertNull(sq.getDatasetSequence());
SequenceI rds = sq.createDatasetSequence();
assertNotNull(rds);
sq.addPDBId(new PDBEntry("1PDB", "B", Type.PDB, "filePath/test1"));
sq.addPDBId(new PDBEntry("2PDB", "A", Type.MMCIF, "filePath/test2"));
sq.addPDBId(new PDBEntry("2PDB", "B", Type.MMCIF, "filePath/test2"));
-
+
// these are the same as ones already added
DBRefEntry pdb1pdb = new DBRefEntry("PDB", "version1", "1PDB");
DBRefEntry pdb2pdb = new DBRefEntry("PDB", "version2", "2PDB");
-
List<DBRefEntry> primRefs = Arrays.asList(new DBRefEntry[] { pdb1pdb,
pdb2pdb });
new DBRefEntry("PDB", "version3", "3PDB")); // should do nothing
sq.getDatasetSequence().addDBRef(
new DBRefEntry("PDB", "version4", "4PDB")); // should do nothing
-
- PDBEntry pdbe1a=new PDBEntry("1PDB", "A", Type.PDB, "filePath/test1");
+
+ PDBEntry pdbe1a = new PDBEntry("1PDB", "A", Type.PDB, "filePath/test1");
PDBEntry pdbe1b = new PDBEntry("1PDB", "B", Type.PDB, "filePath/test1");
- PDBEntry pdbe2a=new PDBEntry("2PDB", "A", Type.MMCIF, "filePath/test2");
- PDBEntry pdbe2b = new PDBEntry("2PDB", "B", Type.MMCIF, "filePath/test2");
- sq.getDatasetSequence().addPDBId(
- pdbe1a);
- sq.getDatasetSequence().addPDBId(
- pdbe1b);
+ PDBEntry pdbe2a = new PDBEntry("2PDB", "A", Type.MMCIF,
+ "filePath/test2");
+ PDBEntry pdbe2b = new PDBEntry("2PDB", "B", Type.MMCIF,
+ "filePath/test2");
+ sq.getDatasetSequence().addPDBId(pdbe1a);
+ sq.getDatasetSequence().addPDBId(pdbe1b);
sq.getDatasetSequence().addPDBId(pdbe2a);
sq.getDatasetSequence().addPDBId(pdbe2b);
assertNotNull(sq.getSequenceFeatures());
assertArrayEquals(sq.getSequenceFeatures(),
derived.getSequenceFeatures());
-
+
/*
* verify we have primary db refs *just* for PDB IDs with associated
* PDBEntry objects
12.4f, "group"));
seq1.addPDBId(new PDBEntry("1A70", "B", Type.PDB, "File"));
seq1.addDBRef(new DBRefEntry("EMBL", "1.2", "AZ12345"));
-
+
SequenceI copy = new Sequence(seq1);
assertNull(copy.getDatasetSequence());
// copy has a copy of the sequence feature:
SequenceFeature[] sfs = copy.getSequenceFeatures();
assertEquals(1, sfs.length);
- if (seq1.getDatasetSequence()!=null && copy.getDatasetSequence()==seq1.getDatasetSequence()) {
+ if (seq1.getDatasetSequence() != null
+ && copy.getDatasetSequence() == seq1.getDatasetSequence())
+ {
assertTrue(sfs[0] == seq1.getSequenceFeatures()[0]);
- } else {
+ }
+ else
+ {
assertFalse(sfs[0] == seq1.getSequenceFeatures()[0]);
}
assertTrue(sfs[0].equals(seq1.getSequenceFeatures()[0]));
public void testGetPrimaryDBRefs_nucleotide()
{
SequenceI sq = new Sequence("aseq", "TGATCACTCGACTAGCATCAGCATA", 10, 34);
-
+
// primary - Ensembl
DBRefEntry dbr1 = new DBRefEntry("ENSEMBL", "0", "ENSG1234");
sq.addDBRef(dbr1);
-
+
// not primary - Ensembl 'transcript' mapping of sub-sequence
DBRefEntry dbr2 = new DBRefEntry("ENSEMBL", "0", "ENST1234");
dbr2.setMap(new Mapping(null, new MapList(new int[] { 15, 25 },
// not primary - to protein
DBRefEntry dbr5 = new DBRefEntry("UNIPROT", "0", "Q87654");
sq.addDBRef(dbr5);
-
+
List<DBRefEntry> primaryDBRefs = sq.getPrimaryDBRefs();
assertEquals(2, primaryDBRefs.size());
assertTrue(primaryDBRefs.contains(dbr1));
seq.addDBRef(new DBRefEntry("PDB", "0", "3a6sB"));
// 7 is not a valid chain code:
seq.addDBRef(new DBRefEntry("PDB", "0", "2GIS7"));
-
+
seq.updatePDBIds();
List<PDBEntry> pdbIds = seq.getAllPDBEntries();
assertEquals(4, pdbIds.size());
// truncate last exon by 6bp
int[] truncated = EmblEntry.adjustForProteinLength(4, exons);
- assertEquals("[11, 15, 21, 25, 31, 32]",
- Arrays.toString(truncated));
+ assertEquals("[11, 15, 21, 25, 31, 32]", Arrays.toString(truncated));
// remove last exon and truncate preceding by 1bp
truncated = EmblEntry.adjustForProteinLength(3, exons);
{
SequenceOntologyFactory.setInstance(null);
}
+
/**
* Test that the cdna part of genomic sequence is correctly identified by
* 'exon' features (or subtypes) - reverse strand case.
genomic.setStart(10000);
genomic.setEnd(50000);
String transcriptId = "ABC123";
-
+
// exon at (start+10000) length 501
SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f,
null);
sf.setValue("Parent", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
// exon (sub-type) at (start + exon_variant) length 101
sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null);
sf.setValue("Parent", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
// exon belonging to a different transcript doesn't count
sf = new SequenceFeature("exon", "", 11500, 12600, 0f, null);
sf.setValue("Parent", "transcript:anotherOne");
genomic.addSequenceFeature(sf);
-
+
// transcript feature doesn't count
sf = new SequenceFeature("transcript", "", 10000, 50000, 0f, null);
sf.setStrand("-"); // weird but ignored
genomic.addSequenceFeature(sf);
-
+
MapList ranges = testee.getGenomicRangesFromFeatures(genomic,
transcriptId, 23);
List<int[]> fromRanges = ranges.getFromRanges();
genomic.setStart(10000);
genomic.setEnd(50000);
String transcriptId = "ABC123";
-
+
SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f,
null);
sf.setValue("Parent", "transcript:" + transcriptId);
sf.setStrand("-");
genomic.addSequenceFeature(sf);
-
+
sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null);
sf.setValue("Parent", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
MapList ranges = testee.getGenomicRangesFromFeatures(genomic,
transcriptId, 23);
assertNull(ranges);
genomic.setStart(10000);
genomic.setEnd(50000);
String transcriptId = "ABC123";
-
+
// CDS at (start+10000) length 501
SequenceFeature sf = new SequenceFeature("CDS", "", 20000, 20500, 0f,
null);
sf.setValue("Parent", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
// CDS (sub-type) at (start + 10500) length 101
sf = new SequenceFeature("CDS_predicted", "", 10500, 10600, 0f, null);
sf.setValue("Parent", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
// CDS belonging to a different transcript doesn't count
sf = new SequenceFeature("CDS", "", 11500, 12600, 0f, null);
sf.setValue("Parent", "transcript:anotherOne");
genomic.addSequenceFeature(sf);
-
+
// exon feature doesn't count
sf = new SequenceFeature("exon", "", 10000, 50000, 0f, null);
genomic.addSequenceFeature(sf);
// mRNA_region feature doesn't count (parent of CDS)
sf = new SequenceFeature("mRNA_region", "", 10000, 50000, 0f, null);
genomic.addSequenceFeature(sf);
-
+
MapList ranges = testee.getGenomicRangesFromFeatures(genomic,
transcriptId, 23);
List<int[]> fromRanges = ranges.getFromRanges();
{
String accId = "ABC123";
EnsemblCds testee = new EnsemblCds();
-
- SequenceFeature sf = new SequenceFeature("CDS", "", 20000,
- 20500, 0f, null);
+
+ SequenceFeature sf = new SequenceFeature("CDS", "", 20000, 20500, 0f,
+ null);
assertFalse(testee.retainFeature(sf, accId));
-
+
sf.setType("CDS_predicted");
assertFalse(testee.retainFeature(sf, accId));
-
+
// other feature with no parent is retained
sf.setType("sequence_variant");
assertTrue(testee.retainFeature(sf, accId));
-
+
// other feature with desired parent is retained
sf.setValue("Parent", "transcript:" + accId);
assertTrue(testee.retainFeature(sf, accId));
-
+
// feature with wrong parent is not retained
sf.setValue("Parent", "transcript:XYZ");
assertFalse(testee.retainFeature(sf, accId));
{
String accId = "ABC123";
EnsemblCds testee = new EnsemblCds();
-
+
// cds with no parent not valid
SequenceFeature sf = new SequenceFeature("CDS", "", 1, 2, 0f, null);
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// cds with wrong parent not valid
sf.setValue("Parent", "transcript:XYZ");
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// cds with right parent is valid
sf.setValue("Parent", "transcript:" + accId);
assertTrue(testee.identifiesSequence(sf, accId));
-
+
// cds sub-type with right parent is valid
sf.setType("CDS_predicted");
assertTrue(testee.identifiesSequence(sf, accId));
-
+
// transcript not valid:
sf.setType("transcript");
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// exon not valid:
sf.setType("exon");
assertFalse(testee.identifiesSequence(sf, accId));
genomic.addSequenceFeature(sf1);
// transcript sub-type feature
- SequenceFeature sf2 = new SequenceFeature("snRNA", "", 20000,
- 20500, 0f, null);
+ SequenceFeature sf2 = new SequenceFeature("snRNA", "", 20000, 20500,
+ 0f, null);
sf2.setValue("Parent", "gene:" + geneId);
sf2.setValue("transcript_id", "transcript2");
genomic.addSequenceFeature(sf2);
{
String geneId = "ABC123";
EnsemblGene testee = new EnsemblGene();
- SequenceFeature sf = new SequenceFeature("gene", "", 20000,
- 20500, 0f, null);
+ SequenceFeature sf = new SequenceFeature("gene", "", 20000, 20500, 0f,
+ null);
sf.setValue("ID", "gene:" + geneId);
assertFalse(testee.retainFeature(sf, geneId));
{
String accId = "ABC123";
EnsemblGene testee = new EnsemblGene();
-
+
// gene with no ID not valid
SequenceFeature sf = new SequenceFeature("gene", "", 1, 2, 0f, null);
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// gene with wrong ID not valid
sf.setValue("ID", "gene:XYZ");
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// gene with right ID is valid
sf.setValue("ID", "gene:" + accId);
assertTrue(testee.identifiesSequence(sf, accId));
-
+
// gene sub-type with right ID is valid
sf.setType("snRNA_gene");
assertTrue(testee.identifiesSequence(sf, accId));
-
+
// transcript not valid:
sf.setType("transcript");
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// exon not valid:
sf.setType("exon");
assertFalse(testee.identifiesSequence(sf, accId));
genomic.setStart(10000);
genomic.setEnd(50000);
String transcriptId = "ABC123";
-
+
// transcript at (start+10000) length 501
SequenceFeature sf = new SequenceFeature("transcript", "", 20000,
- 20500, 0f,
- null);
+ 20500, 0f, null);
sf.setValue("ID", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
// transcript (sub-type) at (start + 10500) length 101
sf = new SequenceFeature("ncRNA", "", 10500, 10600, 0f, null);
sf.setValue("ID", "transcript:" + transcriptId);
sf.setValue("ID", "transcript:" + transcriptId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
-
+
// transcript with a different ID doesn't count
sf = new SequenceFeature("transcript", "", 11500, 12600, 0f, null);
sf.setValue("ID", "transcript:anotherOne");
genomic.addSequenceFeature(sf);
-
+
// parent of transcript feature doesn't count
sf = new SequenceFeature("gene_member_region", "", 10000, 50000, 0f,
null);
SequenceFeature sf = new SequenceFeature("transcript", "", 20000,
20500, 0f, null);
assertFalse(testee.retainFeature(sf, accId));
-
+
sf.setType("mature_transcript");
assertFalse(testee.retainFeature(sf, accId));
-
+
sf.setType("NMD_transcript_variant");
assertFalse(testee.retainFeature(sf, accId));
-
+
// other feature with no parent is kept
sf.setType("anything");
assertTrue(testee.retainFeature(sf, accId));
{
String accId = "ABC123";
EnsemblGenome testee = new EnsemblGenome();
-
+
// transcript with no ID not valid
SequenceFeature sf = new SequenceFeature("transcript", "", 1, 2, 0f,
null);
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// transcript with wrong ID not valid
sf.setValue("ID", "transcript");
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// transcript with right ID is valid
sf.setValue("ID", "transcript:" + accId);
assertTrue(testee.identifiesSequence(sf, accId));
-
+
// transcript sub-type with right ID is valid
sf.setType("ncRNA");
assertTrue(testee.identifiesSequence(sf, accId));
// Ensembl treats NMD_transcript_variant as if a transcript
sf.setType("NMD_transcript_variant");
assertTrue(testee.identifiesSequence(sf, accId));
-
+
// gene not valid:
sf.setType("gene");
assertFalse(testee.identifiesSequence(sf, accId));
-
+
// exon not valid:
sf.setType("exon");
assertFalse(testee.identifiesSequence(sf, accId));
{
EnsemblRestClient sf = new EnsemblRestClient()
{
-
+
@Override
public String getDbName()
{
return null;
}
-
+
@Override
public AlignmentI getSequenceRecords(String queries) throws Exception
{
return null;
}
-
+
@Override
protected URL getUrl(List<String> ids) throws MalformedURLException
{
return null;
}
-
+
@Override
protected boolean useGetRequest()
{
return false;
}
-
+
@Override
protected String getRequestMimeType(boolean b)
{
return null;
}
-
+
@Override
protected String getResponseMimeType()
{
return null;
}
-
+
};
boolean isAvailable = sf.isEnsemblAvailable();
if (isAvailable)
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-
public class EnsemblSeqProxyTest
{
private static final Object[][] allSeqs = new Object[][] {
}
@Test(dataProvider = "ens_seqs", suiteName = "live")
- public void testGetOneSeqs(EnsemblRestClient proxy, String sq, String fastasq)
- throws Exception
+ public void testGetOneSeqs(EnsemblRestClient proxy, String sq,
+ String fastasq) throws Exception
{
FileParse fp = proxy.getSequenceReader(Arrays
- .asList(new String[]
- { sq }));
+ .asList(new String[] { sq }));
SequenceI[] sqs = new FastaFile(fp).getSeqsAsArray();
FastaFile trueRes = new FastaFile(fastasq, AppletFormatAdapter.PASTE);
SequenceI[] trueSqs = trueRes.getSeqsAsArray();
"Sequences differ for " + tr.getName() + "\n" + "Exp:"
+ tr.getSequenceAsString() + "\n" + "Got:"
+ rseq[0].getSequenceAsString());
-
+
}
}
public void testParse_missingResidues() throws Exception
{
PDBfile mctest = new PDBfile(false, false, false,
- pastePDBDataWithChainBreak,
- AppletFormatAdapter.PASTE);
+ pastePDBDataWithChainBreak, AppletFormatAdapter.PASTE);
JmolParser jtest = new JmolParser(pastePDBDataWithChainBreak,
AppletFormatAdapter.PASTE);
Vector<SequenceI> seqs = jtest.getSeqs();
AppletFormatAdapter.PASTE);
Vector<SequenceI> seqs = jtest.getSeqs();
Vector<SequenceI> mcseqs = mctest.getSeqs();
-
+
assertEquals("Failed to find 1 sequence\n", 1, seqs.size());
assertEquals("Failed to find 1 sequence\n", 1, mcseqs.size());
assertEquals("ALC", seqs.get(0).getSequenceAsString());
{
try
{
- String testSeq = mcseqs.remove(0).getSequenceAsString();
+ String testSeq = mcseqs.remove(0).getSequenceAsString();
if (!sq.getSequenceAsString().equals(testSeq))
- {
- ++totalFail;
+ {
+ ++totalFail;
System.err.println("Test Failed for " + pdbStr + ". Diff:");
- System.err.println(sq.getSequenceAsString());
- System.err.println(testSeq);
- failedFiles.add(pdbStr);
- }
+ System.err.println(sq.getSequenceAsString());
+ System.err.println(testSeq);
+ failedFiles.add(pdbStr);
+ }
++totalSeqScanned;
} catch (Exception e)
{
private SequenceOntologyI so;
@BeforeClass(alwaysRun = true)
- public void setUp() {
+ public void setUp()
+ {
long now = System.currentTimeMillis();
try
{
@Test(groups = { "Functional" })
public void getAllDefaulDisplayedDataColumns()
{
- Assert.assertNotNull(ftsRestClient.getAllDefaultDisplayedFTSDataColumns());
+ Assert.assertNotNull(ftsRestClient
+ .getAllDefaultDisplayedFTSDataColumns());
Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.isEmpty());
- Assert.assertEquals(ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
- .size(), 7);
+ Assert.assertEquals(ftsRestClient
+ .getAllDefaultDisplayedFTSDataColumns().size(), 7);
}
@Test(groups = { "Functional" })
"id,entry name,protein names,genes,organism,reviewed,length");
}
-
@Test(groups = { "Functional" })
public void getAllFTSDataColumns()
{
{
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("molecule_type"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("pdb_id"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("genus"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("gene_name"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("title"));
{
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("molecule_type"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("pdb_id"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("genus"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("gene_name"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("title"));
{
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("molecule_type"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("pdb_id"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("genus"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("gene_name"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("title"));
assertEquals(expectedErrorMsg, parsedErrorResponse);
}
- @Test(
- groups = { "External" },
- expectedExceptions = Exception.class)
+ @Test(groups = { "External" }, expectedExceptions = Exception.class)
public void testForExpectedRuntimeException() throws Exception
{
List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
PDBFTSRestClient.getInstance().executeRequest(request);
}
- // JBP: Is this actually external ? Looks like it is mocked
+ // JBP: Is this actually external ? Looks like it is mocked
@Test(groups = { "External" })
public void parsePDBJsonResponseTest()
{
{
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("molecule_type"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("pdb_id"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("genus"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("gene_name"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("title"));
.getDataColumnByNameOrCode("molecule_type"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("genus"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("gene_name"));
wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("title"));
- wantedFields
-.add(PDBFTSRestClient.getInstance()
+ wantedFields.add(PDBFTSRestClient.getInstance()
.getDataColumnByNameOrCode("pdb_id"));
} catch (Exception e)
{
}
try
{
- assertEquals(5,
- PDBFTSRestClient.getInstance()
+ assertEquals(5, PDBFTSRestClient.getInstance()
.getPrimaryKeyColumIndex(wantedFields, true));
- assertEquals(4,
- PDBFTSRestClient.getInstance()
+ assertEquals(4, PDBFTSRestClient.getInstance()
.getPrimaryKeyColumIndex(wantedFields, false));
} catch (Exception e)
{
* [1-3], [6-8] base zero
*/
assertTrue(af.hideFeatureColumns("Turn", true));
- hidden = af.getViewport().getColumnSelection()
- .getHiddenColumns();
+ hidden = af.getViewport().getColumnSelection().getHiddenColumns();
assertEquals(2, hidden.size());
assertEquals(1, hidden.get(0)[0]);
assertEquals(3, hidden.get(0)[1]);
assertTrue(ssmMappings.contains(acf2));
assertFalse(ssmMappings.contains(acf3));
}
-
+
/**
* Test for JAL-1306 - conservation thread should run even when only Quality
* (and not Conservation) is enabled in Preferences
Boolean.FALSE.toString());
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", FormatAdapter.FILE);
- AlignmentAnnotation[] anns = af.viewport.getAlignment().getAlignmentAnnotation();
+ AlignmentAnnotation[] anns = af.viewport.getAlignment()
+ .getAlignmentAnnotation();
assertNotNull("No annotations found", anns);
assertEquals("More than one annotation found", 1, anns.length);
assertTrue("Annotation is not Quality",
{
for (int q = p + 1; q < avec.length; q++)
{
- assertTrue("Found a duplicate annotation row "
- + avec[p].label, avec[p] != avec[q]);
+ assertTrue("Found a duplicate annotation row " + avec[p].label,
+ avec[p] != avec[q]);
}
}
}
if (StructureImportSettings.getDefaultPDBFileParser().equals(
StructureParser.JALVIEW_PARSER))
{
- assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId));
+ assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId));
}
}
}
// perform crossref action, or retrieve stored project
List<AlignmentViewPanel> cra_views = new ArrayList<AlignmentViewPanel>();
CrossRefAction cra = null;
-
+
if (pass2 == 0)
{ // retrieve and show cross-refs in this thread
cra = new CrossRefAction(af, seqs, dna, db);
: new CrossRef(xrseqs, dataset)
.findXrefSourcesForSequences(avp
.getAlignViewport().isNucleotide());
-
+
stringify(dbtoviewBit, savedProjects, nextxref, avp);
xrptypes.put(nextxref, _xrptypes);
{
List<AlignmentViewPanel> cra_views2 = new ArrayList<AlignmentViewPanel>();
int q = 0;
- String nextnextxref = nextxref
- + " -> " + xrefdb + "{" + q + "}";
+ String nextnextxref = nextxref + " -> " + xrefdb + "{"
+ + q + "}";
if (pass3 == 0)
{
{
failedXrefMenuItems
.add("No crossrefs retrieved for '"
- + nextxref + "' to " + xrefdb + " via '"
- + nextaf.getTitle() + "'");
+ + nextxref + "' to " + xrefdb
+ + " via '" + nextaf.getTitle() + "'");
continue;
}
cra_views2 = cra.getXrefViews();
for (AlignmentViewPanel nextavp : cra_views2)
{
- nextnextxref = nextxref
- + " -> " + xrefdb + "{" + q++ + "}";
+ nextnextxref = nextxref + " -> " + xrefdb + "{" + q++
+ + "}";
// verify references for this panel
AlignmentTest.assertAlignmentDatasetRefs(
{
List<SequenceI> nonType = new ArrayList<SequenceI>();
for (SequenceI sq : alignmentViewPanel.getAlignViewport()
- .getAlignment()
- .getSequences())
+ .getAlignment().getSequences())
{
if (sq.isProtein() != expectProtein)
{
{
Assert.fail(message + " [ "
+ (expectProtein ? "nucleotides were " : "proteins were ")
- + nonType.toString()
- + " ]");
+ + nonType.toString() + " ]");
}
}
Map<String, FeatureColourI> colours = af.getFeatureRenderer()
.getFeatureColours();
// GFF2 uses space as name/value separator in column 9
- String gffData = "METAL\tcc9900\n" + "GFF\n"
+ String gffData = "METAL\tcc9900\n"
+ + "GFF\n"
+ "FER_CAPAA\tuniprot\tMETAL\t44\t45\t4.0\t.\t.\tNote Iron-sulfur; Note 2Fe-2S\n"
+ "FER1_SOLLC\tuniprot\tPfam\t55\t130\t2.0\t.\t.";
FeaturesFile featuresFile = new FeaturesFile(gffData,
{
assertEquals("no sequences extracted from GFF3 file", 2,
dataset.getHeight());
-
+
SequenceI seq1 = dataset.findName("seq1");
SequenceI seq2 = dataset.findName("seq2");
assertNotNull(seq1);
"Expected at least one CDNA/Protein mapping for seq1",
dataset.getCodonFrame(seq1) != null
&& dataset.getCodonFrame(seq1).size() > 0);
-
+
}
@Test(groups = { "Functional" })
public void simpleGff3FileClass() throws IOException
{
AlignmentI dataset = new Alignment(new SequenceI[] {});
- FeaturesFile ffile = new FeaturesFile(simpleGffFile,
- FormatAdapter.FILE);
-
+ FeaturesFile ffile = new FeaturesFile(simpleGffFile, FormatAdapter.FILE);
+
boolean parseResult = ffile.parse(dataset, null, false, false);
assertTrue("return result should be true", parseResult);
checkDatasetfromSimpleGff3(dataset);
public void simpleGff3RelaxedIdMatching() throws IOException
{
AlignmentI dataset = new Alignment(new SequenceI[] {});
- FeaturesFile ffile = new FeaturesFile(simpleGffFile,
- FormatAdapter.FILE);
-
+ FeaturesFile ffile = new FeaturesFile(simpleGffFile, FormatAdapter.FILE);
+
boolean parseResult = ffile.parse(dataset, null, false, true);
assertTrue("return result (relaxedID matching) should be true",
parseResult);
* first with no features displayed
*/
FeatureRenderer fr = af.alignPanel.getFeatureRenderer();
- Map<String, FeatureColourI> visible = fr
- .getDisplayedFeatureCols();
+ Map<String, FeatureColourI> visible = fr.getDisplayedFeatureCols();
String exported = featuresFile.printJalviewFormat(
al.getSequencesArray(), visible);
String expected = "No Features Visible";
*/
sequenceString = adjustForGapTreatment(sequenceString, gap, format);
assertEquals(
- String.format("Sequence %d: %s", i,
- seqs[i].getName()), seqs[i].getSequenceAsString(),
- sequenceString);
+ String.format("Sequence %d: %s", i, seqs[i].getName()),
+ seqs[i].getSequenceAsString(), sequenceString);
i++;
}
} catch (IOException e)
SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3,
Float.NaN, "group");
sf.setStatus("Confirmed");
-
+
sar.appendFeature(sb, 1, null, sf);
assertEquals("METAL 1 3; Fe2-S; (Confirmed)", sb.toString());
}
StringBuffer sb = new StringBuffer();
SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3,
Float.NaN, "group");
-
+
sar.appendFeature(sb, 1, null, sf);
assertEquals("METAL 1 3; Fe2-S", sb.toString());
}
SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3,
Float.NaN, "group");
sf.setValue("clinical_significance", "Benign");
-
+
sar.appendFeature(sb, 1, null, sf);
assertEquals("METAL 1 3; Fe2-S; Benign", sb.toString());
}
StringBuffer sb = new StringBuffer();
SequenceFeature sf = new SequenceFeature("METAL", "METAL", 1, 3,
Float.NaN, "group");
-
+
// description is not included if it duplicates type:
sar.appendFeature(sb, 1, null, sf);
assertEquals("METAL 1 3", sb.toString());
SequenceFeature sf = new SequenceFeature("METAL",
"<html><body>hello<em>world</em></body></html>", 1, 3,
Float.NaN, "group");
-
+
sar.appendFeature(sb, 1, null, sf);
// !! strips off </body> but not <body> ??
- assertEquals("METAL 1 3; <body>hello<em>world</em>",
- sb.toString());
+ assertEquals("METAL 1 3; <body>hello<em>world</em>", sb.toString());
sb.setLength(0);
sf.setDescription("<br>&kHD>6");
assertEquals("different number of features",
seq_original[i].getSequenceFeatures().length,
- seq_new[in]
- .getSequenceFeatures().length);
+ seq_new[in].getSequenceFeatures().length);
for (int feat = 0; feat < seq_original[i].getSequenceFeatures().length; feat++)
{
{
FileLoader loader = new FileLoader(false);
AlignFrame af = loader.LoadFileWaitTillLoaded(
- "examples/testdata/exonerateseqs.fa",
- FormatAdapter.FILE);
-
+ "examples/testdata/exonerateseqs.fa", FormatAdapter.FILE);
+
af.loadJalviewDataFile("examples/testdata/exonerateoutput.gff",
FormatAdapter.FILE, null, null);
-
+
/*
* verify one mapping to a dummy sequence, one to a real one
*/
- List<AlignedCodonFrame> mappings = af
- .getViewport().getAlignment().getDataset().getCodonFrames();
+ List<AlignedCodonFrame> mappings = af.getViewport().getAlignment()
+ .getDataset().getCodonFrames();
assertEquals(2, mappings.size());
Iterator<AlignedCodonFrame> iter = mappings.iterator();
-
+
// first mapping is to dummy sequence
AlignedCodonFrame mapping = iter.next();
Mapping[] mapList = mapping.getProtMappings();
// 143 in protein should map to codon [11270, 11269, 11268] in dna
int[] mappedRegion = mapList[0].getMap().locateInFrom(143, 143);
assertArrayEquals(new int[] { 11270, 11268 }, mappedRegion);
-
+
// second mapping is to a sequence in the alignment
mapping = iter.next();
mapList = mapping.getProtMappings();
.findName("DDB_G0280897");
assertSame(proteinSeq.getDatasetSequence(), mapList[0].getTo());
assertEquals(1, mapping.getdnaToProt().length);
-
+
// 143 in protein should map to codon [11270, 11269, 11268] in dna
mappedRegion = mapList[0].getMap().locateInFrom(143, 143);
assertArrayEquals(new int[] { 11270, 11268 }, mappedRegion);
-
+
// 182 in protein should map to codon [11153, 11152, 11151] in dna
mappedRegion = mapList[0].getMap().locateInFrom(182, 182);
assertArrayEquals(new int[] { 11153, 11151 }, mappedRegion);
-
+
// and the reverse mapping:
mappedRegion = mapList[0].getMap().locateInTo(11151, 11153);
assertArrayEquals(new int[] { 182, 182 }, mappedRegion);
-
+
// 11150 in dna should _not_ map to protein
mappedRegion = mapList[0].getMap().locateInTo(11150, 11150);
assertNull(mappedRegion);
-
+
// similarly 183 in protein should _not_ map to dna
mappedRegion = mapList[0].getMap().locateInFrom(183, 183);
assertNull(mappedRegion);
"GAATTCGTTCATGTAGGTTGATTTTTATT");
seq.createDatasetSequence();
AlignmentI align = new Alignment(new SequenceI[] {});
-
+
// mapping from gi|68711 12923-13060 to gi|N37351 1-138
String[] gff = "gi|68711\tblat-pasa\tcDNA_match\t12923\t13060\t98.55\t+\t.\tID=align_68;Target=gi|N37351 1 138 +"
.split("\\t");
// (this is important for 'align cdna to genome' to work correctly)
assertEquals(1, align.getCodonFrames().size());
AlignedCodonFrame mapping = align.getCodonFrames().get(0);
-
+
/*
* 'dnaseqs' (map from) is here [gi|68711]
* 'aaseqs' (map to) is here [gi|N37351]
assertEquals(1, mapping.getdnaToProt().length);
assertEquals(2, mapping.getdnaToProt()[0].getFromRanges().size());
// the two spliced dna ranges are combined in one MapList
- assertArrayEquals(new int[] { 12923, 13060 },
- mapping.getdnaToProt()[0]
+ assertArrayEquals(new int[] { 12923, 13060 }, mapping.getdnaToProt()[0]
.getFromRanges().get(0));
assertArrayEquals(new int[] { 13411, 13550 }, mapping.getdnaToProt()[0]
.getFromRanges().get(1));
seq.createDatasetSequence();
AlignmentI align = new Alignment(new SequenceI[] {});
Map<String, List<String>> set = Gff3Helper.parseNameValuePairs(gff[8]);
-
+
/*
* this should create a mapping from Prot1/5-30 to virtual sequence
* match$17_5_30 (added to newseqs) positions 1-26
@Test(groups = { "Functional" })
public void testGetColor_Graduated()
{
- // graduated colour from score 0 to 100, gray(128, 128, 128) to red(255, 0, 0)
+ // graduated colour from score 0 to 100, gray(128, 128, 128) to red(255, 0,
+ // 0)
FeatureColour fc = new FeatureColour(Color.GRAY, Color.RED, 0f, 100f);
// feature score is 75 which is 3/4 of the way from GRAY to RED
SequenceFeature sf = new SequenceFeature("type", "desc", 0, 20, 75f,
String redHex = Format.getHexString(Color.RED);
String hexColour = redHex;
assertEquals("domain\t" + hexColour, fc.toJalviewFormat("domain"));
-
+
/*
* colour by label (no threshold)
*/
import java.awt.Color;
import org.testng.annotations.Test;
+
public class UserColourSchemeTest
{
// Associate the 1GAQ pdb file with the subsequence 'imported' from another
// source
StructureFile pde = ssm.setMapping(true, new SequenceI[] { sq },
- new String[]
- { "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE);
+ new String[] { "A" }, inFile = "examples/1gaq.txt",
+ jalview.io.FormatAdapter.FILE);
assertTrue("PDB File couldn't be found", pde != null);
StructureMapping[] mp = ssm.getMapping(inFile);
assertTrue("No mappings made.", mp != null && mp.length > 0);
public class ArrayUtilsTest
{
- @Test(groups="Functional")
- public void testReverseIntArray() {
+ @Test(groups = "Functional")
+ public void testReverseIntArray()
+ {
// null value: should be no exception
ArrayUtils.reverseIntArray((int[]) null);
* value > max
*/
col = ColorUtils
- .getGraduatedColour(40f, 10f, minColour, 30f,
- maxColour);
+ .getGraduatedColour(40f, 10f, minColour, 30f, maxColour);
assertEquals(maxColour, col);
/*
1 }, 1, 1)));
List<DBRefEntry> matches = DBRefUtils.searchRefs(new DBRefEntry[] {
- ref1,
- ref2, ref3, ref4, ref5 }, target);
+ ref1, ref2, ref3, ref4, ref5 }, target);
assertEquals(3, matches.size());
assertSame(ref1, matches.get(0));
assertSame(ref2, matches.get(1));
ref3.setMap(map3);
List<DBRefEntry> matches = DBRefUtils.searchRefs(new DBRefEntry[] {
- ref1,
- ref2, ref3 }, target);
+ ref1, ref2, ref3 }, target);
assertEquals(2, matches.size());
assertSame(ref1, matches.get(0));
assertSame(ref2, matches.get(1));
@Test(groups = { "Functional" })
public void testSearchRefs_accessionid()
{
-
+
DBRefEntry ref1 = new DBRefEntry("Uniprot", "1", "A1234"); // matches
DBRefEntry ref2 = new DBRefEntry("embl", "1", "A1234"); // matches
// constructor does not upper-case accession id
DBRefEntry ref5 = new DBRefEntry("EMBL", "1", "A1234");
ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1,
1 }, 1, 1)));
-
- DBRefEntry[] dbrefs = new DBRefEntry[] { ref1,
- ref2, ref3, ref4, ref5 };
+
+ DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5 };
List<DBRefEntry> matches = DBRefUtils.searchRefs(dbrefs, "A1234");
assertEquals(3, matches.size());
assertSame(ref1, matches.get(0));
public void testSearchRefs_wildcardAccessionid()
{
DBRefEntry target = new DBRefEntry("EMBL", "2", null);
-
+
DBRefEntry ref1 = new DBRefEntry("EMBL", "1", "A1234"); // matches
// constructor changes embl to EMBL
DBRefEntry ref2 = new DBRefEntry("embl", "1", "A1235"); // matches
DBRefEntry ref5 = new DBRefEntry("EMBL", "1", "A1237");
ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1,
1 }, 1, 1)));
-
+
List<DBRefEntry> matches = DBRefUtils.searchRefs(new DBRefEntry[] {
- ref1,
- ref2, ref3, ref4, ref5 }, target);
+ ref1, ref2, ref3, ref4, ref5 }, target);
assertEquals(4, matches.size());
assertSame(ref1, matches.get(0));
assertSame(ref2, matches.get(1));
MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] {
51, 1 }, 1, 3);
String s = ml.toString();
- assertEquals("[ [1, 5] [10, 15] [25, 20] ] 1:3 to [ [51, 1] ]",
- s);
+ assertEquals("[ [1, 5] [10, 15] [25, 20] ] 1:3 to [ [51, 1] ]", s);
}
@Test(groups = { "Functional" })
public void testIsFromForwardStrand()
{
// [3-9] declares forward strand
- MapList ml = new MapList(new int[] { 2, 2, 3, 9, 12, 11 },
- new int[] { 20, 11 }, 1, 1);
+ MapList ml = new MapList(new int[] { 2, 2, 3, 9, 12, 11 }, new int[] {
+ 20, 11 }, 1, 1);
assertTrue(ml.isFromForwardStrand());
// [11-5] declares reverse strand ([13-14] is ignored)
public void testMapColumnSelection_hiddenColumns() throws IOException
{
setupMappedAlignments();
-
+
ColumnSelection proteinSelection = new ColumnSelection();
/*
* in dna respectively, overall 0-4
*/
proteinSelection.hideColumns(0);
- ColumnSelection dnaSelection = MappingUtils.mapColumnSelection(proteinSelection,
- proteinView, dnaView);
+ ColumnSelection dnaSelection = MappingUtils.mapColumnSelection(
+ proteinSelection, proteinView, dnaView);
assertEquals("[]", dnaSelection.getSelected().toString());
List<int[]> hidden = dnaSelection.getHiddenColumns();
assertEquals(1, hidden.size());
// deselect these or hideColumns will be expanded to include 0
proteinSelection.clear();
proteinSelection.hideColumns(1);
- dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView);
+ dnaSelection = MappingUtils.mapColumnSelection(proteinSelection,
+ proteinView, dnaView);
hidden = dnaSelection.getHiddenColumns();
assertEquals(1, hidden.size());
assertEquals("[0, 3]", Arrays.toString(hidden.get(0)));
proteinSelection.revealAllHiddenColumns();
proteinSelection.clear();
proteinSelection.hideColumns(2);
- dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView);
+ dnaSelection = MappingUtils.mapColumnSelection(proteinSelection,
+ proteinView, dnaView);
assertTrue(dnaSelection.getHiddenColumns().isEmpty());
/*
proteinSelection.clear();
proteinSelection.hideColumns(3); // 5-10 hidden in dna
proteinSelection.addElement(1); // 0-3 selected in dna
- dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView);
+ dnaSelection = MappingUtils.mapColumnSelection(proteinSelection,
+ proteinView, dnaView);
assertEquals("[0, 1, 2, 3]", dnaSelection.getSelected().toString());
hidden = dnaSelection.getHiddenColumns();
assertEquals(1, hidden.size());
proteinSelection.clear();
proteinSelection.hideColumns(1);
proteinSelection.hideColumns(3);
- dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView);
+ dnaSelection = MappingUtils.mapColumnSelection(proteinSelection,
+ proteinView, dnaView);
hidden = dnaSelection.getHiddenColumns();
assertEquals(2, hidden.size());
assertEquals("[0, 3]", Arrays.toString(hidden.get(0)));
int[] adjusted = MappingUtils.removeStartPositions(0, ranges);
assertEquals("[10, 1]", Arrays.toString(adjusted));
assertEquals("[10, 1]", Arrays.toString(ranges));
-
+
ranges = adjusted;
adjusted = MappingUtils.removeStartPositions(1, ranges);
assertEquals("[9, 1]", Arrays.toString(adjusted));
assertEquals("[10, 1]", Arrays.toString(ranges));
-
+
ranges = adjusted;
adjusted = MappingUtils.removeStartPositions(1, ranges);
assertEquals("[8, 1]", Arrays.toString(adjusted));
assertEquals("[9, 1]", Arrays.toString(ranges));
-
+
ranges = new int[] { 12, 11, 9, 6 };
adjusted = MappingUtils.removeStartPositions(1, ranges);
assertEquals("[11, 11, 9, 6]", Arrays.toString(adjusted));
assertEquals("[12, 11, 9, 6]", Arrays.toString(ranges));
-
+
ranges = new int[] { 12, 12, 8, 4 };
adjusted = MappingUtils.removeStartPositions(1, ranges);
assertEquals("[8, 4]", Arrays.toString(adjusted));
assertEquals("[12, 12, 8, 4]", Arrays.toString(ranges));
-
+
ranges = new int[] { 12, 12, 8, 4 };
adjusted = MappingUtils.removeStartPositions(2, ranges);
assertEquals("[7, 4]", Arrays.toString(adjusted));
assertEquals("[12, 12, 8, 4]", Arrays.toString(ranges));
-
+
ranges = new int[] { 12, 12, 10, 10, 8, 4 };
adjusted = MappingUtils.removeStartPositions(1, ranges);
assertEquals("[10, 10, 8, 4]", Arrays.toString(adjusted));
assertEquals("[12, 12, 10, 10, 8, 4]", Arrays.toString(ranges));
-
+
ranges = new int[] { 12, 12, 10, 10, 8, 4 };
adjusted = MappingUtils.removeStartPositions(2, ranges);
assertEquals("[8, 4]", Arrays.toString(adjusted));
assertEquals("[12, 12, 10, 10, 8, 4]", Arrays.toString(ranges));
-
+
ranges = new int[] { 12, 11, 8, 4 };
adjusted = MappingUtils.removeStartPositions(3, ranges);
assertEquals("[7, 4]", Arrays.toString(adjusted));
"ALISON" };
QuickSort.sort(values, things);
assertTrue(Arrays.equals(new String[] { "lucy", "henry", "henry",
- "JOHN",
- "ALISON" }, values));
+ "JOHN", "ALISON" }, values));
assertTrue(Arrays.equals(new Object[] { c3, c2, c4, c1, c5 }, things));
}
{
AlignCalcManagerI acm = alignFrame.getViewport().getCalcManager();
final AlignmentAnnotation ann1 = new AlignmentAnnotation("Ann1",
- "desc",
- new Annotation[] {});
+ "desc", new Annotation[] {});
final AlignmentAnnotation ann2 = new AlignmentAnnotation("Ann2",
- "desc",
- new Annotation[] {});
+ "desc", new Annotation[] {});
/*
* make two workers for ann1, one deletable, one not
}
}
- List<AlignCalcWorkerI> workers = acm.getRegisteredWorkersOfClass(worker1.getClass());
+ List<AlignCalcWorkerI> workers = acm
+ .getRegisteredWorkersOfClass(worker1.getClass());
assertEquals(2, workers.size());
assertTrue(workers.contains(worker1));
assertTrue(workers.contains(worker2));
}
};
return new AnnotationWorker(alignFrame.getViewport(),
- alignFrame.alignPanel,
- annotationProvider)
+ alignFrame.alignPanel, annotationProvider)
{
@Override
public boolean isDeletable()
@Test(groups = { "Network" }, enabled = true)
public void testRnaSeqRetrieve() throws Exception
{
- Cache.applicationProperties.setProperty("PDB_DOWNLOAD_FORMAT",
- "PDB");
+ Cache.applicationProperties.setProperty("PDB_DOWNLOAD_FORMAT", "PDB");
List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
AlignmentI response = sps.get(0).getSequenceRecords("2GIS");
assertTrue(response != null);
try
{
testRetrieval(argv[0], sp,
- argv.length > 1 ? argv[1] : sp
- .getTestQuery());
+ argv.length > 1 ? argv[1] : sp.getTestQuery());
} catch (Exception e)
{
e.printStackTrace();
assertEquals(6, seq.getDBRefs().length); // 2*Uniprot, PDB, PDBsum, 2*EMBL
}
+
/**
* Test the method that formats the sequence id
*/
{
UniprotEntry entry = new Uniprot().getUniprotEntries(
new StringReader(UNIPROT_XML)).get(0);
-
+
/*
* recommended names concatenated with space separator
*/
public void testRnaalifoldSettingsRecovery()
{
List<Argument> opts = new ArrayList<Argument>();
- for (Argument rg : (List<Argument>) rnaalifoldws
- .getRunnerConfig().getArguments())
+ for (Argument rg : (List<Argument>) rnaalifoldws.getRunnerConfig()
+ .getArguments())
{
if (rg.getDescription().contains("emperature"))
{
@BeforeTest(alwaysRun = true)
public void populateExpectedMapping() throws SiftsException
- {
+ {
expectedMapping.put(51, new int[] { 1, 2 });
expectedMapping.put(52, new int[] { 2, 7 });
expectedMapping.put(53, new int[] { 3, 12 });
expectedMapping.put(145, new int[] { 95, 714 });
expectedMapping.put(146, new int[] { 96, 722 });
expectedMapping.put(147, new int[] { 97, 729 });
- }
-
+ }
+
@BeforeTest(alwaysRun = true)
public void setUpSiftsClient() throws SiftsException
{
}
}
-
@Test(groups = { "Functional" })
public void getAllMappingAccessionTest()
{
try
{
HashMap<Integer, int[]> actualMapping = siftsClient.getGreedyMapping(
- "A", testSeq,
- null);
+ "A", testSeq, null);
Assert.assertEquals(testSeq.getStart(), 1);
Assert.assertEquals(testSeq.getEnd(), 147);
Assert.assertEquals(actualMapping, expectedMapping);
private void populateAtomPositionsNullTest1()
throws IllegalArgumentException, SiftsException
{
- siftsClient.populateAtomPositions(null, null);
+ siftsClient.populateAtomPositions(null, null);
}
@Test(
expectedExceptions = SiftsException.class)
public void getValidSourceDBRefExceptionTest() throws SiftsException
{
- SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH");
+ SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH");
try
{
siftsClient.getValidSourceDBRef(invalidTestSeq);