-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteGene.m
More file actions
40 lines (34 loc) · 927 Bytes
/
deleteGene.m
File metadata and controls
40 lines (34 loc) · 927 Bytes
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
function out = deleteGene(gene,codexPath)
% Deletes a gene's data folder and codex entry
% returns -1 if gene is not found
load('AllenAPI_Paths.mat')
out = 0;
if ~exist('codexPath','var')
codexPath = [AtlasGeneDir 'geneCodex.mat'];
end
load(codexPath)
% Basic Search in codex
search = strcmp(upper(gene),geneCodex(:,1));
search1 = find(search);
if isempty(search1)
search1 = find(cellfun(@(x) ~isempty(strfind([' ' x ' '],[' ' upper(gene) ' '])),geneCodex(:,2)));
end
if isempty(search1)
out = -1;
disp('Gene not found in codex.')
return;
end
gd = [AtlasGeneDir geneCodex{search1,8}];
disp(['Removing gene from codex: ' gene])
geneCodex(search1,:) = [];
LastUpdate = date;
save(codexPath,'geneCodex','LastUpdate','LastAddition');
% Delete gene data
disp(['Deleting Gene Directory: ' gene])
if ~exist(gd,'dir')
out = -1;
disp('Gene Directory not found')
return;
end
rmdir(gd,'s');
out = 1;