1 package jalview.io.vamsas;
\r
3 import jalview.datamodel.DBRefEntry;
\r
4 import jalview.datamodel.SequenceI;
\r
5 import uk.ac.vamsas.objects.core.DbRef;
\r
6 import uk.ac.vamsas.objects.core.Map;
\r
7 import uk.ac.vamsas.objects.core.Sequence;
\r
8 import jalview.io.VamsasAppDatastore;
\r
10 public class Dbref extends Rangetype
\r
12 jalview.datamodel.SequenceI sq = null;
\r
13 uk.ac.vamsas.objects.core.Sequence sequence = null;
\r
15 DBRefEntry dbentry=null;
\r
16 public Dbref(VamsasAppDatastore datastore, DBRefEntry dbentry, jalview.datamodel.SequenceI sq2, uk.ac.vamsas.objects.core.Sequence sequence2)
\r
19 dbref = (DbRef) getjv2vObj(dbentry);
\r
21 sequence = sequence2;
\r
22 this.dbentry = dbentry;
\r
27 if (dbref.isUpdated())
\r
38 public Dbref(VamsasAppDatastore datastore, DbRef ref, Sequence vdseq, SequenceI dsseq)
\r
44 dbentry = (jalview.datamodel.DBRefEntry) getvObj2jv(dbref);
\r
45 if (dbentry == null)
\r
49 if (dbref.isUpdated())
\r
56 private void update()
\r
58 // TODO: verify and update dbrefs in vamsas document
\r
59 // there will be trouble when a dataset sequence is modified to
\r
60 // contain more residues than were originally referenced - we must
\r
61 // then make a number of dataset sequence entries - this info is already stored
\r
62 jalview.bin.Cache.log.debug("TODO verify update of dataset sequence database references.");
\r
65 private void conflict()
\r
67 jalview.bin.Cache.log.debug("Conflict in dbentry update for "+dbref.getAccessionId()+dbref.getSource()+" "+dbref.getVorbaId());
\r
68 // TODO Auto-generated method stub
\r
71 private void addFromDocument()
\r
74 sq.addDBRef(dbentry = new jalview.datamodel.DBRefEntry
\r
76 dbref.getSource().toString(),
\r
77 dbref.getVersion().toString(),
\r
78 dbref.getAccessionId().toString()));
\r
79 if (dbref.getMapCount()>0)
\r
81 // TODO: Jalview ignores all the other maps
\r
82 if (dbref.getMapCount()>1)
\r
84 jalview.bin.Cache.log.debug("Ignoring additional mappings on DbRef: "+dbentry.getSource()+":"+dbentry.getAccessionId());
\r
86 jalview.datamodel.Mapping mp = new jalview.datamodel.Mapping(parsemapType(dbref.getMap(0)));
\r
89 // TODO: jalview ignores links and properties because it doesn't know what to do with them.
\r
91 bindjvvobj(dbentry, dbref);
\r
95 DbRef dbref = new DbRef();
\r
96 bindjvvobj(dbentry, dbref);
\r
97 dbref.setAccessionId(dbentry.getAccessionId());
\r
98 dbref.setSource(dbentry.getSource());
\r
99 dbref.setVersion(dbentry.getVersion());
\r
100 if (dbentry.getMap()!=null)
\r
102 jalview.datamodel.Mapping mp = dbentry.getMap();
\r
103 if (mp.getMap()!=null)
\r
105 Map vMap = new Map();
\r
106 initMapType(vMap, mp.getMap(), true);
\r
107 dbref.addMap(vMap);
\r
109 jalview.bin.Cache.log.debug("Ignoring mapless DbRef.Map "+dbentry.getSrcAccString());
\r
112 sequence.addDbRef(dbref);
\r