// private key for Phase designed not to conflict with real GFF data
private static final String PHASE = "!Phase";
+ // private key for ENA location designed not to conflict with real GFF data
+ private static final String LOCATION = "!Location";
+
/*
* ATTRIBUTES is reserved for the GFF 'column 9' data, formatted as
* name1=value1;name2=value2,value3;...etc
public String description;
+ /*
+ * a map of key-value pairs; may be populated from GFF 'column 9' data,
+ * other data sources (e.g. GenBank file), or programmatically
+ */
public Map<String, Object> otherDetails;
public Vector<String> links;
}
/**
+ * Sets the 'raw' ENA format location specifier e.g. join(12..45,89..121)
+ *
+ * @param loc
+ */
+ public void setEnaLocation(String loc)
+ {
+ setValue(LOCATION, loc);
+ }
+
+ /**
+ * Gets the 'raw' ENA format location specifier e.g. join(12..45,89..121)
+ *
+ * @param loc
+ */
+ public String getEnaLocation()
+ {
+ return (String) getValue(LOCATION);
+ }
+
+ /**
* Readable representation, for debug only, not guaranteed not to change
* between versions
*/
SequenceFeature sf = makeCdsFeature(exon, xint, prname, prid, vals,
codonStart);
sf.setType(feature.getName()); // "CDS"
+ sf.setEnaLocation(feature.getLocation());
sf.setFeatureGroup(sourceDb);
dna.addSequenceFeature(sf);
}
import static org.testng.AssertJUnit.assertEquals;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import org.testng.annotations.Test;
assertEquals("[10, 20, 40, 30, 50, 60, 70, 80, 120, 110]",
Arrays.toString(exons));
}
+
+ @Test(groups = "Functional")
+ public void testParseCodingFeature()
+ {
+ // not the whole sequence but enough for this test...
+ SequenceI dna = new Sequence("J03321", "GGATCCGTAAGTTAGACGAAATT");
+ List<SequenceI> peptides = new ArrayList<SequenceI>();
+ EmblFile ef = EmblTestHelper.getEmblFile();
+ EmblFeature feature = null;
+ for (EmblFeature feat : ef.getEntries().get(0).getFeatures())
+ {
+ if ("CDS".equals(feat.getName()))
+ {
+ feature = feat;
+ break;
+ }
+ }
+
+ EmblEntry testee = new EmblEntry();
+ testee.parseCodingFeature(feature, "EMBL", dna, peptides);
+ }
}
import jalview.datamodel.DBRefEntry;
-import java.io.StringReader;
import java.util.Vector;
import org.testng.annotations.Test;
public class EmblFileTest
{
- // adapted from http://www.ebi.ac.uk/ena/data/view/x53828&display=xml
- private static final String TESTDATA = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
- + "<ROOT>"
- + "<entry accession=\"X53828\" entryVersion=\"3\" lastUpdated=\"2005-04-18\" releaseCreated=\"25\" releaseLastUpdated=\"83\""
- + " version=\"1\" moleculeType=\"mRNA\" topology=\"linear\" sequenceLength=\"1575\">"
- + "<description>Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)</description>"
- + "<keyword>L-lactate dehydrogenase</keyword><keyword>chutney</keyword>"
- + "<xref db=\"EuropePMC\" id=\"PMC1460223\" secondaryId=\"9649548\" />"
- + "<xref db=\"MD5\" id=\"d3b68\" />"
- + "<feature name=\"CDS\" location=\"60..1058\">"
- + "<xref db=\"GOA\" id=\"P00340\" secondaryId=\"2.1\" /><xref db=\"InterPro\" id=\"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>"
- + "</feature>"
- + "<sequence>GTGACG</sequence></entry></ROOT>";
@Test(groups = { "Functional" })
public void testGetEmblFile()
{
- Vector<EmblEntry> entries = EmblFile.getEmblFile(
- new StringReader(TESTDATA)).getEntries();
+ Vector<EmblEntry> entries = EmblTestHelper.getEmblFile().getEntries();
assertEquals(1, entries.size());
EmblEntry entry = entries.get(0);
--- /dev/null
+package jalview.datamodel.xdb.embl;
+
+import java.io.StringReader;
+
+public class EmblTestHelper
+{
+ // adapted from http://www.ebi.ac.uk/ena/data/view/x53828&display=xml
+ private static final String TESTDATA = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ + "<ROOT>"
+ + "<entry accession=\"X53828\" entryVersion=\"3\" lastUpdated=\"2005-04-18\" releaseCreated=\"25\" releaseLastUpdated=\"83\""
+ + " version=\"1\" moleculeType=\"mRNA\" topology=\"linear\" sequenceLength=\"1575\">"
+ + "<description>Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)</description>"
+ + "<keyword>L-lactate dehydrogenase</keyword><keyword>chutney</keyword>"
+ + "<xref db=\"EuropePMC\" id=\"PMC1460223\" secondaryId=\"9649548\" />"
+ + "<xref db=\"MD5\" id=\"d3b68\" />"
+ + "<feature name=\"CDS\" location=\"60..1058\">"
+ + "<xref db=\"GOA\" id=\"P00340\" secondaryId=\"2.1\" /><xref db=\"InterPro\" id=\"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>"
+ + "</feature>" + "<sequence>GTGACG</sequence></entry></ROOT>";
+
+ static EmblFile getEmblFile()
+ {
+ return EmblFile.getEmblFile(new StringReader(TESTDATA));
+ }
+}