Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
khalid
radsex
Commits
3a1a60be
Commit
3a1a60be
authored
Oct 04, 2018
by
RomainFeron
Browse files
Merge branch 'master' into docs
parents
c7e7682d
e2102764
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/process_reads.cpp
View file @
3a1a60be
...
...
@@ -26,7 +26,7 @@ void process_reads(Parameters& parameters) {
for
(
int
i
=
0
;
i
<
parameters
.
get_value_from_name
<
int
>
(
par
);
++
i
)
{
threads
.
push_back
(
std
::
thread
(
file_processor
,
std
::
ref
(
input_files
),
std
::
ref
(
results
),
std
::
ref
(
results_mutex
),
std
::
ref
(
files_mutex
)));
}
for
(
auto
&
t
:
threads
)
t
.
join
();
par
=
"output_file_path"
;
...
...
@@ -36,6 +36,7 @@ void process_reads(Parameters& parameters) {
std
::
vector
<
std
::
string
>
individuals
;
for
(
auto
i
:
input_files
)
individuals
.
push_back
(
i
.
individual_name
);
// Generate the output file
output_process_reads
(
output_file_path
,
individuals
,
results
,
min_cov
);
...
...
@@ -50,6 +51,7 @@ inline void file_processor(std::vector<InputFile>& input_files, std::unordered_m
* A mutex protects the list of input files and another mutex protects the results structure
*/
bool
remaining_files
=
true
;
while
(
remaining_files
)
{
...
...
@@ -89,6 +91,7 @@ inline void process_file(InputFile& input_file, std::unordered_map<std::string,
// Read through the file and store the results
while
((
line_n
=
kseq_read
(
sequence
))
>=
0
)
{
++
temp_results
[
sequence
->
seq
.
s
];
if
(
line_n
%
1000
==
0
)
std
::
cout
<<
line_n
/
1000
<<
std
::
endl
;
}
kseq_destroy
(
sequence
);
// Destroy the seq object
...
...
src/sequence_file.cpp
View file @
3a1a60be
...
...
@@ -23,7 +23,7 @@ std::vector<InputFile> get_input_files(const std::string& input_dir_path) {
std
::
vector
<
std
::
string
>
split_name
;
InputFile
temp
;
while
((
dir_content
=
readdir
(
dir
))){
while
((
dir_content
=
readdir
(
dir
)))
{
current_file
=
dir_content
->
d_name
;
split_name
=
split
(
current_file
,
"."
);
...
...
@@ -32,9 +32,15 @@ std::vector<InputFile> get_input_files(const std::string& input_dir_path) {
// Careful: this will fail if the file name contains "." ... TODO: solve this problem
if
(
s
>
1
)
{
for
(
uint
i
=
1
;
i
<
split_name
.
size
();
++
i
)
extension
+=
"."
+
split_name
[
i
];
if
(
split_name
[
s
-
1
]
==
"gz"
and
s
>
2
)
{
extension
=
"."
+
split_name
[
s
-
2
]
+
"."
+
split_name
[
s
-
1
];
}
else
{
extension
=
"."
+
split_name
[
s
-
1
];
}
}
std
::
cout
<<
current_file
<<
" : "
<<
extension
<<
std
::
endl
;
if
(
std
::
find
(
extensions
.
begin
(),
extensions
.
end
(),
extension
)
!=
extensions
.
end
())
{
temp
.
individual_name
=
split_name
[
0
];
temp
.
path
=
input_dir_path
+
current_file
;
...
...
@@ -44,5 +50,11 @@ std::vector<InputFile> get_input_files(const std::string& input_dir_path) {
}
}
if
(
files
.
size
()
==
0
)
{
std
::
cout
<<
" ** Error: no valid input file found in input directory
\"
"
<<
input_dir_path
<<
"
\"
."
<<
std
::
endl
;
exit
(
1
);
}
return
files
;
}
Write
Preview
Supports
Markdown
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