Skip to contents

Specify ids for fly connectome datasets

Usage

cf_ids(
  query = NULL,
  datasets = c("brain", "vnc", "hemibrain", "flywire", "malecns", "manc", "fanc",
    "opticlobe", "banc"),
  expand = FALSE,
  keys = FALSE,
  hemibrain = NULL,
  flywire = NULL,
  malecns = NULL,
  manc = NULL,
  fanc = NULL,
  opticlobe = NULL,
  banc = NULL
)

# S3 method for class 'cidlist'
c(..., unique = TRUE)

Arguments

query

A query (e.g. cell type name or regular expression)

datasets

Character vector naming datasets to which the query should be applied.

expand

Whether to expand any queries into the matching ids (this will involve one or more calls to corresponding servers). Default FALSE.

keys

Whether to turn the ids into keys hb:12345 right away. Default FALSE but you may find this useful e.g. for combining lists of neurons (see examples).

hemibrain

Pass hemibrain specific query or ids to this argument

flywire

Pass flywire specific query or ids to this argument

malecns

Pass malecns specific query or ids to this argument

manc

Pass manc specific query or ids to this argument

fanc

Pass fanc ids to this argument (at present we do not support metadata queries for fanc)

opticlobe

Pass opticlobe specific query or ids to this argument

banc

Pass banc ids to this argument (we only support basic metadata queries for banc)

...

One or more lists generated by cf_ids that should be joined together

unique

Whether to remove duplicated ids when combining cf_id lists with c.cidlist

Value

A list of ids with additional class cidlist

Details

You will often want to perform a query, most commonly for a cell type or cell class, rather than specific numeric ids. The most flexible way to do this is to use a regular expression (regex) query, specified with an initial "/".

All neuprint datasets (hemibrain, malevnc, opticlobe, malecns) use the same query syntax although some fields may be dataset specific (see examples). The regex syntax for CAVE datasets (flywire, fanc, banc) should be the same although you may find some wrinkles because the underlying data stores are different. Note that we do not yet translate all the different fields across datasets for queries, although this is a goal. For example the neuprint/fanc/banc class field is equivalent to flywire super_class. Similarly the values are not guaranteed to be the same. Where flywire uses super_class=="descending") the manc uses class=="descending neuron").

Therefore to find all DNs in these two datasets you will need to do: cf_ids(manc='/class:descending.*', flywire='/super_class:descending.*')

Feel free to make an issue if you find something that doesn't feel right or can suggest an improvement.

See also

Other ids: keys()

Examples

# \donttest{
cf_ids("DA2_lPN", datasets='brain')
#> banc [1 ids]: DA2_lPN
#> flywire [1 ids]: DA2_lPN
#> hemibrain [1 ids]: DA2_lPN
#> malecns [1 ids]: DA2_lPN
# / introduces a regular expression
cf_ids("/MBON.+", datasets='brain')
#> banc [1 ids]: /MBON.+
#> flywire [1 ids]: /MBON.+
#> hemibrain [1 ids]: /MBON.+
#> malecns [1 ids]: /MBON.+

# expand query into actual ids
cf_ids("/type:MBON.+", datasets='brain', expand=TRUE)
#> Warning: WARNING:root:Deprecation: this method is to facilitate beta testing of this feature,             it will likely get removed in future versions. 
#> flywire_rootid_cached: Looking up 305 missing keys
#> Warning: No matching ids when querying dataset:banc
#> banc [0 ids]: 
#> flywire [96 ids]: 720575940624185095 720575940624117245 720575940638526278 720575940629585602 720575940637934308 720575940632118343 720575940609959637 720575940638163428 720575940630496374 720575940642142861 ...
#> hemibrain [71 ids]: 612371421 673509195 424789697 5813022341 487925037 612738462 487925063 613079053 1386512867 799586652 ...
#> malecns [103 ids]: 520151 10013 522749 522444 519373 521526 525780 530875 519371 10495 ...

