poly icon indicating copy to clipboard operation
poly copied to clipboard

Add a newline normalizing wrapper for io.Readers

Open carreter opened this issue 2 years ago • 10 comments

Will be useful for cross-platform support.

Blocked by #339

carreter avatar Sep 08 '23 23:09 carreter

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

Koeng101 avatar Sep 09 '23 00:09 Koeng101

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

carreter avatar Sep 09 '23 02:09 carreter

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

Koeng101 avatar Sep 09 '23 16:09 Koeng101

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.

carreter avatar Sep 09 '23 22:09 carreter

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)

Koeng101 avatar Sep 11 '23 04:09 Koeng101

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.

carreter avatar Sep 12 '23 17:09 carreter

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

Koeng101 avatar Sep 12 '23 18:09 Koeng101

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

carreter avatar Sep 12 '23 18:09 carreter

Status: Blocked :x:

Issues blocking this PR:

  • #339 :x:

This comment was automatically written by the Blocking Issues bot, and this PR will be monitored for further progress.

github-actions[bot] avatar Sep 23 '23 03:09 github-actions[bot]

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

github-actions[bot] avatar Nov 24 '23 18:11 github-actions[bot]