-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcheckcdsfile.m
49 lines (38 loc) · 1010 Bytes
/
checkcdsfile.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
function [good,aln,filename]=checkcdsfile(filename,seqtype,geneticcode)
%CHECKCDSFILE -
% $LastChangedDate: 2013-01-06 12:45:03 -0600 (Sun, 06 Jan 2013) $
% $LastChangedRevision: 328 $
% $LastChangedBy: jcai $
if nargin < 1
[filename, pathname] = uigetfile( ...
{'*.fasta;*.fas', 'FASTA Format Files (*.fasta, *.fas)';
'*.*', 'All Files (*.*)'}, ...
'Pick a FASTA file');
if ~(filename), aln=[]; good=0; return; end
filename=[pathname,filename];
end
if nargin < 2
seqtype=2; geneticcode=1;
end
good=1;
[aln] = readfasta(filename,seqtype,geneticcode);
if (isempty(aln)),
good=0;
return;
end
[n,m]=size(aln.seq);
x=[];
disp('Checking CDS files')
for (k=1:n),
seq=aln.seq(k,:);
seq(seq>4)=[];
seqlen=length(seq);
seqname=char(aln.seqnames(k));
if (mod(seqlen,3)>0),
fprintf('Length of %d bp cannot divide by 3! -- %s\n',seqlen, seqname);
x=[x,k];
good=0;
end
end
aln.seq(x,:)=[];
aln.seqnames(x)=[];