[docs]classAIRRExporter(DataExporter):""" Exports a RepertoireDataset of Repertoires in AIRR format. Things to note: - one filename_prefix is given, which is combined with the Repertoire identifiers for the filenames, to create one file per Repertoire - 'counts' is written into the field 'duplicate_counts' - 'sequence_identifiers' is written both into the fields 'sequence_id' and 'rearrangement_id' """
[docs]@staticmethoddefexport(dataset:Dataset,path:Path,number_of_processes:int=1,omit_columns:list=None):PathBuilder.build(path)try:ifisinstance(dataset,RepertoireDataset):repertoire_folder="repertoires/"repertoire_path=PathBuilder.build(path/repertoire_folder)forrepertoireindataset.repertoires:shutil.copyfile(repertoire.data_filename,repertoire_path/repertoire.data_filename.name)shutil.copyfile(repertoire.metadata_filename,repertoire_path/repertoire.metadata_filename.name)shutil.copyfile(dataset.metadata_file,path/dataset.metadata_file.name)ifdataset.dataset_fileanddataset.dataset_file.is_file():shutil.copyfile(dataset.dataset_file,path/dataset.dataset_file.name)elifisinstance(dataset,ElementDataset):shutil.copyfile(dataset.filename,path/dataset.filename.name)shutil.copyfile(dataset.dataset_file,path/dataset.dataset_file.name)exceptshutil.SameFileErrorase:logging.warning(f"AIRRExporter: target and input path are the same. Skipping the copy operation...")
# TODO: add here export of full sequence if possible