-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgetData.m
More file actions
43 lines (40 loc) · 1.44 KB
/
getData.m
File metadata and controls
43 lines (40 loc) · 1.44 KB
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
%
ori = {'AgamP4';'AgamS1';'AcolM1';'AquaS1';'AaraD1';'AmelC2';'AmerM2';'AchrA1';'AepiE1'};
rep = {'AgamP4';'gam';'col';'qua';'ara';'mel';'mer';'anchr';'anepi'};
rep2 = {'P4';'S1';'M1';'S1';'D1';'C2';'M2';'A1';'E1'};
f = fopen('27loci.txt');
system('rm -r data');
system('mkdir data');
while ~feof(f)
line = fgets(f);
tmp = strsplit(line, '-');
tmp2 = strsplit(tmp{2}, '"');
fasta = fastaread(['/Users/nicmuell/Documents/github/IsolationWithMigration/Application/Gambia/data/maffilter/chr3L/chr3L-' tmp2{1} '.fa']);
clear dat
c = 1;
for i = 1:length(fasta)
if isempty(strfind(fasta(i).Header, 'AcolM1')) &&...
isempty(strfind(fasta(i).Header, 'AepiE1')) &&...
isempty(strfind(fasta(i).Header, 'AgamP4')) &&...
isempty(strfind(fasta(i).Header, 'AchrA1'))
header_name_ind = find(ismember(ori,fasta(i).Header));
dat(c) = fasta(i);
dat(c).Header = [rep{header_name_ind} '_' rep2{header_name_ind}];
c = c+1;
end
end
nogap = true(1,length(dat(1).Sequence));
for k = 1 : length(dat(1).Sequence)
for l = 1 : length(dat)
if strcmp(dat(l).Sequence(k),{'-'})
nogap(k) = false;
break;
end
end
end
for l = 1 : length(dat)
dat(l).Sequence = dat(l).Sequence(nogap);
end
fastawrite(['data/chr3L-' tmp2{1} '.fasta'],dat);
end
fclose(f);