Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
R3
legacy
bedtools2
Commits
16aa8fb8
Commit
16aa8fb8
authored
Apr 23, 2015
by
Neil Kindlon
Browse files
Merge branch 'master' of
https://github.com/nkindlon/bedtools2
parents
567477f3
3c14db01
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/closestFile/closestMain.cpp
View file @
16aa8fb8
...
...
@@ -114,6 +114,11 @@ void closest_help(void) {
cerr
<<
"
\t
-header
\t
"
<<
"Print the header from the A file prior to results."
<<
endl
<<
endl
;
cerr
<<
"
\t
-nonamecheck
\t
"
<<
"For sorted data, don't throw an error if the file has different naming conventions"
<<
endl
;
cerr
<<
"
\t\t\t
for the same chromosome. ex.
\"
chr1
\"
vs
\"
chr01
\"
."
<<
endl
<<
endl
;
cerr
<<
"Notes: "
<<
endl
;
cerr
<<
"
\t
Reports
\"
none
\"
for chrom and
\"
-1
\"
for all other fields when a feature"
<<
endl
;
cerr
<<
"
\t
is not found in B on the same chromosome as the feature in A."
<<
endl
;
...
...
src/jaccard/jaccardMain.cpp
View file @
16aa8fb8
...
...
@@ -73,6 +73,11 @@ void jaccard_help(void) {
cerr
<<
"
\t\t
"
<<
"the forward or reverse strand, respectively."
<<
endl
;
cerr
<<
"
\t\t
"
<<
"- By default, merging is done without respect to strand."
<<
endl
<<
endl
;
cerr
<<
"
\t
-nonamecheck
\t
"
<<
"For sorted data, don't throw an error if the file has different naming conventions"
<<
endl
;
cerr
<<
"
\t\t\t
for the same chromosome. ex.
\"
chr1
\"
vs
\"
chr01
\"
."
<<
endl
<<
endl
;
cerr
<<
"Notes: "
<<
endl
;
cerr
<<
"
\t
(1) Input files must be sorted by chrom, then start position."
<<
endl
<<
endl
;
...
...
src/mapFile/mapMain.cpp
View file @
16aa8fb8
...
...
@@ -84,6 +84,10 @@ void map_help(void) {
cerr
<<
"
\t
-prec
\t
"
<<
"Sets the decimal precision for output (Default: 5)"
<<
endl
<<
endl
;
cerr
<<
"
\t
-nonamecheck
\t
"
<<
"For sorted data, don't throw an error if the file has different naming conventions"
<<
endl
;
cerr
<<
"
\t\t\t
for the same chromosome. ex.
\"
chr1
\"
vs
\"
chr01
\"
."
<<
endl
<<
endl
;
cerr
<<
"Notes: "
<<
endl
;
cerr
<<
"
\t
(1) Both input files must be sorted by chrom, then start."
<<
endl
<<
endl
;
...
...
src/utils/Contexts/ContextBase.cpp
View file @
16aa8fb8
...
...
@@ -60,7 +60,8 @@ ContextBase::ContextBase()
_useMergedIntervals
(
false
),
_reportPrecision
(
-
1
),
_allFilesHaveChrInChromNames
(
UNTESTED
),
_allFileHaveLeadingZeroInChromNames
(
UNTESTED
)
_allFileHaveLeadingZeroInChromNames
(
UNTESTED
),
_nameConventionWarningTripped
(
false
)
{
_programNames
[
"intersect"
]
=
INTERSECT
;
...
...
@@ -92,6 +93,12 @@ ContextBase::~ContextBase()
_keyListOps
=
NULL
;
}
// if there was a warning about file name conventions,
// print it again so it's not lost amid large output.
if
(
_nameConventionWarningTripped
)
{
cerr
<<
_nameConventionWarningMsg
<<
endl
;
}
}
bool
ContextBase
::
determineOutputType
()
{
...
...
@@ -626,7 +633,7 @@ bool ContextBase::parseIoBufSize(QuickString bufStr)
}
void
ContextBase
::
testNameConventions
(
const
Record
*
record
)
{
if
(
getNameCheckDisabled
())
return
;
if
(
getNameCheckDisabled
()
||
_nameConventionWarningTripped
)
return
;
int
fileIdx
=
record
->
getFileIdx
();
...
...
@@ -639,15 +646,12 @@ void ContextBase::testNameConventions(const Record *record) {
if
(
testChrVal
==
UNTESTED
)
{
_fileHasChrInChromNames
[
fileIdx
]
=
hasChr
?
YES
:
NO
;
}
else
if
((
testChrVal
==
YES
&&
!
hasChr
)
||
(
testChrVal
==
NO
&&
hasChr
))
{
fprintf
(
stderr
,
"ERROR: File %s has inconsistent naming convention for record:
\n
"
,
_fileNames
[
fileIdx
].
c_str
());
record
->
print
(
stderr
,
true
);
exit
(
1
);
}
// else if ((testChrVal == YES && !hasChr) || (testChrVal == NO && hasChr)) {
// nameConventionWarning(record, _fileNames[fileIdx], " has inconsistent naming convention for record:\n");
// }
if
((
_allFilesHaveChrInChromNames
==
YES
&&
!
hasChr
)
||
(
_allFilesHaveChrInChromNames
==
NO
&&
hasChr
))
{
fprintf
(
stderr
,
"ERROR: File %s has a record where naming convention is inconsistent with other files:
\n
"
,
_fileNames
[
fileIdx
].
c_str
());
record
->
print
(
stderr
,
true
);
exit
(
1
);
nameConventionWarning
(
record
,
_fileNames
[
fileIdx
],
" has a record where naming convention is inconsistent with other files:
\n
"
);
}
if
(
_allFilesHaveChrInChromNames
==
UNTESTED
)
{
...
...
@@ -664,15 +668,12 @@ void ContextBase::testNameConventions(const Record *record) {
testChrVal
=
fileHasLeadingZeroInChromNames
(
fileIdx
);
if
(
testChrVal
==
UNTESTED
)
{
_fileHasLeadingZeroInChromNames
[
fileIdx
]
=
zeroVal
?
YES
:
NO
;
}
else
if
((
testChrVal
==
YES
&&
!
zeroVal
)
||
(
testChrVal
==
NO
&&
zeroVal
))
{
fprintf
(
stderr
,
"ERROR: File %s has inconsistent naming convention (leading zero) for record:
\n
"
,
_fileNames
[
fileIdx
].
c_str
());
record
->
print
(
stderr
,
true
);
exit
(
1
);
}
// else if ((testChrVal == YES && !zeroVal) || (testChrVal == NO && zeroVal)) {
// nameConventionWarning(record, _fileNames[fileIdx], " has inconsistent naming convention (leading zero) for record:\n");
// }
if
((
_allFileHaveLeadingZeroInChromNames
==
YES
&&
!
zeroVal
)
||
(
_allFileHaveLeadingZeroInChromNames
==
NO
&&
zeroVal
))
{
fprintf
(
stderr
,
"ERROR: File %s has a record where naming convention (leading zero) is inconsistent with other files:
\n
"
,
_fileNames
[
fileIdx
].
c_str
());
record
->
print
(
stderr
,
true
);
exit
(
1
);
nameConventionWarning
(
record
,
_fileNames
[
fileIdx
],
" has a record where naming convention (leading zero) is inconsistent with other files:
\n
"
);
}
if
(
_allFileHaveLeadingZeroInChromNames
==
UNTESTED
)
{
...
...
@@ -696,3 +697,15 @@ ContextBase::testType ContextBase::fileHasLeadingZeroInChromNames(int fileIdx) {
return
iter
->
second
;
}
void
ContextBase
::
nameConventionWarning
(
const
Record
*
record
,
const
QuickString
&
filename
,
const
QuickString
&
message
)
{
_nameConventionWarningMsg
=
"***** WARNING: File "
;
_nameConventionWarningMsg
.
append
(
filename
);
_nameConventionWarningMsg
.
append
(
message
);
record
->
print
(
_nameConventionWarningMsg
);
_nameConventionWarningMsg
.
append
(
"
\n
"
);
_nameConventionWarningTripped
=
true
;
cerr
<<
_nameConventionWarningMsg
<<
endl
;
}
src/utils/Contexts/ContextBase.h
View file @
16aa8fb8
...
...
@@ -277,6 +277,12 @@ protected:
testType
_allFilesHaveChrInChromNames
;
testType
_allFileHaveLeadingZeroInChromNames
;
//Warning messages.
bool
_nameConventionWarningTripped
;
QuickString
_nameConventionWarningMsg
;
void
nameConventionWarning
(
const
Record
*
record
,
const
QuickString
&
filename
,
const
QuickString
&
message
);
};
#endif
/* CONTEXTBASE_H_ */
src/utils/Contexts/ContextIntersect.cpp
View file @
16aa8fb8
...
...
@@ -168,10 +168,6 @@ bool ContextIntersect::isValidState()
if
(
_files
.
size
()
<
2
)
{
return
false
;
}
if
(
!
getSortedInput
()
&&
getNameCheckDisabled
())
{
_errorMsg
=
"
\n
***** ERROR: -nonamecheck option is only valid for sorted input. *****"
;
return
false
;
}
return
true
;
}
...
...
test/intersect/sortAndNaming/test-sort-and-naming.sh
View file @
16aa8fb8
...
...
@@ -74,9 +74,9 @@ rm obs
############################################################
echo
" intersect.t05...
\c
"
echo
\
"
ERROR
: File db1_noChr.bed has inconsistent naming convention for record:
"
***** WARNING
: File db1_noChr.bed has inconsistent naming convention for record:
2 50 80"
>
exp
$BT
intersect
-a
q1_num.bed
-b
db1_noChr.bed
-sorted
2>&1
>
/dev/null |
cat
-
>
obs
$BT
intersect
-a
q1_num.bed
-b
db1_noChr.bed
-sorted
2>&1
>
/dev/null |
cat
-
|
head
-2
>
obs
check obs exp
rm
obs
...
...
@@ -86,9 +86,9 @@ rm obs
############################################################
echo
" intersect.t06...
\c
"
echo
\
"
ERROR
: File db1_leadingZero.txt has a record where naming convention (leading zero) is inconsistent with other files:
"
***** WARNING
: File db1_leadingZero.txt has a record where naming convention (leading zero) is inconsistent with other files:
chr01 10 20"
>
exp
$BT
intersect
-a
q1_num.bed
-b
db1_leadingZero.txt
-sorted
2>&1
>
/dev/null |
cat
-
>
obs
$BT
intersect
-a
q1_num.bed
-b
db1_leadingZero.txt
-sorted
2>&1
>
/dev/null |
head
-
2
>
obs
check obs exp
rm
obs
...
...
test/intersect/test-intersect.sh
View file @
16aa8fb8
...
...
@@ -554,9 +554,9 @@ echo ok
##################################################################
echo
" intersect.t45...
\c
"
echo
\
"
ERROR
: File nonamecheck_b.bed has a record where naming convention (leading zero) is inconsistent with other files:
"
***** WARNING
: File nonamecheck_b.bed has a record where naming convention (leading zero) is inconsistent with other files:
chr01 15 25"
>
exp
$BT
intersect
-a
nonamecheck_a.bed
-b
nonamecheck_b.bed
-sorted
2>&1
>
/dev/null |
cat
-
>
obs
$BT
intersect
-a
nonamecheck_a.bed
-b
nonamecheck_b.bed
-sorted
2>&1
>
/dev/null |
cat
-
|
head
-2
>
obs
check exp obs
rm
exp obs
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment