Back to index

python-biopython  1.60
Classes | Functions
Bio.Motif.Parsers.AlignAce Namespace Reference

Classes

class  Record

Functions

def read

Function Documentation

read(handle)

Definition at line 21 of file AlignAce.py.

00021 
00022 def read(handle):
00023     """read(handle)"""
00024     record = Record()
00025     record.ver = handle.next()
00026     record.cmd_line = handle.next()
00027     for line in handle:
00028         if line.strip() == "":
00029             pass
00030         elif line[:4]=="Para":
00031             record.param_dict={}
00032         elif line[0]=="#":
00033             seq_name = line.split("\t")[1]
00034             record.seq_dict.append(seq_name)
00035         elif "=" in line:
00036             par_name = line.split("=")[0].strip()
00037             par_value = line.split("=")[1].strip()
00038             record.param_dict[par_name]=par_value
00039         elif line[:5]=="Input":
00040             record.seq_dict=[]
00041         elif line[:5]=="Motif":
00042             record.current_motif = Motif()
00043             record.motifs.append(record.current_motif)
00044             record.current_motif.alphabet=IUPAC.unambiguous_dna
00045         elif line[:3]=="MAP":
00046             record.current_motif.score = float(line.split()[-1])
00047         elif len(line.split("\t"))==4:
00048             seq = Seq(line.split("\t")[0],IUPAC.unambiguous_dna)
00049             record.current_motif.add_instance(seq)
00050         elif "*" in line:
00051             record.current_motif.set_mask(line.strip("\n\c"))
00052         else:
00053             raise ValueError(line)
00054     return record
00055 
00056