# return keys directly
cf_ids("/type:MBON.+", keys=TRUE)
#> Warning: No matching ids when querying dataset:banc
#>   [1] "fw:720575940624185095" "fw:720575940624117245" "fw:720575940638526278"
#>   [4] "fw:720575940629585602" "fw:720575940637934308" "fw:720575940632118343"
#>   [7] "fw:720575940609959637" "fw:720575940638163428" "fw:720575940630496374"
#>  [10] "fw:720575940642142861" "fw:720575940611344078" "fw:720575940634822751"
#>  [13] "fw:720575940617552340" "fw:720575940624280328" "fw:720575940617567206"
#>  [16] "fw:720575940643700640" "fw:720575940615221811" "fw:720575940614026193"
#>  [19] "fw:720575940633209647" "fw:720575940623001480" "fw:720575940608304220"
#>  [22] "fw:720575940614595218" "fw:720575940636992368" "fw:720575940621828443"
#>  [25] "fw:720575940637902938" "fw:720575940638774606" "fw:720575940639697827"
#>  [28] "fw:720575940626833021" "fw:720575940618008859" "fw:720575940635841143"
#>  [31] "fw:720575940618249797" "fw:720575940629856515" "fw:720575940623905719"
#>  [34] "fw:720575940629529722" "fw:720575940624659943" "fw:720575940624590316"
#>  [37] "fw:720575940645304430" "fw:720575940612196850" "fw:720575940630767959"
#>  [40] "fw:720575940635082347" "fw:720575940628757547" "fw:720575940627144069"
#>  [43] "fw:720575940610647416" "fw:720575940622093436" "fw:720575940624696810"
#>  [46] "fw:720575940629422086" "fw:720575940647328900" "fw:720575940650386553"
#>  [49] "fw:720575940639556467" "fw:720575940612455338" "fw:720575940617749538"
#>  [52] "fw:720575940617760257" "fw:720575940619810389" "fw:720575940634482783"
#>  [55] "fw:720575940644615716" "fw:720575940626109315" "fw:720575940623377802"
#>  [58] "fw:720575940626744921" "fw:720575940623464316" "fw:720575940622979277"
#>  [61] "fw:720575940614892182" "fw:720575940620715224" "fw:720575940643863496"
#>  [64] "fw:720575940621777391" "fw:720575940606953858" "fw:720575940630075703"
#>  [67] "fw:720575940652390134" "fw:720575940632535756" "fw:720575940643696288"
#>  [70] "fw:720575940623201833" "fw:720575940635063135" "fw:720575940616463477"
#>  [73] "fw:720575940629981440" "fw:720575940623182847" "fw:720575940626315010"
#>  [76] "fw:720575940632943277" "fw:720575940624539284" "fw:720575940620464321"
#>  [79] "fw:720575940628783363" "fw:720575940643309197" "fw:720575940614392999"
#>  [82] "fw:720575940617302365" "fw:720575940622997453" "fw:720575940624694503"
#>  [85] "fw:720575940628734376" "fw:720575940610964946" "fw:720575940607155890"
#>  [88] "fw:720575940623381956" "fw:720575940630864847" "fw:720575940638028607"
#>  [91] "fw:720575940621164720" "fw:720575940623841463" "fw:720575940631177803"
#>  [94] "fw:720575940624489964" "fw:720575940616398303" "fw:720575940623750325"
#>  [97] "hb:612371421"          "hb:673509195"          "hb:424789697"         
#> [100] "hb:5813022341"         "hb:487925037"          "hb:612738462"         
#> [103] "hb:487925063"          "hb:613079053"          "hb:1386512867"        
#> [106] "hb:799586652"          "hb:422725634"          "hb:5813061512"        
#> [109] "hb:1234386037"         "hb:611477605"          "hb:733036127"         
#> [112] "hb:920470959"          "hb:1016835041"         "hb:1048215779"        
#> [115] "hb:1078693835"         "hb:613719036"          "hb:672352543"         
#> [118] "hb:768555687"          "hb:424767514"          "hb:517518166"         
#> [121] "hb:704466265"          "hb:861665641"          "hb:1139667240"        
#> [124] "hb:300972942"          "hb:394225044"          "hb:5813067721"        
#> [127] "hb:5813068729"         "hb:642664141"          "hb:673702721"         
#> [130] "hb:457175171"          "hb:579916831"          "hb:673366098"         
#> [133] "hb:5812981264"         "hb:5812981543"         "hb:457196444"         
#> [136] "hb:5813020828"         "hb:423774471"          "hb:517854468"         
#> [139] "hb:792368888"          "hb:5813022896"         "hb:985813153"         
#> [142] "hb:5813042659"         "hb:985131499"          "hb:423382015"         
#> [145] "hb:487143497"          "hb:550081497"          "hb:612742248"         
#> [148] "hb:612422902"          "hb:912951014"          "hb:895441451"         
#> [151] "hb:5813061538"         "hb:5813117385"         "hb:457196643"         
#> [154] "hb:5813058048"         "hb:5813052909"         "hb:5813022234"        
#> [157] "hb:5813040205"         "hb:706948318"          "hb:894020730"         
#> [160] "hb:642732835"          "hb:643847447"          "hb:518670779"         
#> [163] "hb:547552266"          "hb:1173814525"         "hb:5813033000"        
#> [166] "hb:518930199"          "hb:611089775"          "mc:520151"            
#> [169] "mc:10013"              "mc:522749"             "mc:522444"            
#> [172] "mc:519373"             "mc:521526"             "mc:525780"            
#> [175] "mc:530875"             "mc:519371"             "mc:10495"             
#> [178] "mc:10079"              "mc:12690"              "mc:12859"             
#> [181] "mc:515338"             "mc:15626"              "mc:18603"             
#> [184] "mc:18713"              "mc:19267"              "mc:523060"            
#> [187] "mc:21242"              "mc:549193"             "mc:59057"             
#> [190] "mc:522732"             "mc:133427"             "mc:535076"            
#> [193] "mc:558665"             "mc:62162"              "mc:579919"            
#> [196] "mc:70924"              "mc:39608"              "mc:136475"            
#> [199] "mc:531829"             "mc:49262"              "mc:524733"            
#> [202] "mc:150846"             "mc:10704"              "mc:11402"             
#> [205] "mc:13728"              "mc:13768"              "mc:519368"            
#> [208] "mc:521086"             "mc:12726"              "mc:514853"            
#> [211] "mc:19366"              "mc:17946"              "mc:11873"             
#> [214] "mc:10267"              "mc:520395"             "mc:187741"            
#> [217] "mc:58401"              "mc:31083"              "mc:38859"             
#> [220] "mc:44619"              "mc:38853"              "mc:11777"             
#> [223] "mc:520186"             "mc:562782"             "mc:41692"             
#> [226] "mc:31016"              "mc:513391"             "mc:513387"            
#> [229] "mc:14221"              "mc:512788"             "mc:26853"             
#> [232] "mc:33617"              "mc:36094"              "mc:47551"             
#> [235] "mc:10804"              "mc:11145"              "mc:523628"            
#> [238] "mc:10826"              "mc:12918"              "mc:11990"             
#> [241] "mc:20835"              "mc:512789"             "mc:18406"             
#> [244] "mc:15708"              "mc:87077"              "mc:394860"            
#> [247] "mc:160320"             "mc:76585"              "mc:110448"            
#> [250] "mc:556300"             "mc:11176"              "mc:524893"            
#> [253] "mc:519128"             "mc:515034"             "mc:28622"             
#> [256] "mc:26485"              "mc:519619"             "mc:523987"            
#> [259] "mc:513174"             "mc:515015"             "mc:11805"             
#> [262] "mc:10816"              "mc:11455"              "mc:519131"            
#> [265] "mc:523043"             "mc:11785"              "mc:208566"            
#> [268] "mc:92112"              "mc:508595"             "mc:10599"             
# one way of combining separate lists of neurons
hbids=c(264083994, 5813022274)
c(cf_ids("/type:MBON1.+", keys=TRUE), cf_ids(hemibrain = hbids, keys = TRUE))
#> Warning: No matching ids when querying dataset:banc
#>   [1] "fw:720575940629585602" "fw:720575940632118343" "fw:720575940642142861"
#>   [4] "fw:720575940634822751" "fw:720575940615221811" "fw:720575940614026193"
#>   [7] "fw:720575940633209647" "fw:720575940623001480" "fw:720575940608304220"
#>  [10] "fw:720575940621828443" "fw:720575940638774606" "fw:720575940639697827"
#>  [13] "fw:720575940626833021" "fw:720575940635841143" "fw:720575940623905719"
#>  [16] "fw:720575940629529722" "fw:720575940645304430" "fw:720575940612196850"
#>  [19] "fw:720575940630767959" "fw:720575940635082347" "fw:720575940628757547"
#>  [22] "fw:720575940610647416" "fw:720575940622093436" "fw:720575940624696810"
#>  [25] "fw:720575940647328900" "fw:720575940650386553" "fw:720575940639556467"
#>  [28] "fw:720575940612455338" "fw:720575940617749538" "fw:720575940617760257"
#>  [31] "fw:720575940634482783" "fw:720575940626109315" "fw:720575940623377802"
#>  [34] "fw:720575940626744921" "fw:720575940630075703" "fw:720575940632535756"
#>  [37] "fw:720575940643696288" "fw:720575940623201833" "fw:720575940626315010"
#>  [40] "fw:720575940624539284" "fw:720575940622997453" "fw:720575940623841463"
#>  [43] "hb:613719036"          "hb:672352543"          "hb:768555687"         
#>  [46] "hb:424767514"          "hb:517518166"          "hb:704466265"         
#>  [49] "hb:861665641"          "hb:1139667240"         "hb:300972942"         
#>  [52] "hb:394225044"          "hb:5813067721"         "hb:5813068729"        
#>  [55] "hb:642664141"          "hb:673702721"          "hb:457175171"         
#>  [58] "hb:579916831"          "hb:673366098"          "hb:5812981264"        
#>  [61] "hb:5812981543"         "hb:457196444"          "hb:5813020828"        
#>  [64] "hb:423774471"          "hb:517854468"          "mc:549193"            
#>  [67] "mc:59057"              "mc:522732"             "mc:133427"            
#>  [70] "mc:535076"             "mc:558665"             "mc:62162"             
#>  [73] "mc:579919"             "mc:70924"              "mc:39608"             
#>  [76] "mc:136475"             "mc:531829"             "mc:49262"             
#>  [79] "mc:524733"             "mc:150846"             "mc:10704"             
#>  [82] "mc:11402"              "mc:13728"              "mc:13768"             
#>  [85] "mc:519368"             "mc:521086"             "mc:12726"             
#>  [88] "mc:514853"             "mc:19366"              "mc:17946"             
#>  [91] "mc:11873"              "mc:10267"              "mc:520395"            
#>  [94] "mc:187741"             "mc:58401"              "mc:31083"             
#>  [97] "mc:38859"              "mc:44619"              "mc:38853"             
#> [100] "mc:11777"              "mc:520186"             "mc:562782"            
#> [103] "mc:41692"              "mc:31016"              "mc:513391"            
#> [106] "mc:513387"             "mc:14221"              "mc:512788"            
#> [109] "mc:26853"              "mc:33617"              "mc:36094"             
#> [112] "mc:47551"              "hb:264083994"          "hb:5813022274"        

