Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Ludovic PLATON
/
IRSOM
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
Ludovic PLATON
2018-03-22 23:58:20 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3875beabf665e177a19dc84783baa29e0a47dd50
3875beab
1 parent
7431e16e
Add new feature element in Featurer, remove KMER6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
170 additions
and
161 deletions
Featurer/feature.cpp
Featurer/feature.h
Featurer/main.cpp
Featurer/feature.cpp
View file @
3875bea
This diff is collapsed. Click to expand it.
Featurer/feature.h
View file @
3875bea
...
...
@@ -10,161 +10,170 @@
#include "data/data_basic.h"
namespace
feature
{
class
Feature
:
public
data
::
Data_basic
{
protected
:
virtual
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
Feature
(
std
::
string
name
)
:
data
::
Data_basic
(
name
){}
Feature
(
const
data
::
Data_basic
*
db
)
:
data
::
Data_basic
(
db
){
this
->
init
(
db
);}
virtual
~
Feature
(){}
virtual
float
dist
(
feature
::
Feature
*
a
)
=
0
;
std
::
string
to_dict
()
=
0
;
std
::
string
to_csv
()
=
0
;
virtual
std
::
string
getID
(){
return
this
->
TYPE
;
}
virtual
data
::
Data_basic
*
clone
()
=
0
;
std
::
string
getEntry_name
()
const
;
};
class
SeqLength
:
public
feature
::
Feature
{
protected
:
int
l
;
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
();
int
getL
()
const
;
SeqLength
(
const
entry
::
Sequence
&
s
)
:
feature
::
Feature
(
s
.
getName
()),
l
(
s
.
getLength
()){}
SeqLength
(
const
std
::
string
&
name
,
const
int
&
seql
)
:
feature
::
Feature
(
name
),
l
(
seql
){}
SeqLength
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
~
SeqLength
(){}
float
dist
(
Feature
*
a
);
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
};
class
Kmer
:
public
feature
::
Feature
{
protected
:
unsigned
int
k
;
std
::
unordered_map
<
std
::
string
,
float
>
kmer
;
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
(
const
unsigned
int
&
k
);
Kmer
(
entry
::
Sequence
&
s
,
const
unsigned
int
&
k
);
Kmer
(
const
std
::
string
&
name
,
const
unsigned
int
&
k
,
const
std
::
unordered_map
<
std
::
string
,
float
>
kmer
)
:
feature
::
Feature
(
name
),
k
(
k
),
kmer
(
kmer
){}
Kmer
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
~
Kmer
(){}
float
dist
(
feature
::
Feature
*
a
);
unsigned
int
getK
()
const
;
std
::
unordered_map
<
std
::
string
,
float
>
getKmer
()
const
;
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
};
class
ORF
:
public
feature
::
Feature
{
protected
:
static
const
std
::
vector
<
std
::
string
>
START
;
static
const
std
::
vector
<
std
::
string
>
END
;
static
bool
in_start
(
const
std
::
string
&
c
);
static
bool
in_end
(
const
std
::
string
&
c
);
unsigned
int
length
;
float
coverage
;
/*
class
Feature
:
public
data
::
Data_basic
{
protected
:
virtual
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
Feature
(
std
::
string
name
)
:
data
::
Data_basic
(
name
){}
Feature
(
const
data
::
Data_basic
*
db
)
:
data
::
Data_basic
(
db
){
this
->
init
(
db
);}
virtual
~
Feature
(){}
virtual
float
dist
(
feature
::
Feature
*
a
)
=
0
;
std
::
string
to_dict
()
=
0
;
std
::
string
to_csv
()
=
0
;
virtual
std
::
string
getID
(){
return
this
->
TYPE
;
}
virtual
data
::
Data_basic
*
clone
()
=
0
;
std
::
string
getEntry_name
()
const
;
};
class
SeqLength
:
public
feature
::
Feature
{
protected
:
int
l
;
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
();
int
getL
()
const
;
SeqLength
(
const
entry
::
Sequence
&
s
)
:
feature
::
Feature
(
s
.
getName
()),
l
(
s
.
getLength
()){}
SeqLength
(
const
std
::
string
&
name
,
const
int
&
seql
)
:
feature
::
Feature
(
name
),
l
(
seql
){}
SeqLength
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
~
SeqLength
(){}
float
dist
(
Feature
*
a
);
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
};
class
Kmer
:
public
feature
::
Feature
{
protected
:
unsigned
int
k
;
std
::
unordered_map
<
std
::
string
,
float
>
kmer
;
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
(
const
unsigned
int
&
k
);
Kmer
(
entry
::
Sequence
&
s
,
const
unsigned
int
&
k
);
Kmer
(
const
std
::
string
&
name
,
const
unsigned
int
&
k
,
const
std
::
unordered_map
<
std
::
string
,
float
>
kmer
)
:
feature
::
Feature
(
name
),
k
(
k
),
kmer
(
kmer
){}
Kmer
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
~
Kmer
(){}
float
dist
(
feature
::
Feature
*
a
);
unsigned
int
getK
()
const
;
std
::
unordered_map
<
std
::
string
,
float
>
getKmer
()
const
;
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
};
class
ORF
:
public
feature
::
Feature
{
protected
:
static
const
std
::
vector
<
std
::
string
>
START
;
static
const
std
::
vector
<
std
::
string
>
END
;
static
bool
in_start
(
const
std
::
string
&
c
);
static
bool
in_end
(
const
std
::
string
&
c
);
unsigned
int
length
;
float
coverage
;
float
start_mean
;
float
start_std
;
float
end_mean
;
float
end_std
;
/*
float start_center, start_std;
float end_center, end_std;
*/
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
();
~
ORF
(){}
ORF
(
const
entry
::
Sequence
&
s
);
ORF
(
const
std
::
string
&
name
,
const
unsigned
int
&
length
,
const
float
&
coverage
)
:
feature
::
Feature
(
name
),
length
(
length
),
coverage
(
coverage
){}
ORF
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
float
dist
(
feature
::
Feature
*
a
);
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
float
getCoverage
()
const
;
float
getStart_center
()
const
;
float
getStart_std
()
const
;
float
getEnd_center
()
const
;
float
getEnd_std
()
const
;
unsigned
int
getMax_length
()
const
;
unsigned
int
getLength
()
const
;
};
class
CodonPosition
:
public
feature
::
Feature
{
protected
:
float
position
[
4
];
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
();
~
CodonPosition
(){}
CodonPosition
(
const
entry
::
Sequence
&
s
);
CodonPosition
(
const
std
::
string
&
name
,
const
float
(
&
position
)[
4
])
:
feature
::
Feature
(
name
){
std
::
copy
(
std
::
begin
(
position
),
std
::
end
(
position
),
std
::
begin
(
this
->
position
));
}
CodonPosition
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
const
float
*
getPosition
();
float
dist
(
Feature
*
a
);
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
};
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
();
~
ORF
(){}
ORF
(
const
entry
::
Sequence
&
s
);
ORF
(
const
std
::
string
&
name
,
const
unsigned
int
&
length
,
const
float
&
coverage
)
:
feature
::
Feature
(
name
),
length
(
length
),
coverage
(
coverage
){}
ORF
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
float
dist
(
feature
::
Feature
*
a
);
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
float
getCoverage
()
const
;
float
getStart_center
()
const
;
float
getStart_std
()
const
;
float
getEnd_center
()
const
;
float
getEnd_std
()
const
;
unsigned
int
getMax_length
()
const
;
unsigned
int
getLength
()
const
;
};
class
CodonBiases
:
public
feature
::
Feature
{
protected
:
float
position
[
4
]
=
{
0
,
0
,
0
,
0
};
float
composition
[
4
]
=
{
0
,
0
,
0
,
0
};
void
init
(
const
Data_basic
*
db
);
public
:
static
const
std
::
string
TYPE
;
static
const
std
::
string
ENTRY_TYPE
;
static
callable
::
Callable
<
data
::
Data_basic
*
,
data
::
Data_basic
*>
*
get_callable
();
~
CodonBiases
();
CodonBiases
(
const
entry
::
Sequence
&
s
);
CodonBiases
(
const
std
::
string
&
name
,
const
float
(
&
position
)[
4
],
const
float
(
&
composition
)[
4
])
:
feature
::
Feature
(
name
){
std
::
copy
(
std
::
begin
(
position
),
std
::
end
(
position
),
std
::
begin
(
this
->
position
));
std
::
copy
(
std
::
begin
(
composition
),
std
::
end
(
composition
),
std
::
begin
(
this
->
composition
));
}
CodonBiases
(
const
data
::
Data_basic
*
db
)
:
feature
::
Feature
(
db
){
this
->
init
(
db
);}
const
float
*
getPosition
();
float
dist
(
Feature
*
a
);
data
::
Data_basic
*
clone
();
std
::
string
to_dict
();
std
::
string
to_csv
();
std
::
string
getID
(){
return
this
->
TYPE
;
}
};
}
#endif // FEATURE_H
...
...
Featurer/main.cpp
View file @
3875bea
...
...
@@ -57,10 +57,10 @@ int main(int argc, char* argv[])
ds
[
"KMER3"
]
=
tmp_ds
;
create_feature_maker
(
kmer
,
feature
::
Kmer
::
TYPE
+
std
::
to_string
(
6
),
tmp_ds
,
&
re
);
kmer
=
static_cast
<
feature
::
Feature_callable
*>
(
feature
::
Kmer
::
get_callable
(
6
));
tmp_ds
=
new
data
::
Data_Store_Map
(
output
+
"KMER6.txt"
);
ds
[
"KMER6"
]
=
tmp_ds
;
create_feature_maker
(
kmer
,
feature
::
Kmer
::
TYPE
+
std
::
to_string
(
6
),
tmp_ds
,
&
re
);
//
kmer = static_cast<feature::Feature_callable*>(feature::Kmer::get_callable(6));
//
tmp_ds = new data::Data_Store_Map(output+"KMER6.txt");
//
ds["KMER6"] = tmp_ds;
//
create_feature_maker(kmer,feature::Kmer::TYPE+std::to_string(6),tmp_ds,&re);
/* *********** ORF *********************/
/* ORF callable */
...
...
@@ -70,12 +70,12 @@ int main(int argc, char* argv[])
ds
[
"ORF"
]
=
tmp_ds
;
create_feature_maker
(
orf
,
feature
::
ORF
::
TYPE
,
tmp_ds
,
&
re
);
/* *********** Codon
Position
***************/
/* *********** Codon
Biases
***************/
feature
::
Feature_callable
*
c
p
=
static_cast
<
feature
::
Feature_callable
*>
(
feature
::
CodonPosition
::
get_callable
());
tmp_ds
=
new
data
::
Data_Store_Map
(
output
+
"C
P
.txt"
);
ds
[
"C
P
"
]
=
tmp_ds
;
create_feature_maker
(
c
p
,
feature
::
CodonPosition
::
TYPE
,
tmp_ds
,
&
re
);
feature
::
Feature_callable
*
c
b
=
static_cast
<
feature
::
Feature_callable
*>
(
feature
::
CodonBiases
::
get_callable
());
tmp_ds
=
new
data
::
Data_Store_Map
(
output
+
"C
B
.txt"
);
ds
[
"C
B
"
]
=
tmp_ds
;
create_feature_maker
(
c
b
,
feature
::
CodonBiases
::
TYPE
,
tmp_ds
,
&
re
);
/* *********** Fasta reader *************/
...
...
Please
register
or
login
to post a comment