This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Automated sliding window analysis of % identity on a Clustal Omega DNA alignment

I would like to align ~15 DNA sequences of 1-2kb, then assess the degree of homology across the alignment using a sliding window. It will be very laborious to do this manually, even using quite large jumps in the windows. Is there a facility to do such analysis automatically with the Clustal Omega tool (or other tool)? Many thanks Catherine Merrick

alignment

Sorry, just a pet peeve, but "degree of homology" makes no sense. Either a sequence is homologous, or it is not. I.e. either they share a common ancestor or they do not! check here for a way to get you started.

1 answer

Too many biologists do indeed say % homology, but that does not mean you should. It is wrong, not just a semantics issue...

Not tested and written on my tiny phone screen, but assuming you can get Biopython running, something like this should generate the input files for your favorite program?
This should print out a bunch of alignments o length window with overlap step.

from Bio import AlignIO

window=10
step=5


alignment = AlignIO.read("alignment_in_fasta_format.fas","fasta"):
    for r in range(0,len(alignment[1]),step):
        with open("window_"+r+".fas") as out: 
            print >>out, ">%s\n%s" %(alignment[:,r:r+window])

Log in to answer this question.