Back to index

python-biopython  1.60
Classes | Functions
Bio.Affy.CelFile Namespace Reference

Classes

class  Record

Functions

def read

Function Documentation

def Bio.Affy.CelFile.read (   handle)
Read the information in a cel file, and store it in a Record.

Definition at line 30 of file CelFile.py.

00030 
00031 def read(handle):
00032     """
00033     Read the information in a cel file, and store it in a Record.
00034     """
00035     # Needs error handling.
00036     # Needs to know the chip design.
00037     record = Record()
00038     section = ""
00039     for line in handle:
00040         if not line.strip():
00041             continue
00042         if line[:8]=="[HEADER]":
00043             section = "HEADER"
00044         elif line[:11]=="[INTENSITY]":
00045             section = "INTENSITY"
00046             record.intensities  = numpy.zeros((record.nrows, record.ncols))
00047             record.stdevs = numpy.zeros((record.nrows, record.ncols))
00048             record.npix = numpy.zeros((record.nrows, record.ncols), int)
00049         elif line[0]=="[":
00050             section = ""
00051         elif section=="HEADER":
00052             keyword, value = line.split("=", 1)
00053             if keyword=="Cols":
00054                 record.ncols = int(value)
00055             elif keyword=="Rows":
00056                 record.nrows = int(value)
00057         elif section=="INTENSITY":
00058             if "=" in line:
00059                 continue
00060             words = line.split()
00061             y, x = map(int, words[:2])
00062             record.intensities[x,y]  = float(words[2])
00063             record.stdevs[x,y] = float(words[3])
00064             record.npix[x,y]  = int(words[4])
00065     return record

Here is the caller graph for this function: