Toggle navigation
Toggle navigation
This project
Loading...
Sign in
EvryRNA
/
BruteSmORF
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
guillaume
2023-04-18 18:43:42 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5cd6095622a16cb4d80d5b28f0bcc11533d32915
5cd60956
1 parent
b4022c59
new single strand option
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
translate_FUNCTION.cpp
translate_FUNCTION.cpp
View file @
5cd6095
...
...
@@ -17,7 +17,7 @@
vector
<
int
>
multiFASTA_seqlen
;
map
<
string
,
string
>
genetic_code
;
vector
<
string
>
sCodons
;
int
minimum_length
=
0
;
int
minimum_length
=
2
;
// dipeptides
// XXX PROTOTYPES
...
...
@@ -200,6 +200,14 @@ int main(int argc, char** argv){
string
optlist
=
" Usage:
\n
"
"
\n
"
" -i Input file
\n
"
" -o Output filenames (default: input filename with .pro and .dna/.rna extensions)
\n
"
" -s Start codon
\n
"
" -m Minimum ORF length (default: 2)
\n
"
" -a Alternative genetic code
\n
"
" -r RNA input
\n
"
" -c Check FASTA format
\n
"
" -f Translate sense strand only
\n
"
// f as in forward
" -h Help
\n
"
;
string
outFileName
;
...
...
@@ -208,10 +216,11 @@ int main(int argc, char** argv){
bool
checkFASTA
;
string
alt_gene_code
;
string
startCodon
;
bool
senseStrand
;
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"hrci:o:s:m:a:"
))
!=
EOF
){
while
((
opt
=
getopt
(
argc
,
argv
,
"hrc
f
i:o:s:m:a:"
))
!=
EOF
){
switch
(
opt
){
case
'i'
:
inFileName
=
optarg
;
break
;
case
'o'
:
outFileName
=
optarg
;
break
;
...
...
@@ -220,6 +229,7 @@ int main(int argc, char** argv){
case
'a'
:
alt_gene_code
=
optarg
;
break
;
case
'r'
:
rna
=
true
;
break
;
case
'c'
:
checkFASTA
=
true
;
break
;
case
'f'
:
senseStrand
=
true
;
break
;
case
'h'
:
fprintf
(
stderr
,
"%s"
,
optlist
.
c_str
());
return
0
;
}
}
...
...
@@ -290,9 +300,20 @@ int main(int argc, char** argv){
puts
(
"5'-3' translation..."
);
(
rna
)
?
genetic_code
=
gc_std
:
genetic_code
=
gc_std_DNA
;
translate_3_frames
(
inFileName
,
tmp_53_pro_file
,
tmp_53_dna_file
,
false
);
// XXX DIRTY CLEANING
// awk '/^>/ {if (seq != "") {print head""seq;} seq=""; head=$0"\n";} /^[^>]/ {seq=seq""$0"\n";} END {if (seq != "") print head""seq;}' input.fasta > output.fasta
string
command
=
"awk '/^>/ {if (seq !=
\"\"
) {print head
\"\"
seq;} seq=
\"\"
; head=$0
\"\\
n
\"
;} /^[^>]/ {seq=seq
\"\"
$0
\"\\
n
\"
;} END {if (seq !=
\"\"
) print head
\"\"
seq;}' "
+
tmp_53_pro_file
+
" > "
+
output_pro
+
" && rm *.53pro *.53dna"
;
int
status
=
std
::
system
(
command
.
c_str
());
if
(
status
!=
0
)
{
std
::
cerr
<<
"Error: system call failed with status "
<<
status
<<
std
::
endl
;
return
1
;
}
puts
(
"Done"
);
if
(
not
senseStrand
){
// TODO Warning for RNA sequence
/* Reversion of the input sequence by system call: rev + tac */
puts
(
"Genome reversion..."
);
if
(
system
(
(
"rev "
+
inFileName
+
" | tac > "
+
tmp_reversed_input
).
c_str
()
)
!=
0
){
...
...
@@ -335,8 +356,7 @@ int main(int argc, char** argv){
else
{
puts
(
"Done"
);
}
}
...
...
Please
register
or
login
to post a comment