changeo.IO

File I/O and logging functions

changeo.IO.countDbFile(db_file)

Counts the records in database files

Parameters:db_file – tab-delimited database file.
Returns:count of records in the database file.
Return type:int
changeo.IO.extractIMGT(imgt_output)

Extract necessary files from IMGT/HighV-QUEST results.

Parameters:imgt_output – zipped file or unzipped folder output by IMGT/HighV-QUEST.
Returns:(temporary directory handle, dictionary with names of extracted IMGT files).
Return type:tuple
changeo.IO.getDbWriter(out_handle, in_file=None, add_fields=None, exclude_fields=None)

Opens a writer object for an output database file

Parameters:
  • out_handle – file handle to write to.
  • in_file – the input filename to determine output fields from; if None do not define output fields from input file.
  • add_fields – a list of fields added to the writer not present in the in_file; if None do not add fields.
  • exclude_fields – a list of fields in the in_file excluded from the writer; if None do not exclude fields.
Returns:

database writer object.

Return type:

csv.DictWriter

changeo.IO.readDbFile(db_file, ig=True)

Reads database files

Parameters:
  • db_file – tab-delimited database file.
  • ig – if True convert fields to a changeo.Receptor.IgRecord object.
Returns:

database record iterator

Return type:

iter

changeo.IO.readRepo(repo)

Parses germline repositories

Parameters:repo – String list of directories and/or files from which to read germline records
Returns:Dictionary of {allele: sequence} germlines
Return type:dict