Skip to content

Commit 8d787ad

Browse files
committed
Changed SAMRecord.toString() to emit the SAM format string with all fields.
1 parent 8f5fe60 commit 8d787ad

1 file changed

Lines changed: 2 additions & 24 deletions

File tree

src/main/java/htsjdk/samtools/SAMRecord.java

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,32 +2368,10 @@ public SAMRecord deepCopy() {
23682368
return newSAM;
23692369
}
23702370

2371-
/** Simple toString() that gives a little bit of useful info about the read. */
2371+
/** Returns this record formatted as it would appear in a SAM file. */
23722372
@Override
23732373
public String toString() {
2374-
final StringBuilder builder = new StringBuilder(64);
2375-
builder.append(getReadName());
2376-
if (getReadPairedFlag()) {
2377-
if (getFirstOfPairFlag()) {
2378-
builder.append(" 1/2");
2379-
}
2380-
else {
2381-
builder.append(" 2/2");
2382-
}
2383-
}
2384-
2385-
builder.append(' ')
2386-
.append(String.valueOf(getReadLength()))
2387-
.append('b');
2388-
2389-
if (getReadUnmappedFlag()) {
2390-
builder.append(" unmapped read.");
2391-
}
2392-
else {
2393-
builder.append(String.format(" aligned to %s:%d-%d.", getContig(), getAlignmentStart(), getAlignmentEnd()));
2394-
}
2395-
2396-
return builder.toString();
2374+
return getSAMString();
23972375
}
23982376

23992377
/**

0 commit comments

Comments
 (0)