-
Notifications
You must be signed in to change notification settings - Fork 242
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
progress logger logs read name too #1180
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1180 +/- ##
===============================================
- Coverage 68.398% 68.398% -<.001%
- Complexity 8013 8015 +2
===============================================
Files 541 541
Lines 32688 32694 +6
Branches 5528 5529 +1
===============================================
+ Hits 22358 22362 +4
- Misses 8125 8128 +3
+ Partials 2205 2204 -1
|
2 similar comments
Codecov Report
@@ Coverage Diff @@
## master #1180 +/- ##
===============================================
- Coverage 68.398% 68.398% -<.001%
- Complexity 8013 8015 +2
===============================================
Files 541 541
Lines 32688 32694 +6
Branches 5528 5529 +1
===============================================
+ Hits 22358 22362 +4
- Misses 8125 8128 +3
+ Partials 2205 2204 -1
|
Codecov Report
@@ Coverage Diff @@
## master #1180 +/- ##
===============================================
- Coverage 68.398% 68.398% -<.001%
- Complexity 8013 8015 +2
===============================================
Files 541 541
Lines 32688 32694 +6
Branches 5528 5529 +1
===============================================
+ Hits 22358 22362 +4
- Misses 8125 8128 +3
+ Partials 2205 2204 -1
|
@@ -23,6 +23,7 @@ | |||
private long lastStartTime = -1; | |||
private String lastChrom = null; | |||
private int lastPos = 0; | |||
private String lastRN = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastReadName
rnInfo = ", last read name: " + lastRN; | ||
} else { | ||
rnInfo = ""; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting not consistent with the rest of the code
final long n = (this.processed % this.n == 0) ? this.n : this.processed % this.n; | ||
|
||
log(this.verb, " ", processed, " " + noun + ". Elapsed time: ", elapsed, "s. Time for last ", fmt.format(n), | ||
": ", period, "s. Last read position: ", readInfo); | ||
": ", period, "s. Last read position: ", readInfo, rnInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sometimes read names are really long, or we don't want them in the log, can we just turn this off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make a protected alternate constructor with the bool explicit and/or a setLogReadNames
method, but I'm trying not to mess with the ProgressLoggerInterface
so it'd only be available to subclasses of AbstractProgressLogger
.
IMO this should roll out by default and folks can turn it off if they specifically object. I'll let the hivemind chime in if there are objections to more-useful-by-default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps the logger can figure out if the records are sorted or not, and only emit readnames when they are not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't do that for chr/pos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will also vote for default to a switch for this feature, and default to off (to keep the previous behaviour).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@helgridly: I think that if you add the feature that the logger will output readname only after it notices that the records are not coordinate-sorted, this will be a good compromise between, providing information and terseness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
providing a switch would require adding yet another Default setting to HTSJDK which is gross.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot be done on construction?
Codecov Report
@@ Coverage Diff @@
## master #1180 +/- ##
===============================================
- Coverage 68.398% 68.398% -<.001%
- Complexity 8013 8015 +2
===============================================
Files 541 541
Lines 32688 32694 +6
Branches 5528 5529 +1
===============================================
+ Hits 22358 22362 +4
- Misses 8125 8128 +3
+ Partials 2205 2204 -1
|
@@ -60,10 +61,18 @@ private synchronized void record() { | |||
if (this.lastChrom == null) readInfo = "*/*"; | |||
else readInfo = this.lastChrom + ":" + fmt.format(this.lastPos); | |||
|
|||
final String rnInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use readName
instead of rn
here? That would match what the rest of the code here does. Also, I believe that abbreviations like this make the code harder to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -60,10 +61,18 @@ private synchronized void record() { | |||
if (this.lastChrom == null) readInfo = "*/*"; | |||
else readInfo = this.lastChrom + ":" + fmt.format(this.lastPos); | |||
|
|||
final String rnInfo; | |||
if(lastReadName != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the previous comments about formatting, I think we should be pushing the code to a consistent style based on the Sun/Oracle java style guidelines. Reformatting non-conforming code (such as the if
on line 61) is preferable to committing new code that doesn't conform.
So here you'd add a space after if
and delete the newline before else
. IMO this is also an OK place to use a ternary op, but that's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
@@ -80,10 +89,10 @@ public synchronized boolean log() { | |||
} | |||
} | |||
|
|||
@Override | |||
public synchronized boolean record(final String chrom, final int pos) { | |||
protected synchronized boolean record(final String chrom, final int pos, final String rname) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not making this public API also in the ProgressLoggerInterface
? Instead of read name, it can also log record names (might be useful for some other data sources). For the interface, you can use a default value not to break compatibility with other implementations...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is clearly scope-creep. I would hold-off on requesting that from the OP
@@ -60,10 +61,18 @@ private synchronized void record() { | |||
if (this.lastChrom == null) readInfo = "*/*"; | |||
else readInfo = this.lastChrom + ":" + fmt.format(this.lastPos); | |||
|
|||
final String rnInfo; | |||
if(lastReadName != null) { | |||
rnInfo = ". Last read name: " + lastReadName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like this to say "record" instead of "read", to be able to log non-reads record names.
final long n = (this.processed % this.n == 0) ? this.n : this.processed % this.n; | ||
|
||
log(this.verb, " ", processed, " " + noun + ". Elapsed time: ", elapsed, "s. Time for last ", fmt.format(n), | ||
": ", period, "s. Last read position: ", readInfo); | ||
": ", period, "s. Last read position: ", readInfo, rnInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will also vote for default to a switch for this feature, and default to off (to keep the previous behaviour).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea of detecting if it's ordered by position and outputting read names only iff it's not seems reasonable. I've added my own helpful nitpicking formatting suggestion as well.
@@ -60,10 +61,18 @@ private synchronized void record() { | |||
if (this.lastChrom == null) readInfo = "*/*"; | |||
else readInfo = this.lastChrom + ":" + fmt.format(this.lastPos); | |||
|
|||
final String rnInfo; | |||
if(lastReadName != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nitpicky, but I'd probably make this block into a one liner since it's really just an assignment.
final String readNameInfo = lastReadName == null ? "" : ". Last read name: " + lastReadName;
Description
Running Picard SortSam to sort with queryname gave me output during that didn't tell me much about how done I was.
Checklist