Skip to content

Commit

Permalink
added argument to makeCSVDatafile to set class for different types of…
Browse files Browse the repository at this point in the history
… data
  • Loading branch information
jackRogers committed May 5, 2012
1 parent 84575f7 commit a568f8e
Show file tree
Hide file tree
Showing 610 changed files with 10,743,675 additions and 2 deletions.
17 changes: 16 additions & 1 deletion BioinformaticFileWidget/BF.py
Expand Up @@ -77,6 +77,7 @@ def makeDataFile(newFileName,dataDict):
genes = dataDict[paitients[0]].keys()

header = "patientID\t"
#add class label
for g in genes:
header += g
header += "\t"
Expand All @@ -85,11 +86,15 @@ def makeDataFile(newFileName,dataDict):
fh.write(header)

shitz = "d\t"
#add class label as discrete
for i in range(len(genes)):
shitz += "c\t"
shitz += "\n"

fh.write(shitz)




for p in patients:
line = p
Expand All @@ -101,32 +106,42 @@ def makeDataFile(newFileName,dataDict):
fh.write(line)
fh.close

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

header = []
header.append("patientID")
#add class label
header.append("type")
for g in genes:
header.append(g)

writer.writerow(header)

header2 = []
header2.append('d')
#make class label discrete
header2.append('d')
for g in genes:
header2.append('c')

writer.writerow(header2)

#make second column class label, get all other \t's
header3 = []
header3.append('')
header3.append('class')
for g in genes:
header3.append('')


for p in patients:
line = []
line.append(p)
line.append(label)
for g in genes:
line.append(dataDict[p][g])
writer.writerow(line)
Expand Down
Binary file modified BioinformaticFileWidget/BF.pyc
Binary file not shown.
595 changes: 595 additions & 0 deletions BioinformaticFileWidget/UNCGBM.txt

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions BioinformaticFileWidget/UNCHealthy.txt

Large diffs are not rendered by default.

0 comments on commit a568f8e

Please sign in to comment.