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
f1ce5e41
Commit
f1ce5e41
authored
12 years ago
by
Brent Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
let groupby handle a header line (starting with "#") as do other
bedtools subcommands.
parent
1b4ecc01
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/groupBy/groupBy.cpp
+1
-1
1 addition, 1 deletion
src/groupBy/groupBy.cpp
test/groupBy/test-groupby.sh
+15
-1
15 additions, 1 deletion
test/groupBy/test-groupby.sh
test/groupBy/values3.header.bed
+13
-0
13 additions, 0 deletions
test/groupBy/values3.header.bed
with
29 additions
and
2 deletions
src/groupBy/groupBy.cpp
+
1
−
1
View file @
f1ce5e41
...
@@ -323,7 +323,7 @@ void GroupBy (const string &inFile,
...
@@ -323,7 +323,7 @@ void GroupBy (const string &inFile,
TabFile
*
_tab
=
new
TabFile
(
inFile
);
TabFile
*
_tab
=
new
TabFile
(
inFile
);
_tab
->
Open
();
_tab
->
Open
();
while
((
tabLineStatus
=
_tab
->
GetNextTabLine
(
inFields
,
lineNum
))
!=
TAB_INVALID
)
{
while
((
tabLineStatus
=
_tab
->
GetNextTabLine
(
inFields
,
lineNum
))
!=
TAB_INVALID
)
{
if
(
tabLineStatus
==
TAB_VALID
)
{
if
(
(
tabLineStatus
==
TAB_VALID
)
||
(
tabLineStatus
==
TAB_HEADER
))
{
if
(
first_line
)
{
if
(
first_line
)
{
first_line
=
false
;
first_line
=
false
;
...
...
This diff is collapsed.
Click to expand it.
test/groupBy/test-groupby.sh
+
15
−
1
View file @
f1ce5e41
...
@@ -5,10 +5,24 @@ lines_d=$(../../bin/groupBy -g 1-2,3 -o collapse -c 4 -i ../map/values3.bed | wc
...
@@ -5,10 +5,24 @@ lines_d=$(../../bin/groupBy -g 1-2,3 -o collapse -c 4 -i ../map/values3.bed | wc
check
(){
check
(){
if
[
"
$1
"
!=
"
$2
"
]
;
then
if
[
"
$1
"
!=
"
$2
"
]
;
then
"fail groupby"
echo
"fail groupby"
$1
$2
fi
fi
}
}
check
$lines_a
$lines_b
check
$lines_a
$lines_b
check
$lines_a
$lines_c
check
$lines_a
$lines_c
check
$lines_a
$lines_d
check
$lines_a
$lines_d
H
=
$(
head
-n
1 values3.header.bed
)
A
=
$(
../../bin/bedtools groupby
-i
values3.header.bed
-g
1,2,3
-c
4
-o
concat
-inheader
|
head
-n
1
)
if
[
"
$A
"
!=
$'chr1
\t
0
\t
10
\t
a1'
]
;
then
echo
"fail groupby"
fi
B
=
$(
../../bin/bedtools groupby
-i
values3.header.bed
-g
1,2,3
-c
4
-o
concat
-header
|
head
-n
1
)
if
[
"
$B
"
!=
$'#chrom
\t
start
\t
end
\t
concat(A)'
]
;
then
echo
"fail groupby"
fi
This diff is collapsed.
Click to expand it.
test/groupBy/values3.header.bed
0 → 100644
+
13
−
0
View file @
f1ce5e41
#chrom start end A B C
chr1 0 10 a1 10 +
chr1 10 20 a2 5 +
chr1 11 21 a3 5 +
chr1 20 30 a4 15 +
chr1 20 30 a5 15 +
chr1 20 30 a6 15 +
chr1 120 130 a7 1 +
chr3 0 10 a8 1 +
chr3 10 20 a9 2 +
chr3 20 30 a10 3 +
chr3 120 130 a11 4 +
chr3 120 130 a12 4 +
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