# now equivalent to
keys(c(cf_ids("/type:MBON1.+"), cf_ids(hemibrain = hbids)))
#> Warning: No matching ids when querying dataset:banc
#>   [1] "fw:720575940629585602" "fw:720575940632118343" "fw:720575940642142861"
#>   [4] "fw:720575940634822751" "fw:720575940615221811" "fw:720575940614026193"
#>   [7] "fw:720575940633209647" "fw:720575940623001480" "fw:720575940608304220"
#>  [10] "fw:720575940621828443" "fw:720575940638774606" "fw:720575940639697827"
#>  [13] "fw:720575940626833021" "fw:720575940635841143" "fw:720575940623905719"
#>  [16] "fw:720575940629529722" "fw:720575940645304430" "fw:720575940612196850"
#>  [19] "fw:720575940630767959" "fw:720575940635082347" "fw:720575940628757547"
#>  [22] "fw:720575940610647416" "fw:720575940622093436" "fw:720575940624696810"
#>  [25] "fw:720575940647328900" "fw:720575940650386553" "fw:720575940639556467"
#>  [28] "fw:720575940612455338" "fw:720575940617749538" "fw:720575940617760257"
#>  [31] "fw:720575940634482783" "fw:720575940626109315" "fw:720575940623377802"
#>  [34] "fw:720575940626744921" "fw:720575940630075703" "fw:720575940632535756"
#>  [37] "fw:720575940643696288" "fw:720575940623201833" "fw:720575940626315010"
#>  [40] "fw:720575940624539284" "fw:720575940622997453" "fw:720575940623841463"
#>  [43] "hb:613719036"          "hb:672352543"          "hb:768555687"         
#>  [46] "hb:424767514"          "hb:517518166"          "hb:704466265"         
#>  [49] "hb:861665641"          "hb:1139667240"         "hb:300972942"         
#>  [52] "hb:394225044"          "hb:5813067721"         "hb:5813068729"        
#>  [55] "hb:642664141"          "hb:673702721"          "hb:457175171"         
#>  [58] "hb:579916831"          "hb:673366098"          "hb:5812981264"        
#>  [61] "hb:5812981543"         "hb:457196444"          "hb:5813020828"        
#>  [64] "hb:423774471"          "hb:517854468"          "hb:264083994"         
#>  [67] "hb:5813022274"         "mc:549193"             "mc:59057"             
#>  [70] "mc:522732"             "mc:133427"             "mc:535076"            
#>  [73] "mc:558665"             "mc:62162"              "mc:579919"            
#>  [76] "mc:70924"              "mc:39608"              "mc:136475"            
#>  [79] "mc:531829"             "mc:49262"              "mc:524733"            
#>  [82] "mc:150846"             "mc:10704"              "mc:11402"             
#>  [85] "mc:13728"              "mc:13768"              "mc:519368"            
#>  [88] "mc:521086"             "mc:12726"              "mc:514853"            
#>  [91] "mc:19366"              "mc:17946"              "mc:11873"             
#>  [94] "mc:10267"              "mc:520395"             "mc:187741"            
#>  [97] "mc:58401"              "mc:31083"              "mc:38859"             
#> [100] "mc:44619"              "mc:38853"              "mc:11777"             
#> [103] "mc:520186"             "mc:562782"             "mc:41692"             
#> [106] "mc:31016"              "mc:513391"             "mc:513387"            
#> [109] "mc:14221"              "mc:512788"             "mc:26853"             
#> [112] "mc:33617"              "mc:36094"              "mc:47551"             

