Provide option to output a BibTex citation file.
@Chris1221 had a great idea here for this in https://github.com/popgensims/stdpopsim/issues/144#issuecomment-558704947
Basically, we can use a web-service to get the bibtex for DOIs. We can then use this out output bibtex data.
I think a good way to do this would be to have a --bibtex=path option, which will write the bibtex records for all the citations used in a particular simulation to a file.
We can probably fetch these on demand initially, but we might want to cache the results at some point, I guess.
I think this is great. @Chris1221 want to implement?
If not, I can work on implementing. If I do this, I'd ignore the caching for the first implementation.
One question is, would you overwrite to path, append to path, or assume it's a .bib file and do something fancy like append new citations.
One question is, would you overwrite to path, append to path, or assume it's a .bib file and do something fancy like append new citations.
I'd say just overwrite the file. Appending would likely end up with having thousands of copies of the same references in the same file. It's trivial to append the contents to your own bib file afterwards if you want.
I can implement, no worries. I'm in favour of Jerome's --bibtex idea to keep the output clean, and @agladstein, I also agree about overwriting -- potentially a specific value could be reserved for stdout writing, but that might be a pretty rare need. An alternative idea might be to write the bib file at compile time (as a part of the package installation, when we know (for the major use cases) that we have internet) which would certainly create a complete record, and just return the desired records when the user asks for them. That would probably speed it up quite a bit, at the expense of install time. Not sure where we land on that.
OK, thanks @Chris1221, consider yourself assigned!
I'd vote for doing the simplest thing first: download on demand, and overwrite a file. Other options are niche, and it'll be tricky enough testing this functionality thoroughly anyway.
Thanks! Sounds good. The testing might be interesting. 馃槢
Mocking is the way to go for testing this sort of stuff. There's some examples in the code for testing the genetic map downloads.
Most helpful comment
OK, thanks @Chris1221, consider yourself assigned!
I'd vote for doing the simplest thing first: download on demand, and overwrite a file. Other options are niche, and it'll be tricky enough testing this functionality thoroughly anyway.