bebop / poly

A Go package for engineering organisms.
https://pkg.go.dev/github.com/bebop/poly
MIT License
663 stars 70 forks source link

Add a newline normalizing wrapper for io.Readers #340

Open carreter opened 11 months ago

carreter commented 11 months ago

Will be useful for cross-platform support.

Blocked by #339

Koeng101 commented 11 months ago

Do you have any specific cases where this is useful? Is it like for, switching \r to \n?

carreter commented 11 months ago

Yes, \r and \r\n to \n.

Koeng101 commented 11 months ago

Have you found any bioinformatics files that have \r and are so problematic?

carreter commented 11 months ago

No, but I'm mostly thinking about making sure clients on MacOS, which IIRC we support, can parse files without worrying about normalizing the \r newlines to \n themselves.

Koeng101 commented 11 months ago

I see, so it would solve something like #301 . The thing I'm worried about is adding a whole generic intermediate to the parsers - I think it'd reduce readability. The tradeoffs might be worth it if we could support windows though (I use mac pretty often and haven't had this problem)

carreter commented 11 months ago

Hmm. I'm blanking on other ways to structure this that doesn't involve adding an intermediate. IMO we should wire this in in all the NewXXXParserWithMaxLine functions in bio/bio.go, this would minimally impact readability of the format-specific parsers themselves.

Koeng101 commented 11 months ago

We can't put it in bio/bio.go though because it would be a circular import, but I'm sure we could put it in some utils location. Once we get ioToBio, we should revisit this for actual integration

carreter commented 11 months ago

I don't think there would be an import cycle. Regardless, I'm going to switch this to a draft PR until #339 is merged. Once it is, this wrapper con go in a new ioutils package:

bio/
├── util.go
└── specificFormat/
    ├── parser.go
    └── types.go
ioutils/
└── util.go
github-actions[bot] commented 11 months ago

Status: Blocked :x:

Issues blocking this PR:

github-actions[bot] commented 8 months ago

This PR has had no activity in the past 2 months. Marking as stale.