Skip to content

- Clarify where some examples are, and fix the documentation of these…#1522

Merged
tfenne merged 4 commits into
masterfrom
yf_improve_readme_and_update_example
Jul 13, 2026
Merged

- Clarify where some examples are, and fix the documentation of these…#1522
tfenne merged 4 commits into
masterfrom
yf_improve_readme_and_update_example

Conversation

@yfarjoun

@yfarjoun yfarjoun commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

… examples to more accurately show where the jar will be after compiling.

Summary by CodeRabbit

  • Documentation
    • Added a Getting Started section with links to examples for printing reads, printing variants, and counting records.
    • Updated example invocation commands and paths to match the current build layout.
    • Clarified counting records guidance for BED inputs and adjusted related wording (including usage text).
    • Removed outdated guidance about CRAM package stability.
  • Bug Fixes
    • Improved example resource handling by ensuring readers and writers are closed automatically.

@yfarjoun
yfarjoun requested a review from lbergelson December 17, 2020 20:18
@codecov-io

codecov-io commented Dec 18, 2020

Copy link
Copy Markdown

Codecov Report

Merging #1522 (de57d11) into master (2c4c9b2) will increase coverage by 0.000%.
The diff coverage is 7.407%.

@@             Coverage Diff             @@
##              master     #1522   +/-   ##
===========================================
  Coverage     69.404%   69.405%           
- Complexity      8920      8924    +4     
===========================================
  Files            601       602    +1     
  Lines          35515     35522    +7     
  Branches        5904      5907    +3     
===========================================
+ Hits           24649     24654    +5     
- Misses          8532      8535    +3     
+ Partials        2334      2333    -1     
Impacted Files Coverage Δ Complexity Δ
.../java/htsjdk/samtools/example/ExampleSamUsage.java 0.000% <0.000%> (ø) 0.000 <0.000> (ø)
...ava/htsjdk/samtools/example/PrintReadsExample.java 0.000% <0.000%> (ø) 0.000 <0.000> (ø)
...main/java/htsjdk/tribble/example/CountRecords.java 0.000% <0.000%> (ø) 0.000 <0.000> (ø)
...a/htsjdk/variant/example/PrintVariantsExample.java 77.419% <50.000%> (ø) 5.000 <0.000> (ø)
...c/main/java/htsjdk/variant/utils/GeneralUtils.java 53.623% <100.000%> (ø) 19.000 <7.000> (ø)
...main/java/htsjdk/samtools/filter/InvertFilter.java 80.000% <0.000%> (ø) 3.000% <0.000%> (?%)
...dk/samtools/util/SAMRecordPrefetchingIterator.java 76.000% <0.000%> (+1.333%) 14.000% <0.000%> (+1.000%)

@lbergelson lbergelson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment. Thanks for adding this.

Comment thread README.md



### Getting Started

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great. We should have had this forever.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we make these links to the source files?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We probably want to do a sweep and update the examples to use Path/other new conventions. Pointing them out is a good start though.

Comment thread README.md
* Provide explanations for the rare cases when functionality is deprecated or removed without replacement.

We treat any accessible class/method/field as part of our API and attempt to minimize changes to it with the following exceptions:
* The `htsjdk.samtools.cram` package and subpackages are considered unstable and are undergoing major changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, yeah. We should probably remove that now.

* It's also useful for measuring time.
* An example invocation is:
* <code>java -cp dist/htsjdk-2.1.1.jar htsjdk.samtools.example.PrintReadsExample in.bam false a.bam</code>
* <code>java -cp build/lib/htsjdk-< VERSION >.jar htsjdk.samtools.example.PrintReadsExample src/test/resources/htsjdk/samtools/example.bam false /dev/stdout </code>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, hey, actually fixing the examples to work is a good idea...

@yfarjoun

yfarjoun commented Jan 4, 2021

Copy link
Copy Markdown
Contributor Author

back to you @lbergelson

@codecov-commenter

codecov-commenter commented May 15, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 7.40741% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.405%. Comparing base (2c4c9b2) to head (de57d11).
⚠️ Report is 133 commits behind head on master.

Files with missing lines Patch % Lines
.../java/htsjdk/samtools/example/ExampleSamUsage.java 0.000% 18 Missing ⚠️
...ava/htsjdk/samtools/example/PrintReadsExample.java 0.000% 4 Missing ⚠️
...main/java/htsjdk/tribble/example/CountRecords.java 0.000% 2 Missing ⚠️
...a/htsjdk/variant/example/PrintVariantsExample.java 50.000% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##              master     #1522   +/-   ##
===========================================
  Coverage     69.404%   69.405%           
- Complexity      8920      8924    +4     
===========================================
  Files            601       602    +1     
  Lines          35515     35522    +7     
  Branches        5904      5907    +3     
===========================================
+ Hits           24649     24654    +5     
- Misses          8532      8535    +3     
+ Partials        2334      2333    -1     
Files with missing lines Coverage Δ
...c/main/java/htsjdk/variant/utils/GeneralUtils.java 53.623% <100.000%> (ø)
...a/htsjdk/variant/example/PrintVariantsExample.java 77.419% <50.000%> (ø)
...main/java/htsjdk/tribble/example/CountRecords.java 0.000% <0.000%> (ø)
...ava/htsjdk/samtools/example/PrintReadsExample.java 0.000% <0.000%> (ø)
.../java/htsjdk/samtools/example/ExampleSamUsage.java 0.000% <0.000%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tfenne tfenne added the chore label Jul 13, 2026
Yossi Farjoun added 3 commits July 13, 2026 17:08
@tfenne
tfenne force-pushed the yf_improve_readme_and_update_example branch from de57d11 to 479a356 Compare July 13, 2026 23:18
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fb4e6f49-3475-473c-ba71-f0d436c06907

