Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,688
Issues
1,688
List
Boards
Labels
Service Desk
Milestones
Merge Requests
84
Merge Requests
84
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
2cb2d703
Commit
2cb2d703
authored
Nov 06, 2014
by
Mathieu Giraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/fasta.{h,cpp}: adds (verbose=true) optional argument to some Fasta methods
parent
637bae63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
algo/core/fasta.cpp
algo/core/fasta.cpp
+8
-5
algo/core/fasta.h
algo/core/fasta.h
+4
-3
No files found.
algo/core/fasta.cpp
View file @
2cb2d703
...
@@ -39,31 +39,34 @@ Fasta::Fasta(int extract_field, string extract_separator)
...
@@ -39,31 +39,34 @@ Fasta::Fasta(int extract_field, string extract_separator)
}
}
Fasta
::
Fasta
(
const
string
&
input
,
Fasta
::
Fasta
(
const
string
&
input
,
int
extract_field
,
string
extract_separator
)
int
extract_field
,
string
extract_separator
,
bool
verbose
)
{
{
init
(
extract_field
,
extract_separator
);
init
(
extract_field
,
extract_separator
);
if
(
!
input
.
size
())
// Do not open empty filenames (D germline if not segmentD)
if
(
!
input
.
size
())
// Do not open empty filenames (D germline if not segmentD)
return
;
return
;
add
(
input
);
add
(
input
,
verbose
);
}
}
void
Fasta
::
add
(
istream
&
in
)
{
void
Fasta
::
add
(
istream
&
in
,
bool
verbose
)
{
in
>>
*
this
;
in
>>
*
this
;
if
(
verbose
)
cout
<<
"
\t
"
<<
setw
(
6
)
<<
total_size
<<
" bp in "
<<
setw
(
3
)
<<
size
()
<<
" sequences"
<<
endl
;
cout
<<
"
\t
"
<<
setw
(
6
)
<<
total_size
<<
" bp in "
<<
setw
(
3
)
<<
size
()
<<
" sequences"
<<
endl
;
}
}
void
Fasta
::
add
(
const
string
&
filename
)
{
void
Fasta
::
add
(
const
string
&
filename
,
bool
verbose
)
{
ifstream
is
(
filename
.
c_str
());
ifstream
is
(
filename
.
c_str
());
if
(
is
.
fail
())
if
(
is
.
fail
())
{
{
throw
invalid_argument
(
" !! Error in opening file: "
+
filename
);
throw
invalid_argument
(
" !! Error in opening file: "
+
filename
);
}
}
if
(
verbose
)
cout
<<
" <== "
<<
filename
;
cout
<<
" <== "
<<
filename
;
add
(
is
);
add
(
is
,
verbose
);
is
.
close
();
is
.
close
();
}
}
...
...
algo/core/fasta.h
View file @
2cb2d703
...
@@ -47,7 +47,8 @@ public:
...
@@ -47,7 +47,8 @@ public:
* valid
* valid
*/
*/
Fasta
(
const
string
&
input
,
Fasta
(
const
string
&
input
,
int
extract_field
=
0
,
string
extract_separator
=
"|"
);
int
extract_field
=
0
,
string
extract_separator
=
"|"
,
bool
verbose
=
true
);
int
size
()
const
;
int
size
()
const
;
/**
/**
...
@@ -63,13 +64,13 @@ public:
...
@@ -63,13 +64,13 @@ public:
/**
/**
* Add the content of the stream to the current object
* Add the content of the stream to the current object
*/
*/
void
add
(
istream
&
in
);
void
add
(
istream
&
in
,
bool
verbose
=
true
);
/**
/**
* Add the content of the file to the current object
* Add the content of the file to the current object
* @throws invalid_argument if the file cannot be opened or
* @throws invalid_argument if the file cannot be opened or
* if the content is not valid
* if the content is not valid
*/
*/
void
add
(
const
string
&
filename
);
void
add
(
const
string
&
filename
,
bool
verbose
=
true
);
friend
istream
&
operator
>>
(
istream
&
,
Fasta
&
);
friend
istream
&
operator
>>
(
istream
&
,
Fasta
&
);
};
};
...
...
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