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

fastq de-aligned #325

Closed
Koeng101 opened this issue Aug 7, 2023 · 2 comments
Closed

fastq de-aligned #325

Koeng101 opened this issue Aug 7, 2023 · 2 comments

Comments

@Koeng101
Copy link
Contributor

Koeng101 commented Aug 7, 2023

https://github.com/TimothyStiles/poly/blob/f587e72731bdfebe2e452604707a4efe8906672a/io/fastq/fastq.go#L120C38-L120C38

Still figuring it out, but noting here: fastq becomes unaligned while reading. Not sure. This causes the entire thing to get messed up.

@Koeng101
Copy link
Contributor Author

Koeng101 commented Aug 8, 2023

Found it - https://github.com/TimothyStiles/poly/blob/f587e72731bdfebe2e452604707a4efe8906672a/io/fastq/fastq.go#L210

*(*string)(unsafe.Pointer(&sequence)), // Stdlib strings.Builder.String() does this so it should be safe.

This is NOT safe.

Koeng101 added a commit that referenced this issue Aug 8, 2023
TimothyStiles pushed a commit that referenced this issue Aug 13, 2023
@Koeng101
Copy link
Contributor Author

Alright, I got this error again.

If you redefine the sequence in terms of a new sequence, it is just fine.

sequence = line[:len(line)-1] // Exclude newline delimiter.
    var newSequence []byte
    for _, char := range sequence {
        newSequence = append(newSequence, char)
        if !strings.Contains("ATGCN", string(char)) {
            return Fastq{}, totalRead, errors.New("Only letters ATGCN are allowed for DNA/RNA in fastq file. Got letter: " + string(char))
        }
    }

I have no idea why, but this becomes a thing production. It takes a long ass time to find.

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

No branches or pull requests

1 participant