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()