Update to fetch_dataset

This commit is contained in:
Andreas 2013-05-20 12:11:21 +01:00
parent 5f1eaf1e64
commit 6fe7ac2106

View file

@ -17,17 +17,24 @@ def sample_class(f):
c = np.where(c, 1, -1)
return c
def fetch_dataset(resource, file_name, messages = True):
def fetch_dataset(resource, save_name = None, save_file = True, messages = True):
if messages:
print "Downloading resource: " , resource, " ... "
response = url.urlopen(resource)
# TODO: Some error checking...
# ...
html = response.read()
response.close()
with open(file_name, "w") as text_file:
text_file.write("%s"%html)
if messages:
print "Done!"
if save_file:
# TODO: Check if already exists...
# ...
with open(save_name, "w") as text_file:
text_file.write("%s"%html)
if messages:
print "Done!"
return html
def della_gatta_TRP63_gene_expression(gene_number=None):
mat_data = scipy.io.loadmat(os.path.join(data_path, 'DellaGattadata.mat'))