List of useful one queriesΒΆ

[1]:
from oneibl.one import ONE
one = ONE()
Connected to https://alyx.internationalbrainlab.org as mayo

Query session for several subjects

[2]:
subjects = ['DY_003', 'DY_006']
ses = one.alyx.rest('sessions', 'list', django=f"subject__nickname__in,{subjects}")

Query sessions that have histology available

[3]:
ses = one.alyx.rest('sessions', 'list', histology=True)
# the generic way
ses = one.alyx.rest('sessions', 'list',
                    django="subject__actions_sessions__procedures__name,Histology")

Query sessions that do not have matlab in the project name

[4]:
ses = one.alyx.rest('sessions', 'list', django='~project__name__icontains,matlab')

Query sessions that do not contain a given dataset type

[5]:
ses = one.alyx.rest('sessions', 'list',
                    django='~data_dataset_session_related__dataset_type__name__icontains,wheel')

Query all sessions not labelled as CRITICAL

[6]:
ses = one.alyx.rest('sessions', 'list', django='qc__lt,50')

Query probe insertions for a given task protocol

[7]:
ins = one.alyx.rest('insertions', 'list', django='session__task_protocol__icontains,choiceworld')

Query trajectories with channels in given brain region

[8]:
trajs = one.alyx.rest('trajectories', 'list', django='channels__brain_region__name__icontains,'
                                                     'Entorhinal area medial part dorsal zone '
                                                     'layer 2')

Query spikesorting tasks that have errored in angelaki lab

[9]:
errored = one.alyx.rest('tasks', 'list', status='Errored', lab='angelakilab',
                        name='SpikeSorting_KS2_Matlab')

Query ephys sessions that have errored tasks

[10]:
ses = one.alyx.rest('sessions', 'list', task_protocol='ephys', django='tasks__status,40')

Query insertions that have alignment resolved

[11]:
ins = one.alyx.rest('insertions', 'list', django='json__extended_qc__alignment_resolved,True')

Get names of users who have aligned specified insertion

[12]:
names = one.alyx.rest('trajectories', 'list', provenance='Ephys aligned histology track',
                      probe_insertion='341ef9bb-25f9-4eeb-8f1d-bdd054b22ba8')[0]['json'].keys()

List all sessions which any video QC set

[13]:
keys = ('videoLeft', 'videoRight', 'videoBody')
one.alyx.rest('sessions', 'list', django=f'extended_qc__has_any_keys,{keys}')
Out[13]:
<oneibl.webclient._PaginatedResponse at 0x1cce1653348>

List all weighings for a given date

