import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.util.DBRefUtils;
+import jalview.util.DnaUtils;
import jalview.util.MapList;
import jalview.util.MappingUtils;
import jalview.util.StringUtils;
String accession;
- String version;
+ String entryVersion;
+
+ String sequenceVersion;
+
+ String moleculeType;
+
+ String topology;
+
+ String sequenceLength;
String taxDivision;
}
/**
- * @return the version
+ * @return the entry version
*/
- public String getVersion()
+ public String getEntryVersion()
{
- return version;
+ return entryVersion;
}
/**
* @param version
* the version to set
*/
- public void setVersion(String version)
+ public void setEntryVersion(String version)
{
- this.version = version;
+ this.entryVersion = version;
}
/**
SequenceI dna = new Sequence(sourceDb + "|" + accession,
sequence.getSequence());
dna.setDescription(desc);
- DBRefEntry retrievedref = new DBRefEntry(sourceDb, version, accession);
+ DBRefEntry retrievedref = new DBRefEntry(sourceDb,
+ getSequenceVersion(), accession);
dna.addDBRef(retrievedref);
// add map to indicate the sequence is a valid coordinate frame for the
// dbref
DBRefEntry pcdnaref = new DBRefEntry();
pcdnaref.setAccessionId(prid);
pcdnaref.setSource(DBRefSource.EMBLCDS);
- pcdnaref.setVersion(getVersion()); // same as parent EMBL version.
+ pcdnaref.setVersion(getSequenceVersion()); // same as parent EMBL
+ // version.
MapList mp = new MapList(new int[] { 1, prseq.length() },
new int[] { 1 + (codonStart - 1),
(codonStart - 1) + 3 * prseq.length() }, 1, 3);
SequenceFeature sf = makeCdsFeature(exon, xint, prname, prid, vals,
codonStart);
sf.setType(feature.getName()); // "CDS"
+ sf.setEnaLocation(feature.getLocation());
sf.setFeatureGroup(sourceDb);
dna.addSequenceFeature(sf);
}
if (map != null)
{
Mapping pmap = new Mapping(dna, map.getMap().getInverse());
- pref = new DBRefEntry(sourceDb, getVersion(),
+ pref = new DBRefEntry(sourceDb, getSequenceVersion(),
this.getAccession());
pref.setMap(pmap);
if (map.getTo() != null)
protEMBLCDS = new DBRefEntry();
protEMBLCDS.setAccessionId(prid);
protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct);
- protEMBLCDS.setVersion(getVersion());
+ protEMBLCDS.setVersion(getSequenceVersion());
protEMBLCDS
.setMap(new Mapping(product, map.getMap().getInverse()));
}
*/
protected int[] getCdsRanges(EmblFeature feature)
{
- if (feature.locations == null)
+ if (feature.location == null)
{
return new int[] {};
}
- int cdsBoundaryCount = 0; // count of all start/stop locations
- int[][] cdsLocations = new int[feature.locations.size()][];
- int locationNumber = 0;
- for (EmblFeatureLocations loc : feature.locations)
- {
- int[] locationRanges = loc.getElementRanges(accession);
- cdsLocations[locationNumber++] = locationRanges;
- cdsBoundaryCount += locationRanges.length;
- }
- int[] cdsRanges = new int[cdsBoundaryCount];
- int copyTo = 0;
- for (int[] ranges : cdsLocations)
+ List<int[]> ranges = DnaUtils.parseLocation(feature.location);
+ return ranges == null ? new int[] {} : listToArray(ranges);
+ }
+
+ /**
+ * Converts a list of [start, end] ranges to a single array of [start, end,
+ * start, end ...]
+ *
+ * @param ranges
+ * @return
+ */
+ int[] listToArray(List<int[]> ranges)
+ {
+ int[] result = new int[ranges.size() * 2];
+ int i = 0;
+ for (int[] range : ranges)
{
- System.arraycopy(ranges, 0, cdsRanges, copyTo, ranges.length);
- copyTo += ranges.length;
+ result[i++] = range[0];
+ result[i++] = range[1];
}
- return cdsRanges;
-
+ return result;
}
/**
}
return exon;
}
+
+ public String getSequenceVersion()
+ {
+ return sequenceVersion;
+ }
+
+ public void setSequenceVersion(String sequenceVersion)
+ {
+ this.sequenceVersion = sequenceVersion;
+ }
+
+ public String getMoleculeType()
+ {
+ return moleculeType;
+ }
+
+ public void setMoleculeType(String moleculeType)
+ {
+ this.moleculeType = moleculeType;
+ }
+
+ public String getTopology()
+ {
+ return topology;
+ }
+
+ public void setTopology(String topology)
+ {
+ this.topology = topology;
+ }
+
+ public String getSequenceLength()
+ {
+ return sequenceLength;
+ }
+
+ public void setSequenceLength(String sequenceLength)
+ {
+ this.sequenceLength = sequenceLength;
+ }
+
+ public String getrCreated()
+ {
+ return rCreated;
+ }
+
+ public void setrCreated(String rCreated)
+ {
+ this.rCreated = rCreated;
+ }
+
+ public String getrLastUpdated()
+ {
+ return rLastUpdated;
+ }
+
+ public void setrLastUpdated(String rLastUpdated)
+ {
+ this.rLastUpdated = rLastUpdated;
+ }
}