def setup_maf_header(self): """ Sets up the maf header. """ # Reader header _hdr = MafHeader.from_reader(reader=self.maf_reader) if not self.options["reference_fasta_index"]: self.maf_header = MafHeader.from_defaults( version=self.options["version"], annotation=self.options["annotation"], sort_order=BarcodesAndCoordinate(), contigs=_hdr.contigs(), ) else: self.maf_header = MafHeader.from_defaults( version=self.options["version"], annotation=self.options["annotation"], sort_order=BarcodesAndCoordinate(), fasta_index=self.options["reference_fasta_index"], ) self.maf_header.validation_stringency = ValidationStringency.Strict header_date = BaseRunner.get_header_date() self.maf_header[header_date.key] = header_date try: nkey = _hdr["normal.aliquot"] self.maf_header["normal.aliquot"] = nkey except KeyError as e: if not self.options["tumor_only"]: raise e tkey = _hdr["tumor.aliquot"] self.maf_header["tumor.aliquot"] = tkey
def setup_maf_header(self): """ Sets up the maf header. """ self.maf_header = MafHeader.from_defaults( version=self.options["version"], annotation=self.options["annotation"], sort_order=BarcodesAndCoordinate(), fasta_index=self.options["reference_fasta_index"], ) header_date = BaseRunner.get_header_date() self.maf_header[header_date.key] = header_date if not self.options["tumor_only"]: normal_aliquot = MafHeaderRecord( key="normal.aliquot", value=self.options["normal_aliquot_uuid"] if not self.options["tumor_only"] else "", ) self.maf_header[normal_aliquot.key] = normal_aliquot tumor_aliquot = MafHeaderRecord( key="tumor.aliquot", value=self.options["tumor_aliquot_uuid"] ) self.maf_header[tumor_aliquot.key] = tumor_aliquot
def test_from_defaults(self): header = MafHeader.from_defaults( version=TestMafHeader.Scheme.version(), annotation=TestMafHeader.Scheme.annotation_spec(), sort_order=Coordinate(), ) self.assertIsNotNone(header.scheme()) self.assertIsNotNone(header.scheme().version()) self.assertIsNotNone(header.scheme().annotation_spec()) self.assertIsNotNone(header.sort_order())
def setup_maf_header(self): """ Sets up the maf header. """ # Reader header _hdr = MafHeader.from_reader(reader=self.maf_readers[0]) self.maf_header = MafHeader.from_defaults( version=self.options['version'], annotation=self.options['annotation'], sort_order=BarcodesAndCoordinate(), contigs=_hdr.contigs()) self.maf_header.validation_stringency = ValidationStringency.Strict header_date = BaseRunner.get_header_date() self.maf_header[header_date.key] = header_date nkey = _hdr["normal.aliquot"] self.maf_header["normal.aliquot"] = nkey tkey = _hdr["tumor.aliquot"] self.maf_header["tumor.aliquot"] = tkey