Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
a63ba85a
Commit
a63ba85a
authored
Feb 28, 2016
by
Mathieu Giraud
Browse files
core/tools.{h,cpp}: nuc_to_AA
Finally Vidjil learns the genetic code.
parent
cde2c1df
Changes
2
Hide whitespace changes
Inline
Side-by-side
algo/core/tools.cpp
View file @
a63ba85a
...
...
@@ -136,6 +136,26 @@ int dna_to_int(const string &word, int size) {
return
index_word
;
}
string
nuc_to_aa
(
const
string
&
word
)
{
string
aa
;
int
index_word
=
0
;
int
i
=
0
;
for
(;
i
<
word
.
length
()
;
i
++
)
{
index_word
=
(
index_word
<<
2
)
|
nuc_to_int
(
word
[
i
]);
if
(
i
%
3
==
2
)
{
aa
+=
GENETIC_CODE
[
index_word
];
index_word
=
0
;
}
}
if
(
i
%
3
)
aa
+=
GENETIC_CODE_OUT_OF_FRAME
;
return
aa
;
}
Sequence
create_sequence
(
string
label_full
,
string
label
,
string
sequence
,
string
quality
)
{
Sequence
seq
;
seq
.
label_full
=
label_full
;
...
...
algo/core/tools.h
View file @
a63ba85a
...
...
@@ -126,6 +126,19 @@ inline int nuc_to_int(char nuc) {
*/
int
dna_to_int
(
const
string
&
,
int
size
);
#define GENETIC_CODE \
"KNKN" "TTTT" "RSRS" "IIMI" \
"QHQH" "PPPP" "RRRR" "LLLL" \
"EDED" "AAAA" "GGGG" "VVVV" \
"*Y*Y" "SSSS" "*CWC" "LFLF"
#define GENETIC_CODE_OUT_OF_FRAME '#'
/**
* Convert nucleotides to amino acids
*/
string
nuc_to_aa
(
const
string
&
nuc
);
string
extract_from_label
(
string
str
,
int
field
,
string
separator
);
/**
...
...
Mathieu Giraud
@magiraud
mentioned in issue
#2428 (closed)
·
May 11, 2017
mentioned in issue
#2428 (closed)
mentioned in issue #2428
Toggle commit list
Mathieu Giraud
@magiraud
mentioned in issue
#2434
·
May 11, 2017
mentioned in issue
#2434
mentioned in issue #2434
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment