Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aevol-eukaryotes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LUISELLI Juliette
aevol-eukaryotes
Commits
a6d053c6
Commit
a6d053c6
authored
1 year ago
by
David Parsons
Browse files
Options
Downloads
Patches
Plain Diff
extract fn read_sequence_file
parent
a25a7553
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/aevol_create.cpp
+27
-17
27 additions, 17 deletions
src/aevol_create.cpp
with
27 additions
and
17 deletions
src/aevol_create.cpp
+
27
−
17
View file @
a6d053c6
...
@@ -48,6 +48,7 @@ using namespace aevol;
...
@@ -48,6 +48,7 @@ using namespace aevol;
// Helper functions
// Helper functions
void
print_help
(
char
*
prog_path
);
void
print_help
(
char
*
prog_path
);
void
interpret_cmd_line_options
(
int
argc
,
char
*
argv
[]);
void
interpret_cmd_line_options
(
int
argc
,
char
*
argv
[]);
std
::
list
<
std
::
string
>
read_sequence_file
(
const
std
::
string
&
chromosome_file_name
);
// Command-line option variables
// Command-line option variables
static
std
::
string
param_file_name
;
static
std
::
string
param_file_name
;
...
@@ -65,27 +66,16 @@ int main(int argc, char* argv[]) {
...
@@ -65,27 +66,16 @@ int main(int argc, char* argv[]) {
// Initialize the experiment manager
// Initialize the experiment manager
exp_manager
=
new
ExpManager
();
exp_manager
=
new
ExpManager
();
// Initialize the simulation from the parameter file
// Initialize the simulation from the parameter file (and the provided sequences if any)
std
::
list
<
std
::
string
>
chromosomes
;
if
(
chromosome_file_name
.
length
()
!=
0
)
{
if
(
chromosome_file_name
.
length
()
!=
0
)
{
std
::
ifstream
chromosome_file
(
chromosome_file_name
);
auto
chromosomes
=
read_sequence_file
(
chromosome_file_name
);
if
(
not
chromosome_file
)
{
Utils
::
ExitWithUsrMsg
(
std
::
string
(
"failed to open source chromosome file "
)
+
chromosome_file_name
);
}
std
::
string
chromosome
;
std
::
getline
(
chromosome_file
,
chromosome
);
if
(
not
chromosome_file
or
chromosome
.
length
()
==
0
)
{
Utils
::
ExitWithUsrMsg
(
std
::
string
(
"failed to read from chromosome file "
)
+
chromosome_file_name
);
}
chromosomes
.
push_back
(
std
::
move
(
chromosome
));
std
::
cout
<<
"Loading chromosome from text file "
<<
chromosome_file_name
<<
" ("
<<
chromosomes
.
front
().
length
()
std
::
cout
<<
"Loading chromosome from text file "
<<
chromosome_file_name
<<
" ("
<<
chromosomes
.
front
().
length
()
<<
" base pairs)"
<<
std
::
endl
;
<<
" base pairs)"
<<
std
::
endl
;
ParamLoader
::
load
(
param_values
,
exp_manager
,
chromosomes
,
true
);
}
else
{
ParamLoader
::
load
(
param_values
,
exp_manager
,
true
);
}
}
ParamLoader
::
load
(
param_values
,
exp_manager
,
chromosomes
,
true
);
// 8) Save the experiment
// 8) Save the experiment
exp_manager
->
Save
(
true
);
exp_manager
->
Save
(
true
);
...
@@ -185,3 +175,23 @@ void interpret_cmd_line_options(int argc, char* argv[]) {
...
@@ -185,3 +175,23 @@ void interpret_cmd_line_options(int argc, char* argv[]) {
param_file_name
=
DEFAULT_PARAM_FILE_NAME
;
param_file_name
=
DEFAULT_PARAM_FILE_NAME
;
}
}
}
}
std
::
list
<
std
::
string
>
read_sequence_file
(
const
std
::
string
&
chromosome_file_name
)
{
assert
(
chromosome_file_name
.
length
()
!=
0
);
std
::
list
<
std
::
string
>
chromosomes
;
std
::
ifstream
chromosome_file
(
chromosome_file_name
);
if
(
not
chromosome_file
)
{
Utils
::
ExitWithUsrMsg
(
std
::
string
(
"failed to open source chromosome file "
)
+
chromosome_file_name
);
}
std
::
string
chromosome
;
std
::
getline
(
chromosome_file
,
chromosome
);
if
(
not
chromosome_file
or
chromosome
.
length
()
==
0
)
{
Utils
::
ExitWithUsrMsg
(
std
::
string
(
"failed to read from chromosome file "
)
+
chromosome_file_name
);
}
chromosomes
.
push_back
(
std
::
move
(
chromosome
));
return
chromosomes
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment