Parses the metrics in a ${barcode}alignment_summary_metrics file in the DNAnexus project
        (usually in the qc folder). This contains metrics produced by Picard Tools's 
        CollectAlignmentSummaryMetrics program.

def get_alignment_summary_metrics(self, barcode):
        """
        Parses the metrics in a ${barcode}alignment_summary_metrics file in the DNAnexus project
        (usually in the qc folder). This contains metrics produced by Picard Tools's 
        CollectAlignmentSummaryMetrics program. 
        """
        filename = barcode + ".alignment_summary_metrics"
        # In the call to dxpy.find_one_data_object() below, I'd normally set the 
        # more_ok parameter to False, but this blows-up in Python 3.7 - giving me a RuntimeError. 
        # So, I just won't set it for now. I think dxpy is still mainly a Python 2.7 library and
        # can break in later version of Python3. 
        try:
            file_id = dxpy.find_one_data_object(
                zero_ok=False,
                project=self.dx_project_id,
                name=filename)["id"]
        except dxpy.exceptions.DXSearchError as err:
            msg = "Picard alignment summary metrics for barcode {} in DX project {} not found.".format(barcode, self.dx_project_id)
            debug_logger.error(msg)
            raise DxMissingAlignmentSummaryMetrics(msg)
        fh = StringIO(dxpy.open_dxfile(file_id).read())
        asm = picard.CollectAlignmentSummaryMetrics(fh)
        return asm.metrics