Removing Gap Columns from MSA

BY IN Code, Python, Tutorials NO COMMENTS YET ,

Consider the following multiple sequence alignment: >HUMAN —————–METTNGT-ETWYESLHAVLKALNATLHSNLLCRPGPGL–G– >MOUSE —————–METSNGT-ETWYMSLHAVLKALNTTLHSHLLCRPGPGP–G– >CHICKEN —————–MEEDNRT-EPWHHSLQAMLDALNQTLHRAILHP-ST——- … Let’s say you want to remove the columns from the alignment where the query (human) protein sequence has a gap. You may want to do this for a number of reasons though I had to do this trick to get my local

CONTINUE READING …

5 Useful Python One Liners for Lists

BY IN Code, Python, Tutorials NO COMMENTS YET

Five useful Python one liners for making and manipulating lists: 1. From text file to list: code: [line.strip() for line in open(file)] example file proteins_list.txt: Q8N465 O95452 Q14524 Q86YC2 P11413 Q8IWV7 example: >>> [line.strip() for line in open(‘proteins_list.txt’)] [‘Q8N465’, ‘O95452’, ‘Q14524’, ‘Q86YC2’, ‘P11413’, ‘Q8IWV7’] 2. Get a list of strings from list that contains a

CONTINUE READING …

Finding the indices of differences between two strings

BY IN Code, Python, Tutorials NO COMMENTS YET

Python command for finding indices of differences between two strings. command: >>> [i for i in xrange(len(x)) if x[i] != y[i]] example: >>> x = ‘LEIYNQPNQEGPFDVQETEIAVQAKQPDVEEILSKGQHLYKEKPATQPVK’ >>> y = ‘LEIYNQPNQEGPFDVKETEIAVQAKQPDVEEILSKGQHLYKEKPATQPVK’ >>> [i for i in xrange(len(x)) if x[i] != y[i]] [15] This is particularly useful for finding position difference between two DNA or protein alignments

CONTINUE READING …