thanks ;) works fine!
• 0 views
•
link
Hey, I need help, I do not know how to deal with it:
list_of_ids = [aasddaw23/2-20,aasddaw23/34-50,aasddaw23/67-100,fyyrr43/67-98,fyyrr43/80-120,poipoopop34/33-200,poipoopop34/144-222]
#grouped list
result = [[aasddaw23/2-20,aasddaw23/34-50,aasddaw23/67-100],[fyyrr43/67-98,fyyrr43/80-120],[poipoopop34/33-200,poipoopop34/144-222]]
The list should be divided depending on the id on the sub-lists I'm writing a simple program for linking amino acid sequence substrings, but I've come across this problem
thanks in advance
Not entirely sure the purpose of this grouped list and how Biopython plays a role here. Generally speaking, groupby is likely your friend when it comes to stuff like this.
from itertools import groupby
[[x for x in g] for k,g in groupby(sorted(list_of_ids), lambda x: x.split('/')[0])]
thanks ;) works fine!
Log in to answer this question.