comparison mergeGenomicMatrixFiles.py @ 8:5d4538cb38db

When opening files for reading, changed the open() mode from 'r' to 'U' to accommodate non-unix systems
author melissacline
date Tue, 10 Mar 2015 11:16:56 -0700
parents 1d150e860c4d
children 30aab34424a9
comparison
equal deleted inserted replaced
7:1d150e860c4d 8:5d4538cb38db
6 def header (samples, sourceFiles, infile, labelThisFile): 6 def header (samples, sourceFiles, infile, labelThisFile):
7 if labelThisFile == None: 7 if labelThisFile == None:
8 labelToUse = infile 8 labelToUse = infile
9 else: 9 else:
10 labelToUse = labelThisFile 10 labelToUse = labelThisFile
11 fin= open(infile,'r') 11 fin= open(infile, 'U')
12 #header, samples 12 #header, samples
13 newSamples = string.split(string.strip(fin.readline()),'\t')[1:] 13 newSamples = string.split(string.strip(fin.readline()),'\t')[1:]
14 for sample in newSamples: 14 for sample in newSamples:
15 if sample not in samples: 15 if sample not in samples:
16 samples[sample]= len(samples) 16 samples[sample]= len(samples)
19 return 19 return
20 20
21 def process(genes, samples, dataMatrix, infile): 21 def process(genes, samples, dataMatrix, infile):
22 maxLength= len(samples) 22 maxLength= len(samples)
23 23
24 fin= open(infile,'r') 24 fin= open(infile,'U')
25 #header 25 #header
26 newSamples = string.split(string.strip(fin.readline()),'\t') 26 newSamples = string.split(string.strip(fin.readline()),'\t')
27 27
28 while 1: 28 while 1:
29 line = fin.readline()[:-1] 29 line = fin.readline()[:-1]