Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /inst/int2aa.m [000000] .. [3f48a5] Maximize Restore

  Switch to unified view

a b/inst/int2aa.m
1
## Copyright (C) 2008 Bill Denney
2
##
3
## This software is free software; you can redistribute it and/or modify it
4
## under the terms of the GNU General Public License as published by
5
## the Free Software Foundation; either version 3 of the License, or (at
6
## your option) any later version.
7
##
8
## This software is distributed in the hope that it will be useful, but
9
## WITHOUT ANY WARRANTY; without even the implied warranty of
10
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
## General Public License for more details.
12
##
13
## You should have received a copy of the GNU General Public License
14
## along with this software; see the file COPYING.  If not, see
15
## <http://www.gnu.org/licenses/>.
16
17
## -*- texinfo -*-
18
## @deftypefn {Function File} {@var{sequencechar} =} int2aa (@var{sequenceint})
19
## Convert amino acid integers into characters.  See @code{aminolookup}
20
## for the listing of numbers and their corresponding characters.
21
## @seealso{aminolookup,aa2int,int2nt,nt2int}
22
## @end deftypefn
23
24
## Author: Bill Denney <bill@denney.ws>
25
26
function seqc = int2aa (seqi)
27
28
  if (! isnumeric (seqi))
29
    print_usage ();
30
  endif
31
  sequences = aminolookup ("code", []);
32
  seqc = reshape (sequences(seqi), size (seqi));
33
endfunction
34
35
## Tests
36
%!assert (int2aa (1), "A")
37
%!assert (int2aa ([1 2]), "AR");
38
%!assert (int2aa ([1;2]), ["A";"R"])