1

I have an alignment of 3 sequences generated by clustalx

AAAACGT Alpha
AAA-CGT Beta
AAAAGGT Gamma

I can sliced the alignment with the predefined indexing in Biopython via align[:,:4]

However, printing the result gives:

AAAA Alpha
AAA- Beta
AAAA Gamma

How can I capture sub-alignment as without printing the names as given below?

AAAA
AAA-
AAAA

align[:,:4].seq does not provide the output I'm looking for.

saladi
  • 3,103
  • 6
  • 36
  • 61
ifreak
  • 1,726
  • 4
  • 27
  • 45

2 Answers2

0

I need to ask a follow-up question first - what is the exact type of align[:,:4]?

Either way, it seems to be an array of some sort, so you cannot simply do .seq. What you may be able to do, if the seq is indeed a property of the individual entries, is to extract them using a map function:

map(lambda el: el.seq, align[:, :4])
petr
  • 2,554
  • 3
  • 20
  • 29
0

You can probably do something like:

for x in align[:, :4]:
    print x.seq

Or do whatever you want where the print statement is.

triggertoast
  • 124
  • 4