/**
*
- * Implements the SequenceI interface for a char[] based sequence object.
- *
- * @author $author$
- * @version $Revision$
+ * Implements the SequenceI interface for a char[] based sequence object
*/
public class Sequence extends ASequence implements SequenceI
{
}
/**
- * 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()
- {
- 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;
}
}
}
* preserve end residue column provided cursor was valid
*/
int endColumn = isValidCursor(cursor) ? cursor.lastColumnPosition : 0;
+
if (residuePos == this.end)
{
endColumn = column;
/*
* move left or right to find pos from hint.position
*/
- int col = curs.columnPosition - 1; // convert from base 1 to 0-based array
- // index
+ int col = curs.columnPosition - 1; // convert from base 1 to base 0
int newPos = curs.residuePosition;
int delta = newPos > pos ? -1 : 1;
boolean createNewDs = false;
// TODO: take a (second look) at the dataset creation validation method for
// the very large sequence case
+
int startIndex = findIndex(start) - 1;
int endIndex = findIndex(end) - 1;
int startDeleteColumn = -1; // for dataset sequence deletions
int deleteCount = 0;
- for (int s = i; s < j; s++)
+ for (int s = i; s < j && s < sequence.length; s++)
{
if (Comparison.isGap(sequence[s]))
{