You could avoid some confusion without naming your columns "lines"...
Anyway, here is a piece of code that read the file and count the star on the fly:
(The result is a dict of dict of int.)
-----------------------------------------------------------------
import itertools
import csv
f = open("toto.data") #change your file name
lineReader = csv.reader(f)
#Set the lines titles (RHA280, etc)
l = lineReader.next()
linesTitles = l[2:]
#We construct the data structure and count the stars on the fly
datas = {}
for l in lineReader:
name, allele = l[:2]
if not allele: #empty line
continue
if name: #new block defining a TD*
currentName = name
d = dict.fromkeys(linesTitles, 0)
datas[currentName] = d
lines = l[2:]
#add 1 to the lines not empty (<=> with a star)
for title, value in itertools.izip(linesTitles,lines):
if value:
d[title] += 1
#little tests
print datas
print datas["TDF1"]["RHA280"]
print datas["TDF3"]["RHA280"]
-----------------------------------------------------------------------------
-- http://mail.python.org/mailman/listinfo/python-list