Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend annot-tsv, adding several new options #1779

Merged
merged 3 commits into from
May 9, 2024

Conversation

pd3
Copy link
Member

@pd3 pd3 commented Apr 30, 2024

-d, --delim
.. add support for other delimiters, not just tab

-h, --headers
.. allow header lines in different formats. This is motivated
by the common use of files with the first row containing
column names but without the leading # character.

-I, --no-header-idx
.. suppress column index numbers in the printed header. When
given twice, drops the entire header

--help
.. changed from -h, --help to just --help. Note this option
was not advertised in the man page nor the usage page,
therefore it should be okay to reuse it for -h, --headers.

-d, --delim
    .. add support for other delimiters, not just tab

-h, --headers
    .. allow header lines in different formats. This is motivated
       by the common use of files with the first row containing
       column names but without the leading # character.

-I, --no-header-idx
    .. suppress column index numbers in the printed header. When
       given twice, drops the entire header

--help
    .. changed from `-h, --help` to just `--help`. Note this option
       was not advertised in the man page nor the usage page,
       therefore it should be okay to reuse it for `-h, --headers`.
}
// N<0 .. keep abs(N) comment lines in a sliding buffer
if ( dat->line.s[0]!='#' ) break; // data line
if ( nbuf == -nth_row )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a negative in the nth_row the first line of the actual data is missing in the output and memory is leaked from the strdup.

@whitwham
Copy link
Contributor

whitwham commented May 9, 2024

Thanks for the memory leak change but the negative header values are still not working.

So (from the tests):
annot-tsv -s src.11.txt -t dst.11.txt -c chr1,beg1,end1:chr,beg,end -f smpl1:src_smpl -h 2:2 -II

gives:

1 10 20 A A
1 30 40 A B
1 50 60 A .

Which is correct, but using the same files:
annot-tsv -s src.11.txt -t dst.11.txt -c chr1,beg1,end1:chr,beg,end -f smpl1:src_smpl -h 2:-1 -II

gives:

1 30 40 A B
1 50 60 A .

So unless I'm using it wrong the first line is going missing.

@pd3
Copy link
Member Author

pd3 commented May 9, 2024

Duh, it should work now, sorry

@whitwham whitwham merged commit b204d55 into samtools:develop May 9, 2024
9 checks passed
@pd3 pd3 deleted the annot-tsv-updates branch July 23, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants