+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.datamodel.xdb.embl;
import static org.testng.AssertJUnit.assertEquals;
public class EmblFileTest
{
// adapted from http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml
- private static final String TESTDATA =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ private static final String TESTDATA = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ "<EMBL_Services>"
+ "<entry accession=\"X53828\" version=\"3\" lastUpdated=\"2005-04-18\" releaseCreated=\"25\" releaseLastUpdated=\"83\">"
+ "<description>Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)</description>"
+ "<keyword>L-lactate dehydrogenase</keyword><keyword>chutney</keyword>"
+ "<dbreference db=\"EuropePMC\" primary=\"PMC1460223\" secondary=\"9649548\" />"
+ + "<dbreference db=\"MD5\" primary=\"d3b68\" />"
+ "<feature name=\"CDS\"><dbreference db=\"GOA\" primary=\"P00340\" secondary=\"2.1\" /><dbreference db=\"InterPro\" primary=\"IPR001236\" />"
+ "<qualifier name=\"note\"><value>L-lactate dehydrogenase A-chain</value><value>pickle</value></qualifier>"
+ "<qualifier name=\"translation\"><value>MSLKDHLIHN</value><evidence>Keith</evidence></qualifier>"
+ "<location type=\"single\" complement=\"true\">"
- + "<locationElement type=\"range\" accession=\"X53828\" version=\"1\" complement=\"false\">"
+ + "<locationElement type=\"range\" accession=\"X53828\" version=\"1\" complement=\"false\">"
+ "<basePosition type=\"simple\">60</basePosition><basePosition type=\"join\">1058</basePosition>"
- + "</locationElement></location></feature>"
+ + "</locationElement></location></feature>"
+ "<sequence type=\"mRNA\" version=\"2\">GTGACG</sequence></entry></EMBL_Services>";
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetEmblFile()
{
Vector<EmblEntry> entries = EmblFile.getEmblFile(
/*
* dbrefs
*/
- assertEquals(1, entry.getDbRefs().size());
+ assertEquals(2, entry.getDbRefs().size());
DBRefEntry dbref = entry.getDbRefs().get(0);
assertEquals("EuropePMC", dbref.getSource());
assertEquals("PMC1460223", dbref.getAccessionId());
assertEquals("9649548", dbref.getVersion());
+ dbref = entry.getDbRefs().get(1);
+ assertEquals("MD5", dbref.getSource());
+ assertEquals("d3b68", dbref.getAccessionId());
+ // blank version has been converted to "0"
+ assertEquals("0", dbref.getVersion());
/*
* sequence features
dbref = ef.getDbRefs().get(1);
assertEquals("InterPro", dbref.getSource());
assertEquals("IPR001236", dbref.getAccessionId());
- assertEquals("", dbref.getVersion());
+ // blank version converted to "0":
+ assertEquals("0", dbref.getVersion());
assertEquals(2, ef.getQualifiers().size());
// feature qualifiers
assertEquals("mRNA", seq.getType());
assertEquals("2", seq.getVersion());
assertEquals("GTGACG", seq.getSequence());
+
+ /*
+ * getSequence() converts empty DBRefEntry.version to "0"
+ */
+ assertEquals("0", entry.getDbRefs().get(1).getVersion());
+ assertEquals("0", entry.getFeatures().get(0).getDbRefs().get(1)
+ .getVersion());
}
}