TopoStats icon indicating copy to clipboard operation
TopoStats copied to clipboard

[feature] : Connect close ends

Open SylviaWhittle opened this issue 3 months ago • 8 comments

Is your feature request related to a problem?

Prolly a duplicate, will delete later if so

Describe the solution you would like.

Connect close ends, if within a certain distance, and if the connecting line is maybe above a certain threshold?

Image

Describe the alternatives you have considered.

No response

Additional context

No response

SylviaWhittle avatar Nov 03 '25 16:11 SylviaWhittle

Need to investigate if these gaps are noticeably above background

SylviaWhittle avatar Nov 03 '25 16:11 SylviaWhittle

Perhaps need to add a pathfinding algorithm to say "can we get from one end to the other end within say 10nm without going below 0.5 nm above the surface and avoiding going back on the current trace?"

SylviaWhittle avatar Nov 03 '25 16:11 SylviaWhittle

I have a gap filling algorithm used for another project but haven't implemented it in TopoStats yet as I imagined there are a load of more complex cases where my algorithm fails (I've only tested it on minicircles at the moment!)

We could have a look at this together and see if it would resolve the gaps for the data set you're working on?

llwiggins avatar Nov 03 '25 16:11 llwiggins

Yeah we should have a look together @llwiggins

IIRC that your method used like-oriented vectors?

SylviaWhittle avatar Nov 03 '25 16:11 SylviaWhittle

It fits a cubic spline through the coordinates before and after the break, seems to work well for small gaps but I imagine is quite whacky if the gaps are too large!

llwiggins avatar Nov 03 '25 16:11 llwiggins

@llwiggins how does it decide whether or not to connect two ends?

SylviaWhittle avatar Nov 03 '25 16:11 SylviaWhittle

I've set an eligibility criteria which will only connect two ends if the gap between them is within a certain distance threshold (atm a certain percentage of the expected contour length for the full molecule!)

llwiggins avatar Nov 03 '25 16:11 llwiggins

Sorry I can't find the issue now but there was one highlighting that a "bridge" is sometimes formed during skeletonisation between regions that came close to each other but shouldn't be connected. Will have to be careful that any solution here for joining ends doesn't re-introduce those.

ns-rse avatar Nov 04 '25 15:11 ns-rse