PEATDB/sequence_alignment.py
def read_clustal_aln_file(filename):
    """Read a clustalW/X aln file"""
    import os
    seqs={}
    if os.path.isfile(filename):
        fd=open(filename)
        lines=fd.readlines()
        fd.close()
        #
        # Read the lines
        #
        import string
        for line in lines:
            if len(line.strip())==0:
                continue
            elif line[0]=='#':
                continue
            elif line.split()[0]=='CLUSTAL':
                continue
            split=string.strip(line).split()
            if len(split)>1 and line[1]!=' ':
                if seqs.has_key(split[0]):
                    seqs[split[0]]=seqs[split[0]]+split[1]
                else:
                    seqs[split[0]]=split[1]
    return seqs
Read a clustalW/X aln file
Read a clustalW/X aln file
Read a clustalW / X aln file
def read_clustal_aln_file(filename):
    import os
    seqs={}
    if os.path.isfile(filename):
        fd=open(filename)
        lines=fd.readlines()
        fd.close()
         Read the lines
        import string
        for line in lines:
            if len(line.strip())==0:
                continue
            elif line[0]=='':
                continue
            elif line.split()[0]=='CLUSTAL':
                continue
            split=string.strip(line).split()
            if len(split)>1 and line[1]!=' ':
                if seqs.has_key(split[0]):
                    seqs[split[0]]=seqs[split[0]]+split[1]
                else:
                    seqs[split[0]]=split[1]
    return seqs
def read_clustal_aln_file ( filename ) : import os seqs = { } if os . path . isfile ( filename ) : fd = open ( filename ) lines = fd . readlines ( ) fd . close ( ) import string for line in lines : if len ( line . strip ( ) ) == 0 : continue elif line [ 0 ] == '#' : continue elif line . split ( ) [ 0 ] == 'CLUSTAL' : continue split = string . strip ( line ) . split ( ) if len ( split ) > 1 and line [ 1 ] != ' ' : if seqs . has_key ( split [ 0 ] ) : seqs [ split [ 0 ] ] = seqs [ split [ 0 ] ] + split [ 1 ] else : seqs [ split [ 0 ] ] = split [ 1 ] return seqs
Read a clustalW/X aln file
Read a clustalW / X aln file
"""Read a clustalW/X aln file""" # # Read the lines #
filename