📥 Commits

Reviewing files that changed from the base of the PR and between 479a356 and c6c293e.

📒 Files selected for processing (5)
  • README.md
  • src/main/java/htsjdk/samtools/example/ExampleSamUsage.java
  • src/main/java/htsjdk/samtools/example/PrintReadsExample.java
  • src/main/java/htsjdk/tribble/example/CountRecords.java
  • src/main/java/htsjdk/variant/example/PrintVariantsExample.java
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/main/java/htsjdk/samtools/example/PrintReadsExample.java
  • src/main/java/htsjdk/variant/example/PrintVariantsExample.java
  • README.md
  • src/main/java/htsjdk/tribble/example/CountRecords.java
  • src/main/java/htsjdk/samtools/example/ExampleSamUsage.java

📝 Walkthrough

Walkthrough

Example resource handling now uses try-with-resources. README guidance and example commands are updated, and CountRecords documentation now focuses on BED inputs.

Changes

Examples and documentation

Layer / File(s) Summary
Example resource lifecycle
src/main/java/htsjdk/samtools/example/ExampleSamUsage.java
SamReader and SAMFileWriter instances are managed automatically, and openSamExamples now declares IOException.
Example commands and getting started
README.md, src/main/java/htsjdk/samtools/example/PrintReadsExample.java, src/main/java/htsjdk/variant/example/PrintVariantsExample.java
README links, API-stability guidance, classpaths, and sample invocation arguments are updated.
BED counting documentation
src/main/java/htsjdk/tribble/example/CountRecords.java
Documentation and usage text describe BED indexing and counting examples; one whitespace-only change is included.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the docs and example-location changes, but it is too vague and truncated to clearly summarize the PR. Use a specific title like "Update example documentation and JAR paths" to describe the main change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yf_improve_readme_and_update_example

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 132-133: Update the “Getting Started” introduction in README.md
from “Please see example as follows:” to the clearer plural wording “The
following examples show how to get started:”.

In `@src/main/java/htsjdk/samtools/example/PrintReadsExample.java`:
- Line 40: Update the documented JAR classpath from build/lib to build/libs in
the PrintReadsExample command at
src/main/java/htsjdk/samtools/example/PrintReadsExample.java:40 and the
PrintVariantsExample command at
src/main/java/htsjdk/variant/example/PrintVariantsExample.java:47, keeping both
examples consistent with the Gradle output directory.
- Line 40: Update the PrintReadsExample command documentation to use the
portable output filename out.bam instead of /dev/stdout, keeping the example
runnable on Windows and other platforms.

In `@src/main/java/htsjdk/tribble/example/CountRecords.java`:
- Line 131: Update the BED usage text in CountRecords to read “BED (ends in .bed
or .BED)”, removing the duplicated suffix and adding the missing closing
parenthesis to match getFeatureCodec.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f3a3943-156d-4306-a4b1-f63793b4f76c

📥 Commits

Reviewing files that changed from the base of the PR and between 6a3fcd3 and 479a356.

📒 Files selected for processing (5)
  • README.md
  • src/main/java/htsjdk/samtools/example/ExampleSamUsage.java
  • src/main/java/htsjdk/samtools/example/PrintReadsExample.java
  • src/main/java/htsjdk/tribble/example/CountRecords.java
  • src/main/java/htsjdk/variant/example/PrintVariantsExample.java

Comment thread README.md Outdated
* It's also useful for measuring time.
* An example invocation is:
* <code>java -cp dist/htsjdk-2.1.1.jar htsjdk.samtools.example.PrintReadsExample in.bam false a.bam</code>
* <code>java -cp build/lib/htsjdk-< VERSION >.jar htsjdk.samtools.example.PrintReadsExample src/test/resources/htsjdk/samtools/example.bam false /dev/stdout </code>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep both example classpaths consistent with the documented Gradle output.

Both commands use build/lib, while README.md Line [41] documents build/libs; users following either command will not find the generated JAR.

  • src/main/java/htsjdk/samtools/example/PrintReadsExample.java#L40-L40: change build/lib to build/libs.
  • src/main/java/htsjdk/variant/example/PrintVariantsExample.java#L47-L47: change build/lib to build/libs.
📍 Affects 2 files
  • src/main/java/htsjdk/samtools/example/PrintReadsExample.java#L40-L40 (this comment)
  • src/main/java/htsjdk/variant/example/PrintVariantsExample.java#L47-L47
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/htsjdk/samtools/example/PrintReadsExample.java` at line 40,
Update the documented JAR classpath from build/lib to build/libs in the
PrintReadsExample command at
src/main/java/htsjdk/samtools/example/PrintReadsExample.java:40 and the
PrintVariantsExample command at
src/main/java/htsjdk/variant/example/PrintVariantsExample.java:47, keeping both
examples consistent with the Gradle output directory.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,120p' src/main/java/htsjdk/samtools/example/PrintReadsExample.java

Repository: samtools/htsjdk

Length of output: 4922


Use a portable output path in the example command. /dev/stdout makes this invocation Unix-only and breaks on Windows; use out.bam or label the example as Unix-specific.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/htsjdk/samtools/example/PrintReadsExample.java` at line 40,
Update the PrintReadsExample command documentation to use the portable output
filename out.bam instead of /dev/stdout, keeping the example runnable on Windows
and other platforms.

Comment thread src/main/java/htsjdk/tribble/example/CountRecords.java Outdated
@tfenne
tfenne force-pushed the yf_improve_readme_and_update_example branch from 479a356 to c6c293e Compare July 13, 2026 23:28
@tfenne
tfenne merged commit 38ed515 into master Jul 13, 2026
5 checks passed
@tfenne
tfenne deleted the yf_improve_readme_and_update_example branch July 13, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants