LOOPS = 'Costantino_loops.bedpe'
STYLE = {'colour': '#2a78d6', 'size': 46, 'mode': 'area', 'limits': {'auto': True, 'min': 0, 'max': 1},
'group': '', 'shape': 'element', 'radius': 7, 'opacity': 1, 'flip': False}
def track(id_, kind, name, label, card='linear'):
"""A row of a workspace: a file on the reader's disk, asked for by its name."""
return {'id': id_, 'card': card, 'kind': kind, 'label': label, 'source': {'kind': 'local', 'name': name},
'visible': True, 'placement': {'bottom': True, 'right': False}, 'style': STYLE}
#: The window every map session is framed on: chrIV whole, which sacCer3 makes 1,531,933 bp.
WINDOW = 'chrIV:0-1531933'
def map_workspace(*tracks):
"""The map at 1.6 kb, balanced, framed on chrIV, and the tracks beside it."""
return {'kind': 'chromosomix.workspace', 'version': 1, 'active': 0, 'tabs': [{
'version': 1, 'state': {'uri': f'{MAP}::/resolutions/1600', 'view': 'region', 'region': WINDOW,
'balance': True},
'tracks': list(tracks)}]}
SESSIONS = [
dict(id='map', what='the map at 1.6 kb on chrIV, and the sequence',
workspace=map_workspace(track('sequence', 'sequence', FASTA, 'sacCer3')), files=[MAP, FASTA],
waitFor='reads as circular', cases=[
dict(id='insulation', title='Diamond insulation'),
dict(id='compartments', title='Compartments', set=[{'key': 'phaseSequence', 'option': 'sacCer3'}]),
dict(id='ps', title='Contact probability P(s)'),
dict(id='coverage', title='Coverage and marginals'),
dict(id='fourc', title='4C profile from an anchor',
set=[{'key': 'anchor', 'value': 'chrIV:1,300,001-1,302,000'}]),
dict(id='loops', title='Loop calling', set=[{'key': 'outer', 'value': 5}, {'key': 'inner', 'value': 2}]),
dict(id='motif', title='Find a motif', set=[{'key': 'sequence', 'option': 'sacCer3'},
{'key': 'pattern', 'value': 'WTTTAYRTTTW'}]),
]),
dict(id='map-loops', what='the map at 1.6 kb on chrIV, and the loops the first session called',
inputs=[{'from': 'loops/browser/loops-calls.bedpe', 'as': LOOPS}],
workspace=map_workspace(track('loops', 'pairs', LOOPS, 'loops', 'overlay')), files=[MAP, LOOPS],
waitFor='reads as circular', cases=[
dict(id='apa', title='Aggregate peak analysis'),
]),
dict(id='tracks', what='the ATAC-seq coverage and its peaks, with no map', files=[ATAC, PEAKS], cases=[
dict(id='peaks', title='Peak calling', set=[{'key': 'signal', 'option': 'ATAC'}]),
dict(id='metaplot', title='Metaplot over a feature set', set=[{'key': 'features', 'option': PEAKS.split('.')[0]}]),
]),
]
PLAN = {'app': str(APP), 'data': str(DATA), 'out': str(OUT), 'executablePath': CHROMIUM, 'sessions': SESSIONS}
CASES = [dict(case, session=session['id'], what=session['what']) for session in SESSIONS for case in session['cases']]
def setting(one):
if 'option' in one:
return f"{one['key']}: {one['option']}"
return f"{one['key']} = {one['value']}"
show(pd.DataFrame([{'case': c['id'], 'task': c['title'], 'session': c['what'],
'set in the form': '; '.join(setting(s) for s in c.get('set', [])) or 'nothing'} for c in CASES]))