Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
BioHPC
slopetree
Commits
a51aac66
Commit
a51aac66
authored
Mar 23, 2016
by
Raquel Bromberg
Browse files
Minor changes to make mtax.cpp more standalone and not rely on files generated by other classes
parent
f27a7156
Changes
1
Hide whitespace changes
Inline
Side-by-side
mtax.cpp
View file @
a51aac66
...
...
@@ -4,19 +4,27 @@
#include <vector>
#include <map>
#include "util.h"
using
namespace
std
;
void
separate_fields
(
string
line
,
vector
<
string
>&
fields
,
char
separator
);
void
create_genome_names
(
string
path
,
string
bfn
);
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
3
)
{
cout
<<
"Wrong use of mtax: ./mtax <path to directory
containing genome names
> <path to directory containing names.dmp and nodes.dmp>"
<<
endl
;
cout
<<
"Wrong use of mtax: ./mtax <path to
main
directory> <path to
Taxonomy
directory containing names.dmp and nodes.dmp>"
<<
endl
;
exit
(
1
);
}
string
names_file
=
argv
[
1
];
string
path
,
bfn
;
util
u
;
u
.
extract_paths
(
names_file
,
path
,
bfn
);
create_genome_names
(
path
,
bfn
);
string
names_file1
=
names_file
+
"/genome_names.txt"
;
string
tax_dir
=
argv
[
2
];
...
...
@@ -295,3 +303,36 @@ void separate_fields(string line,vector<string>& fields, char separator)
// cout<<"i="<<fields.at(i)<<endl;
}
}
void
create_genome_names
(
string
path
,
string
bfn
)
{
ofstream
gmstream
;
string
gmfile
=
path
+
"/"
+
bfn
+
"/genome_names.txt"
;
gmstream
.
open
(
gmfile
.
c_str
());
if
(
gmstream
.
fail
())
{
cout
<<
"Failed to open gmstream to gmfile="
<<
gmfile
<<
endl
;
exit
(
1
);
}
util
u
;
int
main_set_size
;
int
ref_set_size
;
u
.
get_mss
(
path
+
"/"
+
bfn
+
"/"
+
bfn
+
"_info.txt"
,
main_set_size
);
u
.
get_rss
(
path
+
"/"
+
bfn
+
"/"
+
bfn
+
"_info.txt"
,
ref_set_size
);
for
(
int
i
=
0
;
i
<
main_set_size
+
ref_set_size
;
i
++
)
{
string
tn
=
u
.
get_oname
(
path
+
"/"
+
bfn
+
"/"
,
i
);
// string tn=organisms.at(i).get_directory();
for
(
int
f
=
0
;
f
<
tn
.
length
();
f
++
)
{
if
(
tn
[
f
]
==
'_'
)
{
tn
[
f
]
=
' '
;
}
}
gmstream
<<
tn
<<
endl
;
}
gmstream
.
close
();
}
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