natverse / fafbseg

Support functions for analysis of Drosophila connectomes especially the FAFB-FlyWire whole brain
https://natverse.org/fafbseg/
GNU General Public License v3.0
6 stars 4 forks source link

ignore root ids without synapses in flywire_partner_summary() #104

Closed YijieYin closed 3 years ago

YijieYin commented 3 years ago

Currently flywire_partner_summary() gives an error if a root id doesn't have synapses (example below). This may be inconvenient when getting synapses of multiple ids at the same time.

library(fafbseg)

partners <- flywire_partner_summary('720575940425537043')
#> Fetching supervoxel ids for id: 720575940425537043
#> Finding synapses for supervoxels
#> Error: Must group by variables found in `.data`.
#> * Column `post_id` is not found.
jefferis commented 3 years ago

Thanks for the report @YijieYin. Looking into it, the problem is an interaction betweenflywire_partner_summary which throws the error and the low level flywire_partners. When there are no synapses flywire_partners returns a 0 length dataframe as expected, but the columns that flywire_partner_summary expects containing the partner ids are not returned. I think the best thing to do is to ensure that these columns are always present in output of flywire_partners.

> flywire_partners('720575940425537043')
Fetching supervoxel ids for id: 720575940425537043
Finding synapses for supervoxels
[1] offset    pre_svid  post_svid
<0 rows> (or 0-length row.names)