modos.genomics.cram#

Utilities to interact with genomic intervals in CRAM files.

Functions#

extract_metadata(instance, base_path)

Extract metadata from the CRAM file header and

validate_cram_files(cram_path)

Validate CRAM files using pysam.

create_sequence_id(name, sequence_md5)

Helper function to create a unique id from a sequence name and md5 hash

Module Contents#

modos.genomics.cram.extract_metadata(instance, base_path)[source]#

Extract metadata from the CRAM file header and convert specific attributes according to the modo schema.

Parameters:
  • instance (modos_schema.datamodel.AlignmentSet)

  • base_path (pathlib.Path)

Return type:

list[modos_schema.datamodel.ReferenceSequence]

modos.genomics.cram.validate_cram_files(cram_path)[source]#

Validate CRAM files using pysam. Checks if the file is sorted and has an index.

Parameters:

cram_path (str)

modos.genomics.cram.create_sequence_id(name, sequence_md5)[source]#

Helper function to create a unique id from a sequence name and md5 hash

Parameters:
  • name (str)

  • sequence_md5 (str)

Return type:

str