Toggle navigation
Toggle navigation
This project
Loading...
Sign in
EvryRNA
/
C-RCPred
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
guillaume
2022-11-12 20:03:33 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c5ec7954515c46534d3a8934f72402ef61695e77
c5ec7954
1 parent
54344319
remove dlib dependency
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
105 deletions
Dockerfile
Makefile
extlib/dlib-19.17.tar.bz2
src/utils.cpp
src/utils.h
Dockerfile
View file @
c5ec795
...
...
@@ -68,8 +68,6 @@ RUN cd /tmp && \
make
&&
\
make install
# Install Dlib
RUN
cd
/tmp
&&
tar -xjf dlib-19.17.tar.bz2 -C /opt
RUN
rm -rf /tmp/
*
# ----------------
...
...
Makefile
View file @
c5ec795
####### Compiler, tools and options
CXX
=
g++
CXXFLAGS
=
-pipe -std
=
c++17 -O2 -march
=
x86-64 -mtune
=
generic -O2 -pipe -fno-plt -Wall -W -D_REENTRANT -fPIC
INCPATH
=
-I./src -I. -I/opt/ibm/ILOG/CPLEX_Studio221/cplex/include -I/
opt/dlib-19.17 -I/
usr/local/include
INCPATH
=
-I./src -I. -I/opt/ibm/ILOG/CPLEX_Studio221/cplex/include -I/usr/local/include
DEL_FILE
=
rm -f
LINK
=
g++
LFLAGS
=
-Wl,-O1 -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
LIBS
=
-L/opt/ibm/ILOG/CPLEX_Studio221/cplex/lib/x86-64_linux/static_pic/ -lcplex -L/usr/local/lib/ -lRNA -lnupackconc -lnupackpfunc -lnupackutils -L/usr/lib/x86_64-linux-gnu/ -lpthread -lX11 -ldl
####### Files
OBJECTS
=
source.o
\
graph.o
\
OBJECTS
=
graph.o
\
main.o
\
rna.o
\
structure.o
\
...
...
@@ -46,9 +45,6 @@ C-RCPred: /opt/ibm/ILOG/CPLEX_Studio221/cplex/lib/x86-64_linux/static_pic/libcpl
all
:
Makefile C-RCPred
####### Compile
source.o
:
$(CXX)
-c
$(CXXFLAGS)
$(INCPATH)
-o source.o /opt/dlib-19.17/dlib/all/source.cpp
graph.o
:
$(CXX)
-c
$(CXXFLAGS)
$(INCPATH)
-o graph.o ./src/graph.cpp
...
...
extlib/dlib-19.17.tar.bz2
deleted
100644 → 0
View file @
5434431
This file is too large to display.
src/utils.cpp
View file @
c5ec795
#include "utils.h"
#include <dlib/clustering.h>
#include <sys/stat.h>
#include <boost/algorithm/string.hpp>
...
...
@@ -146,97 +145,6 @@ int dominate(std::vector < float > c1, std::vector < float > c2) {
return
dominate
;
}
void
readFeatureVector
(
std
::
vector
<
dlib
::
matrix
<
float
>
>
&
features
){
std
::
vector
<
std
::
vector
<
int
>
>
featureIds
;
std
::
vector
<
std
::
vector
<
float
>
>
featureValues
;
std
::
vector
<
int
>
commonFeatureIds
,
intersec
;
int
nline
=
0
;
std
::
string
name
=
"graphNSPDK.txt.feature"
,
line
=
""
;
std
::
vector
<
std
::
string
>
elements
,
elements2
;
struct
stat
buf
;
if
(
(
stat
(
name
.
c_str
(),
&
buf
)
==
0
))
{
std
::
ifstream
ifs
(
name
);
while
(
std
::
getline
(
ifs
,
line
))
{
if
(
line
[
0
]
!=
'\n'
and
line
!=
""
)
{
featureIds
.
push_back
(
std
::
vector
<
int
>
());
featureValues
.
push_back
(
std
::
vector
<
float
>
());
boost
::
split
(
elements
,
line
,
boost
::
is_any_of
(
"
\t
"
),
boost
::
token_compress_on
);
uint
count
=
0
;
for
(
size_t
i
=
0
,
size
=
elements
.
size
();
i
!=
size
;
i
++
)
{
if
(
elements
[
i
]
!=
""
)
{
boost
::
split
(
elements2
,
elements
[
i
],
boost
::
is_any_of
(
":"
),
boost
::
token_compress_on
);
featureIds
[
nline
].
push_back
(
std
::
stoi
(
elements2
[
0
]));
featureValues
[
nline
].
push_back
(
std
::
stof
(
elements2
[
1
]));
count
++
;
}
}
std
::
cout
<<
" count = "
<<
count
<<
std
::
endl
;
}
nline
++
;
}
ifs
.
close
();
}
// Intersection of all the feature ids
commonFeatureIds
=
featureIds
[
0
];
for
(
size_t
i
=
1
,
size
=
featureIds
.
size
();
i
!=
size
;
i
++
)
{
std
::
set_intersection
(
commonFeatureIds
.
begin
(),
commonFeatureIds
.
end
(),
featureIds
[
i
].
begin
(),
featureIds
[
i
].
end
(),
std
::
back_inserter
(
intersec
));
commonFeatureIds
=
intersec
;
intersec
.
clear
();
}
std
::
cout
<<
"commonFeatureIds.size = "
<<
commonFeatureIds
.
size
()
<<
std
::
endl
;
// Recover only the common features
for
(
size_t
i
=
0
,
size
=
featureIds
.
size
();
i
!=
size
;
i
++
)
{
for
(
size_t
j
=
0
,
size2
=
featureIds
[
i
].
size
();
j
!=
size2
;
j
++
)
{
if
(
featureIds
[
i
][
j
]
!=
commonFeatureIds
[
j
])
{
featureIds
[
i
].
erase
(
featureIds
[
i
].
begin
()
+
j
);
featureValues
[
i
].
erase
(
featureValues
[
i
].
begin
()
+
j
);
size2
--
;
j
--
;
}
}
}
// Put into the common features into a matrix
dlib
::
matrix
<
float
>
feature
;
feature
.
set_size
(
uint
(
featureIds
[
0
].
size
()),
1
);
// nrow = x and only one column
for
(
size_t
i
=
0
,
size
=
featureValues
.
size
();
i
!=
size
;
i
++
)
{
for
(
size_t
j
=
0
,
size2
=
featureValues
[
i
].
size
();
j
!=
size2
;
j
++
)
{
feature
(
long
(
j
))
=
featureValues
[
i
][
j
];
}
features
.
push_back
(
feature
);
}
}
void
readKernelMatrix
(
dlib
::
matrix
<
double
>
&
K
,
uint
length
)
{
K
.
set_size
(
length
,
length
);
std
::
string
name
=
"graphNSPDK.txt.kernel"
,
line
=
""
;
std
::
vector
<
std
::
string
>
elements
;
struct
stat
buf
;
int
nline
=
0
;
if
(
(
stat
(
name
.
c_str
(),
&
buf
)
==
0
))
{
std
::
ifstream
ifs
(
name
);
while
(
std
::
getline
(
ifs
,
line
))
{
if
(
line
[
0
]
!=
'\n'
and
line
!=
""
)
{
boost
::
split
(
elements
,
line
,
boost
::
is_any_of
(
"
\t
"
),
boost
::
token_compress_on
);
for
(
size_t
i
=
0
,
size
=
elements
.
size
();
i
!=
size
;
i
++
)
{
if
(
elements
[
i
]
!=
""
)
K
(
nline
,
i
)
=
double
(
std
::
stof
(
elements
[
i
]));
}
}
nline
++
;
}
ifs
.
close
();
}
}
std
::
string
join
(
const
std
::
vector
<
std
::
string
>&
v
,
std
::
string
d
)
{
size_t
size
;
std
::
string
s
=
""
;
...
...
src/utils.h
View file @
c5ec795
...
...
@@ -4,7 +4,6 @@
#include <vector>
#include <utility>
#include <string>
#include <dlib/clustering.h>
static
const
float
PRECISION
=
0
.
00001
;
...
...
@@ -31,10 +30,6 @@ bool checkIC(std::string ic);
int
dominate
(
std
::
vector
<
float
>
c1
,
std
::
vector
<
float
>
c2
);
void
readFeatureVector
(
std
::
vector
<
dlib
::
matrix
<
float
>
>
&
features
);
void
readKernelMatrix
(
dlib
::
matrix
<
double
>
&
K
,
uint
length
);
std
::
string
join
(
const
std
::
vector
<
std
::
string
>&
v
,
std
::
string
d
);
#endif
...
...
Please
register
or
login
to post a comment