Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
de62da3
reorganize LifeEvent related classes
schristley May 27, 2025
112c4fd
generated files
schristley May 27, 2025
05672f6
t0 event references a LifeEvent
schristley May 27, 2025
648084a
generated files
schristley May 27, 2025
45d22eb
use AIRR locus field for chain type
schristley May 27, 2025
c89f7b9
generated files
schristley May 27, 2025
693ad38
antibody binding assay, add B and T cell complexes
schristley May 27, 2025
722d6e7
generated files
schristley May 27, 2025
b824e94
update IEDB example
schristley May 27, 2025
1a67029
remove PlannedProcess, Assessment is a LifeEvent
schristley Jun 10, 2025
ae4117a
generated files
schristley Jun 10, 2025
4f4d845
update for schema changes
schristley Jun 10, 2025
f559cda
generated files
schristley Jun 10, 2025
d63ef6f
reorganize Data classes
schristley Jul 8, 2025
0e490b0
generated files
schristley Jul 8, 2025
8ce0527
update for schema changes
schristley Jul 8, 2025
938baf7
measurement value
schristley Jul 9, 2025
46dfcb0
species specific immune receptors
schristley Jul 9, 2025
dc67481
generated files
schristley Jul 9, 2025
ba84db0
update example
schristley Jul 9, 2025
0686ce3
add slot usage for sex
Jul 14, 2025
4679afe
categorical measurement
Jul 14, 2025
900f620
tcell binding assay is a qualitative/categorical measurement
Jul 14, 2025
60cda5f
generated files
Jul 14, 2025
d99bfff
more specific
schristley Jul 14, 2025
9c0e3ee
Merge branch 'issue-89' of https://github.com/airr-knowledge/ak-schem…
schristley Jul 14, 2025
876b543
show linkml version
schristley Jul 14, 2025
90e03e0
revert, linkml is not always available
Jul 16, 2025
de8d811
move species to chain
Jul 17, 2025
f37b779
conform to AIRR standards
Jul 17, 2025
b8800e7
generated files
Jul 17, 2025
fcf2e0e
cleanup some type slots
schristley Jul 17, 2025
0b3cb1c
Merge branch 'issue-89' of https://github.com/airr-knowledge/ak-schem…
schristley Jul 17, 2025
8047b75
remove extra
schristley Jul 17, 2025
38c2f27
generated files
schristley Jul 17, 2025
4dae91f
do not inline
Jul 21, 2025
b28de6d
generated files
Jul 21, 2025
ca646e2
Merge branch 'main' into issue-89
schristley Jul 21, 2025
639ffa4
AIRR v2 updates
Jul 21, 2025
d5ee5bf
generated files
Jul 21, 2025
77fa984
update SQL DDL
Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 55 additions & 49 deletions examples/iedb/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def make_chain(row, chain_name):
tcr_curie + '-' + chain['Type'],
sequence=chain['Nucleotide Sequence'],
sequence_aa=chain['Protein Sequence'],
chain_type=chain_types[chain['Type']],
locus=chain_types[chain['Type']],
v_call=chain['Calculated V Gene'] or chain['Curated V Gene'],
d_call=chain['Calculated D Gene'] or chain['Curated D Gene'],
j_call=chain['Calculated J Gene'] or chain['Curated J Gene'],
Expand All @@ -113,7 +113,6 @@ def make_chain(row, chain_name):
cdr3_end=chain['CDR3 End Calculated'] or chain['CDR3 End Curated']
)


