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
a277bba0
Commit
a277bba0
authored
10 years ago
by
Brent Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
reorganize contingency table
parent
e1f71dfe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fisher/Fisher.cpp
+10
-15
10 additions, 15 deletions
src/fisher/Fisher.cpp
with
10 additions
and
15 deletions
src/fisher/Fisher.cpp
+
10
−
15
View file @
a277bba0
...
...
@@ -36,30 +36,25 @@ bool Fisher::calculate() {
// header
cout
<<
"# Contingency Table"
<<
endl
;
// for fisher's exact test, we need the contingency table
// XXXXXXXX | not in A | in A
// not in B | n11: in neither | n12: only in A
// in B | n21: only in B | n22: in A & B
//
double
left
,
right
,
two
;
long
long
genomeSize
=
_context
->
getGenomeFile
()
->
getGenomeSize
();
if
(
_haveExclude
){
genomeSize
-=
exclude
->
getTotalFlattenedLength
();
}
// bases covered by neither a nor b
long
long
n11
=
genomeSize
-
_queryLen
-
_dbLen
+
_intersectionVal
;
// bases covered only by -b
long
long
n12
=
_dbLen
-
_intersectionVal
;
// bases covered only by -a
long
long
n21
=
_queryLen
-
_intersectionVal
;
// bases covered by both
long
long
n22
=
_intersectionVal
;
long
long
n22
=
genomeSize
-
_queryLen
-
_dbLen
+
_intersectionVal
;
// bases covered only by -a
long
long
n21
=
_dbLen
-
_intersectionVal
;
// bases covered only by -b
long
long
n12
=
_queryLen
-
_intersectionVal
;
// bases covered by neither a nor b
long
long
n11
=
_intersectionVal
;
printf
(
"#_________________________________________
\n
"
);
printf
(
"# | %-12s | %-12s |
\n
"
,
"
not
in -b"
,
"in -b"
);
printf
(
"#
not
in -a | %-12lld | %-12lld |
\n
"
,
n11
,
n12
);
printf
(
"#
in -a | %-12lld | %-12lld |
\n
"
,
n21
,
n22
);
printf
(
"# | %-12s | %-12s |
\n
"
,
" in -b"
,
"
not
in -b"
);
printf
(
"#
in -a | %-12lld | %-12lld |
\n
"
,
n11
,
n12
);
printf
(
"#
not
in -a | %-12lld | %-12lld |
\n
"
,
n21
,
n22
);
printf
(
"#_________________________________________
\n
"
);
kt_fisher_exact
(
n11
,
n12
,
n21
,
n22
,
&
left
,
&
right
,
&
two
);
...
...
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