import uk.ac.vamsas.objects.core.DbRef;
import uk.ac.vamsas.objects.core.Map;
import uk.ac.vamsas.objects.core.Sequence;
+import uk.ac.vamsas.objects.core.SequenceType;
import jalview.io.VamsasAppDatastore;
public class Dbref extends Rangetype
updateMapTo(mp);
}
}
- else
- {
- jalview.bin.Cache.log.debug("Ignoring mapless DbRef.Map "
- + jvobj.getSrcAccString());
- }
-
+ else
+ {
+ jalview.bin.Cache.log.debug("Ignoring mapless DbRef.Map "
+ + jvobj.getSrcAccString());
+ }
+
}
+
/**
- * ugly hack to try to get the embedded sequences within a database reference to be stored in the document's dataset.
+ * ugly hack to try to get the embedded sequences within a database reference
+ * to be stored in the document's dataset.
+ *
* @param mp
*/
private void updateMapTo(jalview.datamodel.Mapping mp)
{
- log.info("Performing updateMapTo remove this message when we know what we're doing.");
- // TODO determine how sequences associated with database mappings are stored in the document
- if (mp!=null && mp.getTo() != null)
+ log
+ .info("Performing updateMapTo remove this message when we know what we're doing.");
+ // TODO determine how sequences associated with database mappings are stored
+ // in the document
+ if (mp != null && mp.getTo() != null)
{
if (mp.getTo().getDatasetSequence() == null)
{
- if (!dsReg.isInvolvedInDsitem(mp.getTo()))
+ // TODO: fix this hinky sh!t
+ DatastoreItem dssync = dsReg.getDatastoreItemFor(mp.getTo());
+ if (dssync == null)
{
// sync the dataset sequence, if it hasn't been done already.
- Datasetsequence dssync = new Datasetsequence(
- datastore, mp.getTo(),
- (mp.getMappedWidth() == mp.getWidth()) ? sequence
- .getDictionary()
- : ((mp.getMappedWidth() == 3) ? uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_AA
- : uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA),
- ds);
- // add a mapping between new dataset sequence and sequence associated with the database reference
+ // TODO: ensure real dataset sequence corresponding to getTo is
+ // recovered
+ dssync = new Datasetsequence(
+ datastore,
+ mp.getTo(),
+ (mp.getMappedWidth() == mp.getWidth()) ? sequence
+ .getDictionary()
+ : ((mp.getMappedWidth() == 3) ? uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA
+ : uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_AA),
+ ds);
}
+ //
+ // TODO: NOW add a mapping between new dataset sequence and sequence
+ // associated with the database reference
- } else {
- log.debug("Ignoring non-dataset sequence mapping.");
+ // dna mappings only...
+ // new jalview.io.vamsas.Sequencemapping(datastore, mp, sequence, ds);
+
}
+
+ }
+ else
+ {
+ log.debug("Ignoring non-dataset sequence mapping.");
}
}
+
public void updateFromDoc()
{
DbRef vobj = (DbRef) this.vobj;
}
jalview.datamodel.Mapping mp = new jalview.datamodel.Mapping(
parsemapType(vobj.getMap(0)));
- if (jvobj.getMap()==null || !mp.equals(jvobj.getMap()))
+ if (jvobj.getMap() == null || !mp.equals(jvobj.getMap()))
{
jvobj.setMap(mp);
}
}
}
-
+
public void conflict()
{
DbRef vobj = (DbRef) this.vobj;
dbref.setAccessionId(jvobj.getAccessionId());
dbref.setSource(jvobj.getSource());
dbref.setVersion(jvobj.getVersion());
+ sequence.addDbRef(dbref);
if (jvobj.getMap() != null)
{
jalview.datamodel.Mapping mp = jvobj.getMap();
Map vMap = new Map();
initMapType(vMap, mp.getMap(), true);
dbref.addMap(vMap);
+ updateMapTo(mp);
}
else
{
+ jvobj.getSrcAccString());
}
}
- sequence.addDbRef(dbref);
}
}