Skip to content

Commit

Permalink
Updated fastq to solve #325 and #323 (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koeng101 committed Aug 13, 2023
1 parent f587e72 commit 7ca0dcb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions io/fastq/fastq.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"math"
"os"
"strings"
"unsafe"
)

/******************************************************************************
Expand Down Expand Up @@ -207,7 +206,7 @@ func (parser *Parser) ParseNext() (Fastq, int64, error) {
Identifier: seqIdentifier,
Optionals: optionals,
Quality: quality,
Sequence: *(*string)(unsafe.Pointer(&sequence)), // Stdlib strings.Builder.String() does this so it *should* be safe.
Sequence: string(sequence), // Stdlib strings.Builder.String() does this so it *should* be safe.
}
// Gotten to this point err is non-nil only in EOF case.
// We report this error to note the fastq may be incomplete/corrupt
Expand Down Expand Up @@ -264,6 +263,12 @@ func Build(fastqs []Fastq) ([]byte, error) {
for _, fastq := range fastqs {
fastqString.WriteString("@")
fastqString.WriteString(fastq.Identifier)
for key, val := range fastq.Optionals {
fastqString.WriteString(" ")
fastqString.WriteString(key)
fastqString.WriteString("=")
fastqString.WriteString(val)
}
fastqString.WriteString("\n")

// fastq doesn't limit at 80 characters, since it is
Expand Down

0 comments on commit 7ca0dcb

Please sign in to comment.