Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bedtools2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
R3
legacy
bedtools2
Commits
3b468dd3
Commit
3b468dd3
authored
12 years ago
by
Brent Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
add n_intersections to jaccard output
parent
a09c6556
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/jaccard/jaccard.cpp
+8
-4
8 additions, 4 deletions
src/jaccard/jaccard.cpp
src/jaccard/jaccard.h
+1
-1
1 addition, 1 deletion
src/jaccard/jaccard.h
test/jaccard/test-jaccard.sh
+10
-10
10 additions, 10 deletions
test/jaccard/test-jaccard.sh
with
19 additions
and
15 deletions
src/jaccard/jaccard.cpp
+
8
−
4
View file @
3b468dd3
...
@@ -53,7 +53,7 @@ Jaccard::~Jaccard(void) {
...
@@ -53,7 +53,7 @@ Jaccard::~Jaccard(void) {
}
}
unsigned
long
Jaccard
::
GetIntersection
()
{
unsigned
long
Jaccard
::
GetIntersection
(
size_t
&
n_intersections
)
{
_bedA
=
new
BedFile
(
_bedAFile
);
_bedA
=
new
BedFile
(
_bedAFile
);
_bedB
=
new
BedFile
(
_bedBFile
);
_bedB
=
new
BedFile
(
_bedBFile
);
...
@@ -70,13 +70,15 @@ unsigned long Jaccard::GetIntersection() {
...
@@ -70,13 +70,15 @@ unsigned long Jaccard::GetIntersection() {
hit_set
.
second
.
reserve
(
10000
);
hit_set
.
second
.
reserve
(
10000
);
while
(
sweep
.
Next
(
hit_set
))
{
while
(
sweep
.
Next
(
hit_set
))
{
I
+=
GetTotalIntersection
(
hit_set
.
first
,
hit_set
.
second
);
I
+=
GetTotalIntersection
(
hit_set
.
first
,
hit_set
.
second
);
n_intersections
+=
hit_set
.
second
.
size
();
}
}
return
I
;
return
I
;
}
}
void
Jaccard
::
CalculateJaccard
()
{
void
Jaccard
::
CalculateJaccard
()
{
unsigned
long
I
=
GetIntersection
();
size_t
n_intersections
=
0
;
unsigned
long
I
=
GetIntersection
(
n_intersections
);
unsigned
long
U
=
_bedA
->
getTotalFlattenedLength
()
+
\
unsigned
long
U
=
_bedA
->
getTotalFlattenedLength
()
+
\
_bedB
->
getTotalFlattenedLength
();
_bedB
->
getTotalFlattenedLength
();
...
@@ -84,13 +86,15 @@ void Jaccard::CalculateJaccard() {
...
@@ -84,13 +86,15 @@ void Jaccard::CalculateJaccard() {
// header
// header
cout
<<
"intersection
\t
"
cout
<<
"intersection
\t
"
<<
"union
\t
"
<<
"union
\t
"
<<
"jaccard"
<<
"jaccard
\t
"
<<
"n_intersections"
<<
endl
;
<<
endl
;
// result
// result
cout
<<
I
<<
"
\t
"
cout
<<
I
<<
"
\t
"
<<
U
-
I
<<
"
\t
"
<<
U
-
I
<<
"
\t
"
<<
(
float
)
I
/
((
float
)
U
-
(
float
)
I
)
<<
(
float
)
I
/
((
float
)
U
-
(
float
)
I
)
<<
"
\t
"
<<
n_intersections
<<
endl
;
<<
endl
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/jaccard/jaccard.h
+
1
−
1
View file @
3b468dd3
...
@@ -57,7 +57,7 @@ private:
...
@@ -57,7 +57,7 @@ private:
//------------------------------------------------
//------------------------------------------------
// private methods
// private methods
//------------------------------------------------
//------------------------------------------------
unsigned
long
GetIntersection
();
unsigned
long
GetIntersection
(
size_t
&
n_intersections
);
unsigned
long
GetUnion
();
unsigned
long
GetUnion
();
void
CalculateJaccard
();
void
CalculateJaccard
();
...
...
This diff is collapsed.
Click to expand it.
test/jaccard/test-jaccard.sh
+
10
−
10
View file @
3b468dd3
...
@@ -14,8 +14,8 @@ check()
...
@@ -14,8 +14,8 @@ check()
###########################################################
###########################################################
echo
" jaccard.t01...
\c
"
echo
" jaccard.t01...
\c
"
echo
\
echo
\
"intersection union jaccard
"intersection union jaccard
n_intersections
110 110 1"
>
exp
110 110 1
2
"
>
exp
$BT
jaccard
-a
a.bed
-b
a.bed
>
obs
$BT
jaccard
-a
a.bed
-b
a.bed
>
obs
check obs exp
check obs exp
rm
obs exp
rm
obs exp
...
@@ -23,16 +23,16 @@ rm obs exp
...
@@ -23,16 +23,16 @@ rm obs exp
echo
" jaccard.t02...
\c
"
echo
" jaccard.t02...
\c
"
echo
\
echo
\
"intersection union jaccard
"intersection union jaccard
n_intersections
10 140 0.0714286"
>
exp
10 140 0.0714286
1
"
>
exp
$BT
jaccard
-a
a.bed
-b
b.bed
>
obs
$BT
jaccard
-a
a.bed
-b
b.bed
>
obs
check obs exp
check obs exp
rm
obs exp
rm
obs exp
echo
" jaccard.t03...
\c
"
echo
" jaccard.t03...
\c
"
echo
\
echo
\
"intersection union jaccard
"intersection union jaccard
n_intersections
10 200 0.05"
>
exp
10 200 0.05
1
"
>
exp
$BT
jaccard
-a
a.bed
-b
c.bed
>
obs
$BT
jaccard
-a
a.bed
-b
c.bed
>
obs
check obs exp
check obs exp
rm
obs exp
rm
obs exp
...
@@ -40,8 +40,8 @@ rm obs exp
...
@@ -40,8 +40,8 @@ rm obs exp
echo
" jaccard.t04...
\c
"
echo
" jaccard.t04...
\c
"
echo
\
echo
\
"intersection union jaccard
"intersection union jaccard
n_intersections
0 210 0"
>
exp
0 210
0
0"
>
exp
$BT
jaccard
-a
a.bed
-b
d.bed
>
obs
$BT
jaccard
-a
a.bed
-b
d.bed
>
obs
check obs exp
check obs exp
rm
obs exp
rm
obs exp
...
@@ -51,8 +51,8 @@ rm obs exp
...
@@ -51,8 +51,8 @@ rm obs exp
###########################################################
###########################################################
echo
" jaccard.t05...
\c
"
echo
" jaccard.t05...
\c
"
echo
\
echo
\
"intersection union jaccard
"intersection union jaccard
n_intersections
10 140 0.0714286"
>
exp
10 140 0.0714286
1
"
>
exp
cat
a.bed |
$BT
jaccard
-a
-
-b
b.bed
>
obs
cat
a.bed |
$BT
jaccard
-a
-
-b
b.bed
>
obs
check obs exp
check obs exp
rm
obs exp
rm
obs exp
...
...
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