@click.command()
@click.argument('tcell_path')
@click.argument('tcr_path')
Expand Down Expand Up @@ -209,59 +208,69 @@ def convert(tcell_path, tcr_path, yaml_path):
name=f'participant 1 of {assay_id}',
description=f'study participant for assay {assay_id}',
species=row['Host']['Name'],
biological_sex=row['Host']['Sex'],
sex=row['Host']['Sex'],
race=None,
ethnicity=None,
geolocation=None
# geolocation=row['Host']['Geolocation']
)
life_event_1 = LifeEvent(
# life_event_1 = LifeEvent(
# akc_id(),
# name=f'1st in vivo immune exposure event of assay {assay_id}',
# description=f'participant 1 of assay {assay_id} participated in this 1st in vivo immune exposure event',
# participant=participant.akc_id,
# study_event=None,
# life_event_type=row['1st in vivo Process']['Process Type'],
# geolocation=None,
# t0_event=None,
# start=None,
# duration=None,
# time_unit=None
# )
# life_event_2 = LifeEvent(
# akc_id(),
# name=f'specimen collection event of assay {assay_id}',
# description=f'specimen 1 was collected from participant 1 of assay {assay_id} in this event',
# participant=participant.akc_id,
# study_event=study_event.akc_id,
# life_event_type='specimen collection',
# geolocation=None,
# t0_event=None,
# start=None,
# duration=None,
# time_unit=None
# )
life_event_1 = ImmuneExposure(
akc_id(),
name=f'1st in vivo immune exposure event of assay {assay_id}',
description=f'participant 1 of assay {assay_id} participated in this 1st in vivo immune exposure event',
name=None,
description=None,
participant=participant.akc_id,
study_event=None,
life_event_type=row['1st in vivo Process']['Process Type'],
geolocation=None,
t0_event=None,
t0_event_type=None,
start=None,
duration=None,
time_unit=None
exposure_material=row['1st immunogen']['Source Organism'],
disease=row['1st in vivo Process']['Disease'],
disease_stage=row['1st in vivo Process']['Disease Stage'],
disease_severity=None
)
life_event_2 = LifeEvent(
life_event_2 = SpecimenCollection(
akc_id(),
name=f'specimen collection event of assay {assay_id}',
description=f'specimen 1 was collected from participant 1 of assay {assay_id} in this event',
name=None,
description=None,
participant=participant.akc_id,
study_event=study_event.akc_id,
life_event_type='specimen collection',
geolocation=None,
t0_event=None,
t0_event_type=None,
start=None,
duration=None,
time_unit=None
)
immune_exposure = ImmuneExposure(
akc_id(),
name=f'details of 1st in vivo immune exposure event of assay {assay_id}',
description=f'participant 1 of assay {assay_id} participated in this 1st in vivo immune exposure event, with these details',
life_event=life_event_1.akc_id,
exposure_material=row['1st immunogen']['Source Organism'],
disease=row['1st in vivo Process']['Disease'],
disease_stage=row['1st in vivo Process']['Disease Stage'],
disease_severity=None
)
# assessment
specimen = Specimen(
akc_id(),
name=f'specimen 1 of assay {assay_id}',
description=f'specimen 1 from participant 1 of assay {assay_id}',
life_event=life_event_2.akc_id,
specimen_type=None,
tissue=row['Effector Cell']['Source Tissue'],
process=None
tissue=row['Effector Cell']['Source Tissue']
)
epitope = PeptidicEpitope(
curie(row['Epitope']['IEDB IRI']),
Expand Down Expand Up @@ -310,15 +319,11 @@ def convert(tcell_path, tcr_path, yaml_path):
assay_type=curie(row['Assay']['IRI']), # TODO: use label
epitope=epitope.akc_id,
tcell_receptors=[t.akc_id for t in tcell_receptors],
value=row['Assay']['Qualitative Measurement'],
unit=None
measurement_category=row['Assay']['Qualitative Measurement']
)
dataset = Dataset(
dataset = AKDataSet(
akc_id(),
name=f'dataset 1 about assay {assay_id}',
description=f'dataset 1 is about assay {assay_id}',
assessments=None,
assays=[assay.akc_id]
data_items=[assay.akc_id]
)
conclusion = Conclusion(
akc_id(),
Expand All @@ -338,7 +343,7 @@ def convert(tcell_path, tcr_path, yaml_path):
container.participants[participant.akc_id] = participant
container.life_events[life_event_1.akc_id] = life_event_1
container.life_events[life_event_2.akc_id] = life_event_2
container.immune_exposures[immune_exposure.akc_id] = immune_exposure
#container.immune_exposures[immune_exposure.akc_id] = immune_exposure
# container.assessments[assessment.id] = assessment
container.specimens[specimen.akc_id] = specimen
container.assays[assay.akc_id] = assay
Expand Down Expand Up @@ -369,17 +374,18 @@ def convert(tcell_path, tcr_path, yaml_path):
f.write('\n')

# Write everything to TSV
container_fields = [x.name for x in dataclasses.fields(container)]
for container_field in container_fields:
rows = list(container[container_field].values())
if len(rows) < 1:
continue
with open(f'tsv/{container_field}.tsv', 'w') as f:
fieldnames = [x.name for x in dataclasses.fields(rows[0])]
w = csv.DictWriter(f, fieldnames, delimiter='\t', lineterminator='\n')
w.writeheader()
for row in rows:
w.writerow(row.__dict__)
# container_fields = [x.name for x in dataclasses.fields(container)]
# for container_field in container_fields:
# rows = list(container[container_field].values())
# if len(rows) < 1:
# continue
# print(f"Writing tsv for {container_field}")
# with open(f'tsv/{container_field}.tsv', 'w') as f:
# fieldnames = [x.name for x in dataclasses.fields(rows[0])]
# w = csv.DictWriter(f, fieldnames, delimiter='\t', lineterminator='\n')
# w.writeheader()
# for row in rows:
# w.writerow(row.__dict__)


if __name__ == "__main__":
Expand Down
Loading