Convert Microarray Data to Excel Files
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import pandas
|
|
|
|
|
|
|
|
import validators
|
|
|
|
|
|
|
|
|
|
|
|
RE_NATURAL_SORT = re.compile('([0-9]+)')
|
|
|
|
convert = lambda text: int(text) if text.isdigit() else text.lower()
|
|
|
|
natural_sort = lambda item: [convert(c) for c in RE_NATURAL_SORT.split(item)]
|
|
|
|
|
|
|
|
|
|
|
|
def read_data_file(data_file, usecols):
|
|
|
|
with open(data_file.path, 'r', encoding='UTF-8') as file_handle:
|
|
|
|
return pandas.read_csv(
|
|
|
|
file_handle, sep='\t', decimal=data_file.separator, header=0,
|
|
|
|
index_col=False, skiprows=data_file.skip, usecols=usecols)
|
|
|
|
|
|
|
|
|
|
|
|
def write_excel_file(path, data_frame):
|
|
|
|
data_frame.to_excel(path)
|