0
$\begingroup$

I have a reference sequence of amino acids that I compare other sequences to using Bio.pairwise2.align.globalmx of Biopython package (one to many compare - one by one [is there a better way?])

It's works fine but only returns strings of the alignment with very little metadata.

Now I want to extract the indices of the amino acids that are different than the reference sequence and plot it in some kind of histogram according to protein features:

For example:

  • pos 1-36: 3 mutations.
  • pos 37-202: 4 mutations.
  • pos 203: 1 mutation
  • pos 204-660: 0 mutations

Is there any builtin package to do so?

How can I get the data of diff between 2 sequences in python? I mean which AA changed to which AA and at each position. Bio.pairwise2.align.globalmx returns some data structures of strings (see below) that can be printed but does not contain the locations in a convenient way.

LLGHKVNPFKALYNRIDMK-QVEALVEASKEE 
|||||||||||||||||||||||||||||||| 
LLGHKVNPFKALYNRIDM-RQVEALVEASKEE
$\endgroup$
  • 1
    $\begingroup$ Can you post a minimal, working, and complete example of what you have gotten to work so far? $\endgroup$ – winni2k Oct 27 '17 at 14:36
  • $\begingroup$ Lets start with more basic question: How can I get the data of diff between 2 sequences in python? I mean which AA changed to which AA and at each position. Bio.pairwise2.align.globalmx returns some data structures of strings (see below) that can be printed but does not contain the locations in a convenient way. LLGHKVNPFKALYNRIDMK-QVEALVEASKEE |||||||||||||||||||||||||||||||| LLGHKVNPFKALYNRIDM-RQVEALVEASKEE $\endgroup$ – Kobi T Oct 27 '17 at 15:31
  • 2
    $\begingroup$ The comments section is not a good place to discuss other questions. Probably best to open a new post. $\endgroup$ – winni2k Oct 27 '17 at 21:09
  • $\begingroup$ Do you just want a graphical representation of the diverse regions of a multiple sequence alignment? $\endgroup$ – Joe Healey Oct 27 '17 at 22:43
  • $\begingroup$ I'm not sure if multiple sequence alignment is what I need because I have one reference sequence that I compare all the others to. I need one-to-many comparison (which now I do by many one-to-one comparisons). Correct me if I'm wrong. $\endgroup$ – Kobi T Oct 28 '17 at 7:26
2
$\begingroup$

You can use AlignBuddy to process alignments in GenBank format, which allows you to keep the metadata. From the command line:

$: alignbuddy input.gb --generate_alignment mafft | \
   alignbuddy --extract_feature_sequences 'PROT_FEAT_1' | \
   alignbuddy --percent_id

If you want to do a large one-to-many comparison and loop through a bunch of features, I'd recommend importing AlignBuddy into a custom python script and calling the relevant functions directly. You can then collect the relevant data and build a histogram with matplotlib.

$\endgroup$
1
$\begingroup$

In answer to the comments, you can do multiple pair wise alignments and then concatenate them to visualise, if MSA is not the way to go. I have a script you can find here which will draw a graph of the Shannon entropy (uncertainty) in a column. If you create a gapped FASTA alignment for each of your pairs, and concatenate it in to a multifasta, the script should still work with it. Though it may be noisy - best just to try it.

JalView might be an option for a one-stop GUI tool, but I’m not sure if it’ll require an MSA instead of multiple pair wise.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.