public SequenceI getDatasetSequence();
/**
- * Returns the top grandparent in the dataset sequences hierarchy.
+ * Returns the top grandparent in the dataset sequences hierarchy
+ * or null if there is no dataset associated with this sequence.
*/
public default SequenceI getRootDatasetSequence()
{
- var sequence = this;
+ if (getDatasetSequence() == null)
+ {
+ return null;
+ }
+ var sequence = getDatasetSequence();
while (sequence.getDatasetSequence() != null)
{
sequence = sequence.getDatasetSequence();