This project is read-only.

QualitativeSequence.GetSubSequence(): ID and metadata are not copied to the returned object


When calling QualitativeSequence.GetSubSequence(), the new QualitativeSequence object being returned does not retain the original information stored in the properties ID and metadata.
For example:
        QualitativeSequence qseq = new QualitativeSequence(Alphabets.DNA, FastQFormatType.Sanger, "ATGC", "ABCA");
        qseq.ID = "my fastq sequence";
        var newqseq = qseq.GetSubSequence(0, 2);
        Console.WriteLine(newqseq.ID);  // empty


reach2raziq wrote Jul 26, 2011 at 12:34 PM

I'm not sure I'd consider the proposal to be completely valid though.. GetSubSequence returns a new sequence, related but not identical to the original (it actually returns a SubSequence of the original sequence with the same Alphabet and FormatType).. it might be the complete sequence but it also might be a portion (even in the middle).. so the ID probably shouldn't be the same.. and I'm not sure why I'd want the metadata with it..

But that said, it would be trivial to implement. I'd probably put a flag onto the method (with an optional parameter as input set to false to indicate whether to copy the metadata). The problem with copying metadata is it would end up being a shallow copy; changing the original on the original sequence would alter the value on the subsequence too.. probably unexpected by most I'd guess.

MSR Support Team

kch wrote Jul 26, 2011 at 11:58 PM

I see your point. However, the equivalent GetSubSequence() in the Sequence class already copies ID and metadata to the subsequence. So there is a some inconsistency.

reach2raziq wrote Jul 28, 2011 at 10:24 AM


Thanks for reporting this. This is a bug. The QualitativeSequence.GetSubSequence() method is correct. We will fix the issue related to Sequence.GetSubSequence() in future releases/patches.

MSR Support Team

wrote Feb 13, 2013 at 8:43 PM