# queries on classes respecting dataset idiosyncrasies
cf_ids(manc='/class:descending.*', flywire='/super_class:descending.*', expand = T)
#> flywire [1303 ids]: 720575940624402173 720575940627055303 720575940631082808 720575940623037720 720575940629543409 720575940618666142 720575940638109668 720575940630697078 720575940610610841 720575940618870881 ...
#> manc [1328 ids]: 28478 31361 156265 19821 22072 24087 29182 30346 31742 33545 ...
# }
c(cf_ids(flywire = 1, hemibrain = 2), cf_ids(hemibrain = 1:2, flywire=1:2))
#> flywire [2 ids]: 1 2
#> hemibrain [2 ids]: 2 1
c(cf_ids(flywire = 1, hemibrain = 2), cf_ids(hemibrain = 1:2, flywire=1:2), unique=FALSE)
#> flywire [3 ids]: 1 1 2
#> hemibrain [3 ids]: 2 1 2
# \donttest{
c(cf_ids(flywire = 1, hemibrain = 2), cf_ids(hemibrain = '/SMP55[0-9]', flywire=1:2))
#> flywire [2 ids]: 1 2
#> hemibrain [19 ids]: 2 452689494 579700707 328274638 392757094 605166418 298262663 361114148 669670654 613394707 ...
# }