Skip to content

Commit

Permalink
added csv writer data output function
Browse files Browse the repository at this point in the history
  • Loading branch information
jackRogers committed May 1, 2012
1 parent 33eede4 commit afd238f
Show file tree
Hide file tree
Showing 5 changed files with 396 additions and 2 deletions.
29 changes: 27 additions & 2 deletions BioinformaticFileWidget/BF.py
Expand Up @@ -76,7 +76,7 @@ def makeDataFile(newFileName,dataDict):
paitients = dataDict.keys()
genes = dataDict[paitients[0]].keys()

header = "paitientID\t"
header = "patientID\t"
for g in genes:
header += g
header += "\t"
Expand All @@ -91,7 +91,7 @@ def makeDataFile(newFileName,dataDict):

fh.write(shitz)

for p in paitients:
for p in patients:
line = p
line += "\t"
for g in genes:
Expand All @@ -101,6 +101,31 @@ def makeDataFile(newFileName,dataDict):
fh.write(line)
fh.close

def makeCSVDataFile(newFileName,dataDict):
fh = open(newFileName,'w')
writer = csv.writer(fh,delimiter = "\t")
patients = dataDict.keys()
genes = dataDict[patients[0]].keys()

header = []
header.append("patientID")
for g in genes:
header.append(g)
header.append('value')

writer.writerow(header)

for p in patients:
line = []
line.append(p)
for g in genes:
line.append(dataDict[p][g])
writer.writerow(line)

fh.close




def concat(flist, column_overlap=0, transpose=False):
"""
Expand Down
Binary file modified BioinformaticFileWidget/BF.pyc
Binary file not shown.
123 changes: 123 additions & 0 deletions BioinformaticFileWidget/test.txt

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions BioinformaticFileWidget/test3.tab

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions BioinformaticFileWidget/test3.txt

Large diffs are not rendered by default.

0 comments on commit afd238f

Please sign in to comment.