tsv-pretty auto preamble#218
Merged
jondegenhardt merged 4 commits intoAug 18, 2019
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #218 +/- ##
=======================================
Coverage 99.21% 99.21%
=======================================
Files 16 16
Lines 4957 4972 +15
=======================================
+ Hits 4918 4933 +15
Misses 39 39
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the an option to tsv-pretty to auto-detect preamble lines. The option is
--a|auto-preamble. The short form of the option--preamble NUMoption was changed from 'a' to 'b'.Auto-detection of preamble lines uses a very simple heuristic: Lines at the start of a file that do not contain field delimiters are considered part of the preamble. This works well when the field delimiter is TAB (default for TSV), and the file has two or more fields.
Without preamble support the initial lines are typically interpreted as a single field, interfering with header detection and correct field type and width interpretation. For example:
sample.tsvhas three preamble lines, two starting with '#' and one blank line. Turning preamble detection on corrects the output:This preamble behavior could have been done before by using the
--preamble NUMoption. In the above example,--preamble 3. Having auto-preamble detection avoids needing to know the number of lines.