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
7ded18df
Commit
7ded18df
authored
14 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Fixed overlflow error in pairToPair
parent
f2209cfc
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/pairToPair/pairToPair.cpp
+30
-12
30 additions, 12 deletions
src/pairToPair/pairToPair.cpp
with
30 additions
and
12 deletions
src/pairToPair/pairToPair.cpp
+
30
−
12
View file @
7ded18df
...
...
@@ -72,10 +72,10 @@ void PairToPair::FindOverlaps(const BEDPE &a) {
vector
<
MATE
>
hitsA1B1
,
hitsA1B2
,
hitsA2B1
,
hitsA2B2
;
// add the appropriate slop to the starts and ends
CHRPOS
start1
=
a
.
start1
;
CHRPOS
end1
=
a
.
end1
;
CHRPOS
start2
=
a
.
start2
;
CHRPOS
end2
=
a
.
end2
;
int
start1
=
a
.
start1
;
int
end1
=
a
.
end1
;
int
start2
=
a
.
start2
;
int
end2
=
a
.
end2
;
if
(
_strandedSlop
==
true
)
{
if
(
a
.
strand1
==
"+"
)
...
...
@@ -88,8 +88,8 @@ void PairToPair::FindOverlaps(const BEDPE &a) {
start2
-=
_slop
;
}
else
{
start1
-=
_slop
;
start2
-=
_slop
;
(
start1
-=
_slop
)
>=
0
?
start1
-=
_slop
:
start1
=
0
;
(
start2
-=
_slop
)
>=
0
?
start2
-=
_slop
:
start2
=
0
;
end1
+=
_slop
;
end2
+=
_slop
;
}
...
...
@@ -103,16 +103,29 @@ void PairToPair::FindOverlaps(const BEDPE &a) {
unsigned
int
matchCount1
=
(
hitsA1B1
.
size
()
+
hitsA2B2
.
size
());
unsigned
int
matchCount2
=
(
hitsA2B1
.
size
()
+
hitsA1B2
.
size
());
// report the fact that no hits were found iff _searchType is neither.
if
((
matchCount1
==
0
)
&&
(
matchCount2
==
0
)
&&
(
_searchType
==
"neither"
))
{
_bedA
->
reportBedPENewLine
(
a
);
}
else
if
(
_searchType
==
"both"
)
{
else
if
(
_searchType
==
"both"
)
{
bool
found1
=
false
;
bool
found2
=
false
;
if
((
hitsA1B1
.
size
()
>
0
)
||
(
hitsA2B2
.
size
()
>
0
))
FindHitsOnBothEnds
(
a
,
hitsA1B1
,
hitsA2B2
);
found1
=
FindHitsOnBothEnds
(
a
,
hitsA1B1
,
hitsA2B2
);
if
((
hitsA2B1
.
size
()
>
0
)
||
(
hitsA1B2
.
size
()
>
0
))
FindHitsOnBothEnds
(
a
,
hitsA2B1
,
hitsA1B2
);
found2
=
FindHitsOnBothEnds
(
a
,
hitsA2B1
,
hitsA1B2
);
}
else
if
(
_searchType
==
"notboth"
)
{
bool
found1
=
false
;
bool
found2
=
false
;
if
((
hitsA1B1
.
size
()
>
0
)
||
(
hitsA2B2
.
size
()
>
0
))
found1
=
FindHitsOnBothEnds
(
a
,
hitsA1B1
,
hitsA2B2
);
if
((
hitsA2B1
.
size
()
>
0
)
||
(
hitsA1B2
.
size
()
>
0
))
found2
=
FindHitsOnBothEnds
(
a
,
hitsA2B1
,
hitsA1B2
);
if
(
!
found1
&&
!
found2
)
_bedA
->
reportBedPENewLine
(
a
);
}
else
if
(
_searchType
==
"either"
)
{
FindHitsOnEitherEnd
(
a
,
hitsA1B1
,
hitsA2B2
);
...
...
@@ -121,7 +134,7 @@ void PairToPair::FindOverlaps(const BEDPE &a) {
}
void
PairToPair
::
FindHitsOnBothEnds
(
const
BEDPE
&
a
,
const
vector
<
MATE
>
&
qualityHitsEnd1
,
bool
PairToPair
::
FindHitsOnBothEnds
(
const
BEDPE
&
a
,
const
vector
<
MATE
>
&
qualityHitsEnd1
,
const
vector
<
MATE
>
&
qualityHitsEnd2
)
{
map
<
unsigned
int
,
vector
<
MATE
>
,
less
<
int
>
>
hitsMap
;
...
...
@@ -133,9 +146,13 @@ void PairToPair::FindHitsOnBothEnds(const BEDPE &a, const vector<MATE> &qualityH
hitsMap
[
h
->
lineNum
].
push_back
(
*
h
);
}
bool
bothFound
=
false
;
for
(
map
<
unsigned
int
,
vector
<
MATE
>
,
less
<
unsigned
int
>
>::
iterator
m
=
hitsMap
.
begin
();
m
!=
hitsMap
.
end
();
++
m
)
{
// hits on both sides
if
(
m
->
second
.
size
()
==
2
)
{
bothFound
=
true
;
MATE
b1
=
m
->
second
[
0
];
MATE
b2
=
m
->
second
[
1
];
...
...
@@ -151,6 +168,7 @@ void PairToPair::FindHitsOnBothEnds(const BEDPE &a, const vector<MATE> &qualityH
}
}
}
return
bothFound
;
}
...
...
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