You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to use the string-like concatenation/addition behaviour of Seq objects in the same way as using 'some_string'.join(), but this behaviour is not currently available.
If we leave aside mixing Seq and SeqRecord objects, I agree this would be nice and fits with the long term goal of making the Seq object more like the Pyhton string:
i.e. Define Seq object .join method taking an iterable of strings/other Seq-type objects.
This is relatively easy other than dealing with picking a consensus alphabet - although we can probably just follow the precedent elsewhere (e.g. for the MultipleSeqAlignment ),
@kaskales did you have any thoughts on examples like Seq("").join(some_dna_seqs) vs Seq("", some_generic_alphabet).join(some_dna_seqs) where in some senses the default/generic alphabet of the empty sequence space is not important for the combined sequence (which in this example might be expected to be DNA from the alphabet attributes set in some_dna_seqs)
@peterjc In your case where the spacer is an empty string, that would be the only time it might be good to assume the same alphabet as some_dna_seqs by default. Otherwise the spacer alphabet will take into consideration, where it should be up to the user to correctly identify the alphabet used in the spacer.
Activity
peterjc commentedon Jul 10, 2018
If we leave aside mixing
SeqandSeqRecordobjects, I agree this would be nice and fits with the long term goal of making theSeqobject more like the Pyhton string:i.e. Define
Seqobject.joinmethod taking an iterable of strings/otherSeq-type objects.This is relatively easy other than dealing with picking a consensus alphabet - although we can probably just follow the precedent elsewhere (e.g. for the
MultipleSeqAlignment),https://github.com/biopython/biopython/blob/biopython-172/Bio/Alphabet/__init__.py#L324
In the special case of joining with an empty sequence, does its alphabet need consideration?
widdowquinn commentedon Jul 10, 2018
Yeah, sorry about the mix-up of classes with
SeqIO.parse()there… ;)kaskales commentedon Jul 30, 2018
@peterjc I see this issue is still open. Is it ok if I give it a shot as well?
Added Seq.join() method, concatinates an iterable of Seq or string ob…
peterjc commentedon Jul 31, 2018
@kaskales did you have any thoughts on examples like
Seq("").join(some_dna_seqs)vsSeq("", some_generic_alphabet).join(some_dna_seqs)where in some senses the default/generic alphabet of the empty sequence space is not important for the combined sequence (which in this example might be expected to be DNA from the alphabet attributes set insome_dna_seqs)kaskales commentedon Jul 31, 2018
@peterjc In your case where the spacer is an empty string, that would be the only time it might be good to assume the same alphabet as
some_dna_seqsby default. Otherwise the spacer alphabet will take into consideration, where it should be up to the user to correctly identify the alphabet used in the spacer.peterjc commentedon Aug 1, 2018
Yes, I'm talking about the special case where the spacer is a zero length sequence.
Merge branch 'seq_join' biopython#1731
added Seq.join() issue biopython#1731
Added .join() method to Seq, MutableSeq, UnknownSeq
peterjc commentedon Mar 15, 2019
Applied as e856cd3 from #1746. Thank you all.