2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.datamodel;
23 * Data structure to hold and manipulate a multiple sequence alignment
29 public class Alignment implements AlignmentI
31 protected Alignment dataset;
33 protected List<SequenceI> sequences;
35 protected List<SequenceGroup> groups = java.util.Collections
36 .synchronizedList(new ArrayList<SequenceGroup>());
38 protected char gapCharacter = '-';
40 protected int type = NUCLEOTIDE;
42 public static final int PROTEIN = 0;
44 public static final int NUCLEOTIDE = 1;
46 public boolean hasRNAStructure = false;
49 public AlignmentAnnotation[] annotations;
51 HiddenSequences hiddenSequences = new HiddenSequences(this);
53 public Hashtable alignmentProperties;
55 private void initAlignment(SequenceI[] seqs)
59 if (jalview.util.Comparison.isNucleotide(seqs))
68 sequences = java.util.Collections
69 .synchronizedList(new ArrayList<SequenceI>());
71 for (i = 0; i < seqs.length; i++)
73 sequences.add(seqs[i]);
79 * Make an alignment from an array of Sequences.
83 public Alignment(SequenceI[] seqs)
89 * Make a new alignment from an array of SeqCigars
94 public Alignment(SeqCigar[] alseqs)
96 SequenceI[] seqs = SeqCigar.createAlignmentSequences(alseqs,
97 gapCharacter, new ColumnSelection(), null);
102 * Make a new alignment from an CigarArray JBPNote - can only do this when
103 * compactAlignment does not contain hidden regions. JBPNote - must also check
104 * that compactAlignment resolves to a set of SeqCigars - or construct them
107 * @param compactAlignment
110 public static AlignmentI createAlignment(CigarArray compactAlignment)
112 throw new Error("Alignment(CigarArray) not yet implemented");
113 // this(compactAlignment.refCigars);
119 * @return DOCUMENT ME!
122 public List<SequenceI> getSequences()
128 public List<SequenceI> getSequences(
129 Map<SequenceI, SequenceCollectionI> hiddenReps)
131 // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to
137 public SequenceI[] getSequencesArray()
139 if (sequences == null)
141 synchronized (sequences)
143 return sequences.toArray(new SequenceI[sequences.size()]);
153 * @return DOCUMENT ME!
156 public SequenceI getSequenceAt(int i)
158 synchronized (sequences)
160 if (i > -1 && i < sequences.size())
162 return sequences.get(i);
169 * Adds a sequence to the alignment. Recalculates maxLength and size.
174 public void addSequence(SequenceI snew)
178 // maintain dataset integrity
179 if (snew.getDatasetSequence() != null)
181 getDataset().addSequence(snew.getDatasetSequence());
185 // derive new sequence
186 SequenceI adding = snew.deriveSequence();
187 getDataset().addSequence(adding.getDatasetSequence());
191 if (sequences == null)
193 initAlignment(new SequenceI[]
198 synchronized (sequences)
203 if (hiddenSequences != null)
204 hiddenSequences.adjustHeightSequenceAdded();
208 * Adds a sequence to the alignment. Recalculates maxLength and size.
213 public void setSequenceAt(int i, SequenceI snew)
215 SequenceI oldseq = getSequenceAt(i);
217 synchronized (sequences)
219 sequences.set(i, snew);
226 * @return DOCUMENT ME!
229 public List<SequenceGroup> getGroups()
235 public void finalize()
237 if (getDataset() != null)
238 getDataset().removeAlignmentRef();
244 hiddenSequences = null;
248 * decrement the alignmentRefs counter by one and call finalize if it goes to
251 private void removeAlignmentRef()
253 if (--alignmentRefs == 0)
266 public void deleteSequence(SequenceI s)
268 deleteSequence(findIndex(s));
278 public void deleteSequence(int i)
280 if (i > -1 && i < getHeight())
282 synchronized (sequences)
286 hiddenSequences.adjustHeightSequenceDeleted(i);
293 * @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
296 public SequenceGroup findGroup(SequenceI s)
298 synchronized (groups)
300 for (int i = 0; i < this.groups.size(); i++)
302 SequenceGroup sg = groups.get(i);
304 if (sg.getSequences(null).contains(s))
317 * jalview.datamodel.AlignmentI#findAllGroups(jalview.datamodel.SequenceI)
320 public SequenceGroup[] findAllGroups(SequenceI s)
322 ArrayList<SequenceGroup> temp = new ArrayList<SequenceGroup>();
324 synchronized (groups)
326 int gSize = groups.size();
327 for (int i = 0; i < gSize; i++)
329 SequenceGroup sg = groups.get(i);
330 if (sg == null || sg.getSequences(null) == null)
332 this.deleteGroup(sg);
337 if (sg.getSequences(null).contains(s))
343 SequenceGroup[] ret = new SequenceGroup[temp.size()];
344 return temp.toArray(ret);
349 public void addGroup(SequenceGroup sg)
351 synchronized (groups)
353 if (!groups.contains(sg))
355 if (hiddenSequences.getSize() > 0)
357 int i, iSize = sg.getSize();
358 for (i = 0; i < iSize; i++)
360 if (!sequences.contains(sg.getSequenceAt(i)))
362 sg.deleteSequence(sg.getSequenceAt(i), false);
368 if (sg.getSize() < 1)
380 * remove any annotation that references gp
383 * (if null, removes all group associated annotation)
385 private void removeAnnotationForGroup(SequenceGroup gp)
387 if (annotations == null || annotations.length == 0)
391 // remove annotation very quickly
392 AlignmentAnnotation[] t, todelete = new AlignmentAnnotation[annotations.length], tokeep = new AlignmentAnnotation[annotations.length];
396 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
398 if (annotations[i].groupRef != null)
400 todelete[p++] = annotations[i];
404 tokeep[k++] = annotations[i];
410 for (i = 0, p = 0, k = 0; i < annotations.length; i++)
412 if (annotations[i].groupRef == gp)
414 todelete[p++] = annotations[i];
418 tokeep[k++] = annotations[i];
424 // clear out the group associated annotation.
425 for (i = 0; i < p; i++)
427 unhookAnnotation(todelete[i]);
430 t = new AlignmentAnnotation[k];
431 for (i = 0; i < k; i++)
440 public void deleteAllGroups()
442 synchronized (groups)
444 if (annotations != null)
446 removeAnnotationForGroup(null);
454 public void deleteGroup(SequenceGroup g)
456 synchronized (groups)
458 if (groups.contains(g))
460 removeAnnotationForGroup(g);
468 public SequenceI findName(String name)
470 return findName(name, false);
476 * @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
479 public SequenceI findName(String token, boolean b)
481 return findName(null, token, b);
487 * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
491 public SequenceI findName(SequenceI startAfter, String token, boolean b)
496 String sqname = null;
497 if (startAfter != null)
499 // try to find the sequence in the alignment
500 boolean matched = false;
501 while (i < sequences.size())
503 if (getSequenceAt(i++) == startAfter)
514 while (i < sequences.size())
516 sq = getSequenceAt(i);
517 sqname = sq.getName();
518 if (sqname.equals(token) // exact match
519 || (b && // allow imperfect matches - case varies
520 (sqname.equalsIgnoreCase(token))))
522 return getSequenceAt(i);
532 public SequenceI[] findSequenceMatch(String name)
534 Vector matches = new Vector();
537 while (i < sequences.size())
539 if (getSequenceAt(i).getName().equals(name))
541 matches.addElement(getSequenceAt(i));
546 SequenceI[] result = new SequenceI[matches.size()];
547 for (i = 0; i < result.length; i++)
549 result[i] = (SequenceI) matches.elementAt(i);
559 * @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
562 public int findIndex(SequenceI s)
566 while (i < sequences.size())
568 if (s == getSequenceAt(i))
583 * jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
586 public int findIndex(SearchResults results)
590 while (i < sequences.size())
592 if (results.involvesSequence(getSequenceAt(i)))
604 * @return DOCUMENT ME!
607 public int getHeight()
609 return sequences.size();
615 * @return DOCUMENT ME!
618 public int getWidth()
622 for (int i = 0; i < sequences.size(); i++)
624 if (getSequenceAt(i).getLength() > maxLength)
626 maxLength = getSequenceAt(i).getLength();
640 public void setGapCharacter(char gc)
643 synchronized (sequences)
645 for (SequenceI seq : sequences)
647 seq.setSequence(seq.getSequenceAsString().replace('.', gc)
648 .replace('-', gc).replace(' ', gc));
656 * @return DOCUMENT ME!
659 public char getGapCharacter()
667 * @see jalview.datamodel.AlignmentI#isAligned()
670 public boolean isAligned()
672 return isAligned(false);
678 * @see jalview.datamodel.AlignmentI#isAligned(boolean)
681 public boolean isAligned(boolean includeHidden)
683 int width = getWidth();
684 if (hiddenSequences == null || hiddenSequences.getSize() == 0)
686 includeHidden = true; // no hidden sequences to check against.
688 for (int i = 0; i < sequences.size(); i++)
690 if (includeHidden || !hiddenSequences.isHidden(getSequenceAt(i)))
692 if (getSequenceAt(i).getLength() != width)
705 * @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
706 * AlignmentAnnotation)
709 public boolean deleteAnnotation(AlignmentAnnotation aa)
711 return deleteAnnotation(aa, true);
715 public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
719 if (annotations != null)
721 aSize = annotations.length;
729 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
731 boolean swap = false;
734 for (int i = 0; i < aSize; i++)
736 if (annotations[i] == aa)
741 if (tIndex < temp.length)
742 temp[tIndex++] = annotations[i];
750 unhookAnnotation(aa);
757 * remove any object references associated with this annotation
761 private void unhookAnnotation(AlignmentAnnotation aa)
763 if (aa.sequenceRef != null)
765 aa.sequenceRef.removeAlignmentAnnotation(aa);
767 if (aa.groupRef != null)
769 // probably need to do more here in the future (post 2.5.0)
777 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
778 * AlignmentAnnotation)
781 public void addAnnotation(AlignmentAnnotation aa)
783 addAnnotation(aa, -1);
789 * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
790 * AlignmentAnnotation, int)
793 public void addAnnotation(AlignmentAnnotation aa, int pos)
795 if (aa.getRNAStruc() != null)
797 hasRNAStructure = true;
801 if (annotations != null)
803 aSize = annotations.length + 1;
806 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
808 if (pos == -1 || pos >= aSize)
810 temp[aSize - 1] = aa;
819 for (i = 0; i < (aSize - 1); i++, p++)
827 temp[p] = annotations[i];
836 public void setAnnotationIndex(AlignmentAnnotation aa, int index)
838 if (aa == null || annotations == null || annotations.length - 1 < index)
843 int aSize = annotations.length;
844 AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
848 for (int i = 0; i < aSize; i++)
857 temp[i] = annotations[i];
861 temp[i] = annotations[i - 1];
870 * returns all annotation on the alignment
872 public AlignmentAnnotation[] getAlignmentAnnotation()
878 public void setNucleotide(boolean b)
891 public boolean isNucleotide()
893 if (type == NUCLEOTIDE)
904 public boolean hasRNAStructure()
906 // TODO can it happen that structure is removed from alignment?
907 return hasRNAStructure;
911 public void setDataset(Alignment data)
913 if (dataset == null && data == null)
915 // Create a new dataset for this alignment.
916 // Can only be done once, if dataset is not null
917 // This will not be performed
918 SequenceI[] seqs = new SequenceI[getHeight()];
919 SequenceI currentSeq;
920 for (int i = 0; i < getHeight(); i++)
922 currentSeq = getSequenceAt(i);
923 if (currentSeq.getDatasetSequence() != null)
925 seqs[i] = currentSeq.getDatasetSequence();
929 seqs[i] = currentSeq.createDatasetSequence();
933 dataset = new Alignment(seqs);
935 else if (dataset == null && data != null)
939 dataset.addAlignmentRef();
943 * reference count for number of alignments referencing this one.
945 int alignmentRefs = 0;
948 * increase reference count to this alignment.
950 private void addAlignmentRef()
956 public Alignment getDataset()
962 public boolean padGaps()
964 boolean modified = false;
966 // Remove excess gaps from the end of alignment
970 for (int i = 0; i < sequences.size(); i++)
972 current = getSequenceAt(i);
973 for (int j = current.getLength(); j > maxLength; j--)
976 && !jalview.util.Comparison.isGap(current.getCharAt(j)))
987 for (int i = 0; i < sequences.size(); i++)
989 current = getSequenceAt(i);
990 cLength = current.getLength();
992 if (cLength < maxLength)
994 current.insertCharAt(cLength, maxLength - cLength, gapCharacter);
997 else if (current.getLength() > maxLength)
999 current.deleteChars(maxLength, current.getLength());
1006 * Justify the sequences to the left or right by deleting and inserting gaps
1007 * before the initial residue or after the terminal residue
1010 * true if alignment padded to right, false to justify to left
1011 * @return true if alignment was changed
1014 public boolean justify(boolean right)
1016 boolean modified = false;
1018 // Remove excess gaps from the end of alignment
1020 int ends[] = new int[sequences.size() * 2];
1022 for (int i = 0; i < sequences.size(); i++)
1024 current = getSequenceAt(i);
1025 // This should really be a sequence method
1026 ends[i * 2] = current.findIndex(current.getStart());
1027 ends[i * 2 + 1] = current.findIndex(current.getStart()
1028 + current.getLength());
1029 boolean hitres = false;
1030 for (int j = 0, rs = 0, ssiz = current.getLength(); j < ssiz; j++)
1032 if (!jalview.util.Comparison.isGap(current.getCharAt(j)))
1041 ends[i * 2 + 1] = j;
1042 if (j - ends[i * 2] > maxLength)
1044 maxLength = j - ends[i * 2];
1052 // now edit the flanking gaps to justify to either left or right
1053 int cLength, extent, diff;
1054 for (int i = 0; i < sequences.size(); i++)
1056 current = getSequenceAt(i);
1058 cLength = 1 + ends[i * 2 + 1] - ends[i * 2];
1059 diff = maxLength - cLength; // number of gaps to indent
1060 extent = current.getLength();
1064 if (extent > ends[i * 2 + 1])
1066 current.deleteChars(ends[i * 2 + 1] + 1, extent);
1069 if (ends[i * 2] > diff)
1071 current.deleteChars(0, ends[i * 2] - diff);
1076 if (ends[i * 2] < diff)
1078 current.insertCharAt(0, diff - ends[i * 2], gapCharacter);
1086 if (ends[i * 2] > 0)
1088 current.deleteChars(0, ends[i * 2]);
1090 ends[i * 2 + 1] -= ends[i * 2];
1091 extent -= ends[i * 2];
1093 if (extent > maxLength)
1095 current.deleteChars(maxLength + 1, extent);
1100 if (extent < maxLength)
1102 current.insertCharAt(extent, maxLength - extent, gapCharacter);
1112 public HiddenSequences getHiddenSequences()
1114 return hiddenSequences;
1118 public CigarArray getCompactAlignment()
1120 synchronized (sequences)
1122 SeqCigar alseqs[] = new SeqCigar[sequences.size()];
1124 for (SequenceI seq : sequences)
1126 alseqs[i++] = new SeqCigar(seq);
1128 CigarArray cal = new CigarArray(alseqs);
1129 cal.addOperation(CigarArray.M, getWidth());
1135 public void setProperty(Object key, Object value)
1137 if (alignmentProperties == null)
1138 alignmentProperties = new Hashtable();
1140 alignmentProperties.put(key, value);
1144 public Object getProperty(Object key)
1146 if (alignmentProperties != null)
1147 return alignmentProperties.get(key);
1153 public Hashtable getProperties()
1155 return alignmentProperties;
1158 AlignedCodonFrame[] codonFrameList = null;
1164 * jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
1168 public void addCodonFrame(AlignedCodonFrame codons)
1172 if (codonFrameList == null)
1174 codonFrameList = new AlignedCodonFrame[]
1178 AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length + 1];
1179 System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
1180 t[codonFrameList.length] = codons;
1187 * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
1190 public AlignedCodonFrame getCodonFrame(int index)
1192 return codonFrameList[index];
1199 * jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
1202 public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
1204 if (seq == null || codonFrameList == null)
1206 Vector cframes = new Vector();
1207 for (int f = 0; f < codonFrameList.length; f++)
1209 if (codonFrameList[f].involvesSequence(seq))
1210 cframes.addElement(codonFrameList[f]);
1212 if (cframes.size() == 0)
1214 AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
1215 cframes.copyInto(cfr);
1222 * @see jalview.datamodel.AlignmentI#getCodonFrames()
1225 public AlignedCodonFrame[] getCodonFrames()
1227 return codonFrameList;
1233 * @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
1234 * AlignedCodonFrame)
1237 public boolean removeCodonFrame(AlignedCodonFrame codons)
1239 if (codons == null || codonFrameList == null)
1241 boolean removed = false;
1242 int i = 0, iSize = codonFrameList.length;
1245 if (codonFrameList[i] == codons)
1250 System.arraycopy(codonFrameList, i + 1, codonFrameList, i, iSize
1264 public void append(AlignmentI toappend)
1266 if (toappend == this)
1268 System.err.println("Self append may cause a deadlock.");
1270 // TODO test this method for a future 2.5 release
1271 // currently tested for use in jalview.gui.SequenceFetcher
1272 boolean samegap = toappend.getGapCharacter() == getGapCharacter();
1273 char oldc = toappend.getGapCharacter();
1274 boolean hashidden = toappend.getHiddenSequences() != null
1275 && toappend.getHiddenSequences().hiddenSequences != null;
1276 // get all sequences including any hidden ones
1277 List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
1278 .getFullAlignment().getSequences() : toappend.getSequences();
1283 for (SequenceI addedsq : sqs)
1287 char[] oldseq = addedsq.getSequence();
1288 for (int c = 0; c < oldseq.length; c++)
1290 if (oldseq[c] == oldc)
1292 oldseq[c] = gapCharacter;
1296 addSequence(addedsq);
1300 AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
1301 for (int a = 0; alan != null && a < alan.length; a++)
1303 addAnnotation(alan[a]);
1305 AlignedCodonFrame[] acod = toappend.getCodonFrames();
1306 for (int a = 0; acod != null && a < acod.length; a++)
1308 this.addCodonFrame(acod[a]);
1310 List<SequenceGroup> sg = toappend.getGroups();
1313 for (SequenceGroup _sg : sg)
1318 if (toappend.getHiddenSequences() != null)
1320 HiddenSequences hs = toappend.getHiddenSequences();
1321 if (hiddenSequences == null)
1323 hiddenSequences = new HiddenSequences(this);
1325 if (hs.hiddenSequences != null)
1327 for (int s = 0; s < hs.hiddenSequences.length; s++)
1329 // hide the newly appended sequence in the alignment
1330 if (hs.hiddenSequences[s] != null)
1332 hiddenSequences.hideSequence(hs.hiddenSequences[s]);
1337 if (toappend.getProperties() != null)
1339 // we really can't do very much here - just try to concatenate strings
1340 // where property collisions occur.
1341 Enumeration key = toappend.getProperties().keys();
1342 while (key.hasMoreElements())
1344 Object k = key.nextElement();
1345 Object ourval = this.getProperty(k);
1346 Object toapprop = toappend.getProperty(k);
1349 if (ourval.getClass().equals(toapprop.getClass())
1350 && !ourval.equals(toapprop))
1352 if (ourval instanceof String)
1355 this.setProperty(k, ((String) ourval) + "; "
1356 + ((String) toapprop));
1360 if (ourval instanceof Vector)
1363 Enumeration theirv = ((Vector) toapprop).elements();
1364 while (theirv.hasMoreElements())
1366 ((Vector) ourval).addElement(theirv);
1374 // just add new property directly
1375 setProperty(k, toapprop);
1383 public AlignmentAnnotation findOrCreateAnnotation(String name,
1384 String calcId, boolean autoCalc, SequenceI seqRef,
1385 SequenceGroup groupRef)
1387 assert (name != null);
1388 if (annotations != null)
1390 for (AlignmentAnnotation annot : getAlignmentAnnotation())
1392 if (annot.autoCalculated == autoCalc && (name.equals(annot.label))
1393 && (calcId == null || annot.getCalcId().equals(calcId))
1394 && annot.sequenceRef == seqRef
1395 && annot.groupRef == groupRef)
1401 AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
1402 new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
1403 annot.hasText = false;
1404 annot.setCalcId(new String(calcId));
1405 annot.autoCalculated = autoCalc;
1408 annot.setSequenceRef(seqRef);
1410 annot.groupRef = groupRef;
1411 addAnnotation(annot);
1417 public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
1419 ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
1420 for (AlignmentAnnotation a : getAlignmentAnnotation())
1422 if (a.getCalcId() == calcId
1423 || (a.getCalcId() != null && calcId != null && a.getCalcId()
1433 public void moveSelectedSequencesByOne(SequenceGroup sg,
1434 Map<SequenceI, SequenceCollectionI> map, boolean up)
1436 synchronized (sequences)
1441 for (int i = 1, iSize = sequences.size(); i < iSize; i++)
1443 SequenceI seq = sequences.get(i);
1444 if (!sg.getSequences(map).contains(seq))
1449 SequenceI temp = sequences.get(i - 1);
1450 if (sg.getSequences(null).contains(temp))
1455 sequences.set(i, temp);
1456 sequences.set(i - 1, seq);
1461 for (int i = sequences.size() - 2; i > -1; i--)
1463 SequenceI seq = sequences.get(i);
1464 if (!sg.getSequences(map).contains(seq))
1469 SequenceI temp = sequences.get(i + 1);
1470 if (sg.getSequences(map).contains(temp))
1475 sequences.set(i, temp);
1476 sequences.set(i + 1, seq);
1483 public void validateAnnotation(AlignmentAnnotation alignmentAnnotation)
1485 alignmentAnnotation.validateRangeAndDisplay();
1486 if (isNucleotide() && alignmentAnnotation.isValidStruc())
1488 hasRNAStructure = true;
1492 private SequenceI seqrep=null;
1496 * @return the representative sequence for this group
1498 public SequenceI getSeqrep()
1504 * set the representative sequence for this group. Note - this affects the
1505 * interpretation of the Hidereps attribute.
1508 * the seqrep to set (null means no sequence representative)
1510 public void setSeqrep(SequenceI seqrep)
1512 this.seqrep = seqrep;
1517 * @return true if group has a sequence representative
1519 public boolean hasSeqrep()
1521 return seqrep != null;