Browse files

Merge pull request #9 from Tmana/patch-1

Update BioinformaticFileWidget/BF.py
  • Loading branch information...
2 parents 6945f1f + 9d635e3 commit 57d8f34c66e953a04d89751fd25fa8727a4aa0b6 @jackRogers committed May 10, 2012
Showing with 0 additions and 43 deletions.
  1. +0 −43 BioinformaticFileWidget/BF.py
View
43 BioinformaticFileWidget/BF.py
@@ -160,49 +160,6 @@ def makeTXTDataFile(newFileName,dataDict,label):
fh.close
-def concat(flist, column_overlap=0, transpose=False):
- """
- A concatonate function that returns a large data table of
- the files in flist.
-
- Assumes that all files are properly aligned. Will terminate
- in error if file lengths do not line up appropriately.
-
- column_overlap specifies the number of repeat columns
- in the files. Ignores these columns from concatonation.
-
- Transpose calls the transpose function before returning the
- data file matrix.
-
- returns a numpy array of all file constituents.
- """
-
- data = [] #Container for all file data desired
-
- for num, fil in enumerate(flist):
- f = open(fil, 'r')
- reader = csv.reader(f, delimiter='\t') #init csv reader on each file in list
-
- line_i = reader.next()
- i = 0 #counter to make sure which line we are on.
- if num < 1: #if it is the first file, add straight to data
- while line_i:
- data.append(line_i) #add to data as new list
- try:
- line_i = reader.next()
- except:
- break #exit loop gracefully.
- else: # all other files after first...
- while line_i:
- data[i].extend(line_i[column_overlap:]) # .. extend the i-th list in data
- try:
- line_i = reader.next()
- i += 1 #update the counter
- except:
- break #end gracefully
-
- return data #may addd as numpy array later, if desired.
-
def main(outputFilePath,dataPath,label):
dictionary = concatFiles(dataPath)

0 comments on commit 57d8f34

Please sign in to comment.