-
Notifications
You must be signed in to change notification settings - Fork 0
/
DownloadABA_AdultMouse.m
53 lines (48 loc) · 1.88 KB
/
DownloadABA_AdultMouse.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
%%% 12 Feb. 2013
%%% Download the ALLEN Brain Atlas :: Adult Mouse
%% Retrieve experiments' numbers
% expMetaDataFile = 'C:\Users\amahfouz\Documents\MATLAB\Data\NuclearReceptors\files\ABA experiments IDs.csv';
expMetaDataFile = 'E:\Ahmed\HP\work\Data\NuclearReceptors\files\ABA experiments IDs.csv';
[num txt] = xlsread(expMetaDataFile);
sectionOrientation = txt(2:end,1);
genesList = txt(2:end,2);
sectionDataSet = num(:,2);
clear txt; clear num;
%% These are hard-coded paths to URLs for downloading expression volumes
API_SERVER = 'http://api.brain-map.org/';
GRID_FMT = [API_SERVER 'grid_data/download/'];
%% Download ALL coronal grid files (expression energy) - there are 4347
%%% coronal experiments
outDir = ['expressionData/coronal/'];
for expLoop = 1 : 4347
experimentNumber = sectionDataSet(expLoop);
fullURL = [GRID_FMT num2str(experimentNumber)];
geneName = genesList{expLoop};
%%% some genes have an '*' at the end -> remove
if ~isempty(strfind(geneName, '*'));
geneName = geneName(1:end-1);
end
expNumber = sectionDataSet(expLoop);
geneFolderName = [outDir geneName '_' num2str(expNumber)];
unzip(fullURL, geneFolderName);
clear experimentNumber; clear geneName; clear expNumber;
clear geneFolderName;
end
%% Download ALL sagittal grid files (expression energy) - starting @ 4348
outDir = ['expressionData/sagittal/'];
for expLoop = 4348 : length(sectionDataSet)
experimentNumber = sectionDataSet(expLoop);
fullURL = [GRID_FMT num2str(experimentNumber)];
geneName = genesList{expLoop};
if ~isempty(strfind(geneName, '*'));
geneName = geneName(1:end-1);
end
expNumber = sectionDataSet(expLoop);
geneFolderName = [outDir geneName '_' num2str(expNumber)];
try
unzip(fullURL, geneFolderName);
catch err
end
clear experimentNumber; clear geneName; clear expNumber;
clear geneFolderName;
end