[14]:
date = '2021-02-05'
one.alyx.rest('weighings', 'list', django=f'date_time__date,{date}')
Out[14]:
[{'subject': 'FMR012',
  'date_time': '2021-02-05T12:35:29.643549',
  'weight': 21.5,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/041ba216-5253-4cce-a323-f47abf95f41d'},
 {'subject': 'ZFM-01867',
  'date_time': '2021-02-05T13:58:32.337801',
  'weight': 20.3,
  'user': 'guido',
  'url': 'https://alyx.internationalbrainlab.org/weighings/088466d9-9484-4f99-9c85-f6c67c57a60d'},
 {'subject': 'NYU-38',
  'date_time': '2021-02-05T09:53:10.653086',
  'weight': 21.8,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/0a8ba25a-702b-46f3-b38b-9d7c43d1d06e'},
 {'subject': 'dop_22',
  'date_time': '2021-02-05T17:34:22.936897',
  'weight': 16.5,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/0e67872a-a62a-48e1-9e72-a12be24d198e'},
 {'subject': 'FMR007',
  'date_time': '2021-02-05T11:35:21.601904',
  'weight': 15.8,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/21c8a144-3efa-46fc-8a30-fbf9cb760c9c'},
 {'subject': 'dop_26_',
  'date_time': '2021-02-05T16:00:17.468043',
  'weight': 18.4,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/35daa599-f11d-462a-a63d-6d03b6c9bbdc'},
 {'subject': 'ZFM-01937',
  'date_time': '2021-02-05T12:07:25.285215',
  'weight': 19.75,
  'user': 'guido',
  'url': 'https://alyx.internationalbrainlab.org/weighings/3a3d3bd4-a8b3-4266-a89e-7f8d2bc72bdb'},
 {'subject': 'ibl_witten_28',
  'date_time': '2021-02-05T14:06:28.308702',
  'weight': 21.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/3b935dad-7dd4-4e9b-902b-ecac1196418f'},
 {'subject': 'ZFM-01802',
  'date_time': '2021-02-05T12:11:36.705726',
  'weight': 22.8,
  'user': 'guido',
  'url': 'https://alyx.internationalbrainlab.org/weighings/482842a0-0d13-4335-8299-a2c7bb7508fe'},
 {'subject': 'ZFM-01864',
  'date_time': '2021-02-05T12:12:19.402110',
  'weight': 21.05,
  'user': 'guido',
  'url': 'https://alyx.internationalbrainlab.org/weighings/56ade112-9098-4267-8b20-bb67b9df44b5'},
 {'subject': 'dop_13',
  'date_time': '2021-02-05T10:17:29.172426',
  'weight': 21.9,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/577eb3ac-9484-4bd1-8433-839d0cc9bb57'},
 {'subject': 'FMR014',
  'date_time': '2021-02-05T12:37:58.911286',
  'weight': 16.6,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/5fcbd973-e9f5-4a27-ac2b-bc8d54ebc15e'},
 {'subject': 'NR_0005',
  'date_time': '2021-02-05T14:28:51.537963',
  'weight': 23.4,
  'user': 'hailey.barrell',
  'url': 'https://alyx.internationalbrainlab.org/weighings/6254a871-aa7b-44c4-86a4-1eef5a92754f'},
 {'subject': 'ibl_witten_31',
  'date_time': '2021-02-05T16:48:05.506767',
  'weight': 23.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/68d34b04-886d-441d-9355-058406bada77'},
 {'subject': 'dop_24',
  'date_time': '2021-02-05T10:49:08.866268',
  'weight': 21.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/69f661b1-02f9-471d-b22e-23981197fc6a'},
 {'subject': 'dop_20',
  'date_time': '2021-02-05T11:54:16.146818',
  'weight': 19.5,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/6aa008da-fa40-49cd-a682-750769682d77'},
 {'subject': 'KS050',
  'date_time': '2021-02-05T08:24:03.931000',
  'weight': 20.8,
  'user': 'Karolina_Socha',
  'url': 'https://alyx.internationalbrainlab.org/weighings/6d47b938-858e-499f-b977-cf649d1fb3bc'},
 {'subject': 'KS047',
  'date_time': '2021-02-05T14:34:39.259000',
  'weight': 24.64,
  'user': 'Karolina_Socha',
  'url': 'https://alyx.internationalbrainlab.org/weighings/6d99a48b-0746-498e-803d-cb3329befee8'},
 {'subject': 'ZFM-01935',
  'date_time': '2021-02-05T15:00:28.238458',
  'weight': 22.6,
  'user': 'guido',
  'url': 'https://alyx.internationalbrainlab.org/weighings/6e67b74e-9232-4d68-9d1c-f974d6328f24'},
 {'subject': 'ibl_witten_30',
  'date_time': '2021-02-05T15:14:15.140454',
  'weight': 25.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/77346f0a-a6e6-4371-8d5a-bb95241ae075'},
 {'subject': 'dop_15',
  'date_time': '2021-02-05T10:24:49.608243',
  'weight': 22.4,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/7a1bd8ae-d405-426d-8935-87731803fe3a'},
 {'subject': 'NR_0008',
  'date_time': '2021-02-05T14:21:13.177639',
  'weight': 23.11,
  'user': 'hailey.barrell',
  'url': 'https://alyx.internationalbrainlab.org/weighings/858527b7-3bd8-4329-a119-28d49797cb09'},
 {'subject': 'KS049',
  'date_time': '2021-02-05T08:27:14.276000',
  'weight': 19.4,
  'user': 'Karolina_Socha',
  'url': 'https://alyx.internationalbrainlab.org/weighings/8bd38043-6d08-4350-b43d-b96c18b46007'},
 {'subject': 'dop_21',
  'date_time': '2021-02-05T11:49:27.829614',
  'weight': 18.6,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/8c62c069-f32b-43d3-803a-7a7bd6506056'},
 {'subject': 'FMR008',
  'date_time': '2021-02-05T11:23:46.135025',
  'weight': 18.5,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/a2c1ec75-aba5-46af-9854-71edd74a60ee'},
 {'subject': 'FMR006',
  'date_time': '2021-02-05T11:26:59.453611',
  'weight': 15.8,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/a473c2d8-4208-45dd-a664-8c4fe8f7cffe'},
 {'subject': 'dop_14',
  'date_time': '2021-02-05T10:16:32.286732',
  'weight': 19.9,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/b2ef632a-2e19-48b8-b155-dd08df3c193a'},
 {'subject': 'ibl_witten_32',
  'date_time': '2021-02-05T16:51:18.308667',
  'weight': 24.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/bf13373a-6c60-45ce-90a8-853cc4b18101'},
 {'subject': 'FMR015',
  'date_time': '2021-02-05T12:40:46.797874',
  'weight': 20.3,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/c0dfd1f6-8739-4d23-933a-e2c46e6a5d22'},
 {'subject': 'dop_16',
  'date_time': '2021-02-05T13:41:07.844278',
  'weight': 22.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/c3dd20a3-627b-4230-b7b0-03981e481b74'},
 {'subject': 'KS048',
  'date_time': '2021-02-05T08:18:46.832000',
  'weight': 19.2,
  'user': 'Karolina_Socha',
  'url': 'https://alyx.internationalbrainlab.org/weighings/c4665d74-f1c6-4729-8d24-437839034005'},
 {'subject': 'dop_17',
  'date_time': '2021-02-05T11:57:21.533139',
  'weight': 20.3,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/c55a34b8-741d-41bc-b96b-a2570d0119e8'},
 {'subject': 'NR_0009',
  'date_time': '2021-02-05T15:12:07.834532',
  'weight': 21.05,
  'user': 'hailey.barrell',
  'url': 'https://alyx.internationalbrainlab.org/weighings/c9ecf81e-8517-4627-904a-7d07143c139c'},
 {'subject': 'FMR009',
  'date_time': '2021-02-05T09:45:31.969287',
  'weight': 20.2,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/ccc7bf5d-d53c-42a5-ae3a-9e449981c481'},
 {'subject': 'ibl_witten_29',
  'date_time': '2021-02-05T15:10:36.277355',
  'weight': 25.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/d208e043-419a-4728-98f3-3742dabaa02b'},
 {'subject': 'ZFM-01933',
  'date_time': '2021-02-05T12:05:09.161800',
  'weight': 23.9,
  'user': 'guido',
  'url': 'https://alyx.internationalbrainlab.org/weighings/d48d129a-33b8-4a0b-be6e-88d59f196cb7'},
 {'subject': 'dop_18',
  'date_time': '2021-02-05T13:31:04.777277',
  'weight': 21.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/da9d2c20-5fae-4894-a112-89be199cb9df'},
 {'subject': 'dop_25',
  'date_time': '2021-02-05T14:07:16.218905',
  'weight': 20.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/e24aa207-4c2a-4d87-9a60-63624f6cdbce'},
 {'subject': 'dop_28',
  'date_time': '2021-02-05T12:29:52.752057',
  'weight': 21.0,
  'user': 'alejandro',
  'url': 'https://alyx.internationalbrainlab.org/weighings/ecf7818f-9796-4ea8-b92b-ce36d3ce1788'},
 {'subject': 'FMR011',
  'date_time': '2021-02-05T09:47:50.949033',
  'weight': 19.5,
  'user': 'jeanpaul',
  'url': 'https://alyx.internationalbrainlab.org/weighings/f6579e69-31ef-4ca2-9fe5-689b531fc388'}]