TeselaGen / tg-oss

Teselagen Open Source modules
https://teselagen.github.io/tg-oss/
MIT License
40 stars 17 forks source link

Export parseFeatureLocation somewhere? #32

Closed manulera closed 11 months ago

manulera commented 1 year ago

Hi @tnrich

I want to use the function parseFeatureLocation from this file, but it is not exported by the module. For now I have copy-pasted the code and imported, but would it make sense to export it?

tnrich commented 1 year ago

Hi @manulera , sure go ahead and put a PR in exporting that function from the top level of bio-parsers. My computer died so I won't be able to do much for a couple days but once i have another one I'll merge and publish your code!

tnrich commented 1 year ago

@manulera I asked this in another thread, but what do you plan on using the parseFeatureLocation function for?

manulera commented 1 year ago

You are right, this makes no sense! I was going to use the function, but I got stuck with some refactoring and did not get to it. From the function name I assumed it would take the feature location string (e.g. complement(123...456)) and return the feature location. I see now that that's not what it does. Is there a function like that somewhere?

tnrich commented 1 year ago

Hi @manulera that is essentially what that function is doing, it's just not returning the feature location, instead pushing it into an already existing object. What is it you're trying to do with that function? Are you wanting to use it in a package outside of tg-oss?

manulera commented 1 year ago

Hi @tnrich, yes, essentially to read the list of locations from a string and get the array instead of doing feat.locations.push. For now I just need it for simple features without joins, so I am getting by with regex. I could try to implement this as a first contribution, since it's not much. I still have to setup the nx and so, but it could be a good first issue.

tnrich commented 1 year ago

Sure if you want to refactor that function so it is exported and returns an array of {start,end} objects that would be fine. Just make sure the original code will still work! Seems like a good potential first PR. You don't have to do anything to set up nx, just run yarn in the workspace to install the dependencies and you should be off to the races.

manulera commented 11 months ago

Closed with https://github.com/TeselaGen/tg-oss/pull/39