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
5c3d96db
Commit
5c3d96db
authored
13 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Further nullBed tweaking.
parent
600a99ca
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/intersectBed/intersectBed.cpp
+1
-2
1 addition, 2 deletions
src/intersectBed/intersectBed.cpp
src/utils/bedFile/bedFile.h
+8
-5
8 additions, 5 deletions
src/utils/bedFile/bedFile.h
src/utils/chromsweep/chromsweep.cpp
+13
-15
13 additions, 15 deletions
src/utils/chromsweep/chromsweep.cpp
with
22 additions
and
22 deletions
src/intersectBed/intersectBed.cpp
+
1
−
2
View file @
5c3d96db
...
@@ -198,7 +198,7 @@ void BedIntersect::IntersectBed() {
...
@@ -198,7 +198,7 @@ void BedIntersect::IntersectBed() {
vector
<
BED
>
hits
;
vector
<
BED
>
hits
;
hits
.
reserve
(
100
);
hits
.
reserve
(
100
);
BED
a
,
nullBed
;
BED
a
;
// open the "A" file, process each BED entry and searh for overlaps.
// open the "A" file, process each BED entry and searh for overlaps.
_bedA
->
Open
();
_bedA
->
Open
();
...
@@ -226,7 +226,6 @@ void BedIntersect::IntersectBed() {
...
@@ -226,7 +226,6 @@ void BedIntersect::IntersectBed() {
}
}
}
}
}
}
a
=
nullBed
;
}
}
_bedA
->
Close
();
_bedA
->
Close
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/utils/bedFile/bedFile.h
+
8
−
5
View file @
5c3d96db
...
@@ -481,6 +481,7 @@ private:
...
@@ -481,6 +481,7 @@ private:
istream
*
_bedStream
;
istream
*
_bedStream
;
string
_bedLine
;
string
_bedLine
;
BED
_nullBed
;
string
_header
;
string
_header
;
bool
_firstLine
;
bool
_firstLine
;
vector
<
string
>
_bedFields
;
vector
<
string
>
_bedFields
;
...
@@ -509,14 +510,19 @@ private:
...
@@ -509,14 +510,19 @@ private:
*/
*/
template
<
typename
T
>
template
<
typename
T
>
inline
BedLineStatus
parseLine
(
T
&
bed
,
const
vector
<
string
>
&
lineVector
)
{
inline
BedLineStatus
parseLine
(
T
&
bed
,
const
vector
<
string
>
&
lineVector
)
{
// clear out the data from the last line.
bed
=
_nullBed
;
unsigned
int
numFields
=
lineVector
.
size
();
unsigned
int
numFields
=
lineVector
.
size
();
// bail out if we have a blank line
// bail out if we have a blank line
if
(
numFields
==
0
)
{
if
(
numFields
==
0
)
{
return
BED_BLANK
;
return
BED_BLANK
;
}
}
// bail out if we have a comment line
if
(
lineVector
[
0
].
find
(
"#"
)
==
0
)
{
return
BED_HEADER
;
}
if
(
numFields
>=
3
)
{
if
(
numFields
>=
3
)
{
// line parsing for all lines after the first non-header line
// line parsing for all lines after the first non-header line
...
@@ -623,7 +629,6 @@ private:
...
@@ -623,7 +629,6 @@ private:
bed
.
name
=
lineVector
[
3
];
bed
.
name
=
lineVector
[
3
];
bed
.
score
=
lineVector
[
4
];
bed
.
score
=
lineVector
[
4
];
bed
.
strand
=
lineVector
[
5
];
bed
.
strand
=
lineVector
[
5
];
bed
.
otherFields
.
clear
();
for
(
unsigned
int
i
=
6
;
i
<
lineVector
.
size
();
++
i
)
{
for
(
unsigned
int
i
=
6
;
i
<
lineVector
.
size
();
++
i
)
{
bed
.
otherFields
.
push_back
(
lineVector
[
i
]);
bed
.
otherFields
.
push_back
(
lineVector
[
i
]);
}
}
...
@@ -677,7 +682,6 @@ private:
...
@@ -677,7 +682,6 @@ private:
}
}
if
(
this
->
bedType
>
2
)
{
if
(
this
->
bedType
>
2
)
{
bed
.
otherFields
.
clear
();
for
(
unsigned
int
i
=
2
;
i
<
numFields
;
++
i
)
for
(
unsigned
int
i
=
2
;
i
<
numFields
;
++
i
)
bed
.
otherFields
.
push_back
(
lineVector
[
i
]);
bed
.
otherFields
.
push_back
(
lineVector
[
i
]);
}
}
...
@@ -717,7 +721,6 @@ private:
...
@@ -717,7 +721,6 @@ private:
template
<
typename
T
>
template
<
typename
T
>
inline
bool
parseGffLine
(
T
&
bed
,
const
vector
<
string
>
&
lineVector
,
int
lineNum
,
unsigned
int
numFields
)
{
inline
bool
parseGffLine
(
T
&
bed
,
const
vector
<
string
>
&
lineVector
,
int
lineNum
,
unsigned
int
numFields
)
{
if
(
numFields
==
this
->
bedType
)
{
if
(
numFields
==
this
->
bedType
)
{
bed
.
otherFields
.
clear
();
if
(
this
->
bedType
>=
8
&&
_isGff
)
{
if
(
this
->
bedType
>=
8
&&
_isGff
)
{
bed
.
chrom
=
lineVector
[
0
];
bed
.
chrom
=
lineVector
[
0
];
if
(
isInteger
(
lineVector
[
3
]))
if
(
isInteger
(
lineVector
[
3
]))
...
...
This diff is collapsed.
Click to expand it.
src/utils/chromsweep/chromsweep.cpp
+
13
−
15
View file @
5c3d96db
...
@@ -62,19 +62,17 @@ ChromSweep::~ChromSweep(void) {
...
@@ -62,19 +62,17 @@ ChromSweep::~ChromSweep(void) {
void
ChromSweep
::
ScanCache
()
{
void
ChromSweep
::
ScanCache
()
{
if
(
_query
->
_status
!=
BED_INVALID
)
{
vector
<
BED
>::
iterator
c
=
_cache
.
begin
();
vector
<
BED
>::
iterator
c
=
_cache
.
begin
();
while
(
c
!=
_cache
.
end
())
while
(
c
!=
_cache
.
end
())
{
{
if
((
_curr_qy
.
chrom
==
c
->
chrom
)
&&
!
(
after
(
_curr_qy
,
*
c
)))
{
if
((
_curr_qy
.
chrom
==
c
->
chrom
)
&&
!
(
after
(
_curr_qy
,
*
c
)))
{
if
(
IsValidHit
(
_curr_qy
,
*
c
))
{
if
(
IsValidHit
(
_curr_qy
,
*
c
))
{
_hits
.
push_back
(
*
c
);
_hits
.
push_back
(
*
c
);
}
++
c
;
}
else
{
c
=
_cache
.
erase
(
c
);
}
}
++
c
;
}
else
{
c
=
_cache
.
erase
(
c
);
}
}
}
}
}
}
...
@@ -156,7 +154,6 @@ bool ChromSweep::Next(pair<BED, vector<BED> > &next) {
...
@@ -156,7 +154,6 @@ bool ChromSweep::Next(pair<BED, vector<BED> > &next) {
_results
.
push
(
make_pair
(
_curr_qy
,
_hits
));
_results
.
push
(
make_pair
(
_curr_qy
,
_hits
));
// reset for the next query
// reset for the next query
_hits
.
clear
();
_hits
.
clear
();
_curr_qy
=
_nullBed
;
_query
->
GetNextBed
(
_curr_qy
,
true
);
_query
->
GetNextBed
(
_curr_qy
,
true
);
_curr_chrom
=
_curr_qy
.
chrom
;
_curr_chrom
=
_curr_qy
.
chrom
;
}
}
...
@@ -167,7 +164,8 @@ bool ChromSweep::Next(pair<BED, vector<BED> > &next) {
...
@@ -167,7 +164,8 @@ bool ChromSweep::Next(pair<BED, vector<BED> > &next) {
_results
.
pop
();
_results
.
pop
();
return
true
;
return
true
;
}
}
// otherwise, the party is over.
else
{
else
{
return
false
;}
return
false
;
}
}
}
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