import jalview.util.DBRefUtils;
import jalview.util.MapList;
import jalview.util.StringUtils;
+import jalview.workers.InformationThread;
import java.util.ArrayList;
import java.util.Arrays;
private String vamsasId;
+ HiddenMarkovModel hmm;
+
+ boolean isHMMConsensusSequence = false;
private DBModList<DBRefEntry> dbrefs; // controlled access
/**
this.addPDBId(new PDBEntry(pdb));
}
}
+ if (seq.getHMM() != null)
+ {
+ this.hmm = new HiddenMarkovModel(seq.getHMM(), this);
+ }
}
@Override
}
/**
- * DOCUMENT ME!
+ * Answers the sequence name, with '/start-end' appended if jvsuffix is true
*
- * @return DOCUMENT ME!
+ * @return
*/
@Override
public String getDisplayId(boolean jvsuffix)
{
- StringBuffer result = new StringBuffer(name);
- if (jvsuffix)
+ if (!jvsuffix)
{
- result.append("/" + start + "-" + end);
+ return name;
}
+ StringBuilder result = new StringBuilder(name);
+ result.append("/").append(start).append("-").append(end);
return result.toString();
}
public void setStart(int start)
{
this.start = start;
+ sequenceChanged();
}
/**
public void setGeneLoci(String speciesId, String assemblyId,
String chromosomeId, MapList map)
{
- addDBRef(new DBRefEntry(speciesId, assemblyId,
- DBRefEntry.CHROMOSOME + ":" + chromosomeId, new Mapping(map)));
+ addDBRef(new GeneLocus(speciesId, assemblyId, chromosomeId,
+ new Mapping(map)));
}
/**
{
for (final DBRefEntry ref : refs)
{
- if (ref.isChromosome())
+ if (ref instanceof GeneLociI)
{
- return new GeneLociI()
- {
- @Override
- public String getSpeciesId()
- {
- return ref.getSource();
- }
-
- @Override
- public String getAssemblyId()
- {
- // DEV NOTE: DBRefEntry is reused here to hold chromosomal locus
- // of a gene sequence.
- // source=species, version=assemblyId, accession=chromosome, map =
- // positions.
-
- return ref.getVersion();
- }
-
- @Override
- public String getChromosomeId()
- {
- // strip off "chromosome:" prefix to chrId
- return ref.getAccessionId()
- .substring(DBRefEntry.CHROMOSOME.length() + 1);
- }
-
- @Override
- public MapList getMap()
- {
- return ref.getMap().getMap();
- }
- };
+ return (GeneLociI) ref;
}
}
}
@Override
public ContiguousI findPositions(int fromColumn, int toColumn)
{
- if (toColumn < fromColumn || fromColumn < 1)
+ fromColumn = Math.max(fromColumn, 1);
+ if (toColumn < fromColumn)
{
return null;
}
@Override
public void addDBRef(DBRefEntry entry)
{
+ // TODO JAL-3980 maintain as sorted list
if (datasetSequence != null)
{
datasetSequence.addDBRef(entry);
{
dbrefs = new DBModList<>();
}
+ // TODO JAL-3979 LOOK UP RATHER THAN SWEEP FOR EFFICIENCY
for (int ib = 0, nb = dbrefs.size(); ib < nb; ib++)
{
_isNa = Comparison.isNucleotide(this);
}
return !_isNa;
- };
+ }
/*
* (non-Javadoc)
public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
String label)
{
+ return getAlignmentAnnotations(calcId, label, null, true);
+ }
+
+ @Override
+ public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label, String description)
+ {
+ return getAlignmentAnnotations(calcId, label, description, false);
+ }
+
+ private List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label, String description, boolean ignoreDescription)
+ {
List<AlignmentAnnotation> result = new ArrayList<>();
if (this.annotation != null)
{
for (AlignmentAnnotation ann : annotation)
{
- if (ann.calcId != null && ann.calcId.equals(calcId)
- && ann.label != null && ann.label.equals(label))
+ String id = ann.getCalcId();
+ if ((id != null && id.equals(calcId))
+ && (ann.label != null && ann.label.equals(label))
+ && ((ignoreDescription && description == null)
+ || (ann.description != null
+ && ann.description.equals(description))))
{
result.add(ann);
}
}
}
+ @Override
+ public HiddenMarkovModel getHMM()
+ {
+ return hmm;
+ }
+
+ @Override
+ public void setHMM(HiddenMarkovModel hmm)
+ {
+ this.hmm = hmm;
+ }
+
+ @Override
+ public boolean hasHMMAnnotation()
+ {
+ if (this.annotation == null) {
+ return false;
+ }
+ for (AlignmentAnnotation ann : annotation)
+ {
+ if (InformationThread.HMM_CALC_ID.equals(ann.getCalcId()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
/**
* {@inheritDoc}
*/
List<SequenceFeature> result = getFeatures().findFeatures(startPos,
endPos, types);
- if (datasetSequence != null)
- {
- result = datasetSequence.getFeatures().findFeatures(startPos, endPos,
- types);
- }
- else
- {
- result = sequenceFeatureStore.findFeatures(startPos, endPos, types);
- }
/*
* if end column is gapped, endPos may be to the right,
// otherwise, sequence was completely hidden
return 0;
}
+
+ @Override
+ public boolean hasHMMProfile()
+ {
+ return hmm != null;
+ }
}