def relative_abundance(biomf, sampleIDs=None):
if sampleIDs is None:<EOL><INDENT>sampleIDs = biomf.ids()<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>for sid in sampleIDs:<EOL><INDENT>assert sid in biomf.ids()<EOL><DEDENT><DEDENT>except AssertionError:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>otuIDs = biomf.ids(axis="<STR_LIT>")<EOL>norm_biomf = biomf.norm(inplace=False)<EOL>return {sample: {otuID: norm_biomf.get_value_by_ids(otuID, sample)<EOL>for otuID in otuIDs} for sample in sampleIDs}<EOL>
Calculate the relative abundance of each OTUID in a Sample.

:type biomf: A BIOM file.
:param biomf: OTU table format.

:type sampleIDs: list
:param sampleIDs: A list of sample id's from BIOM format OTU table.

:rtype: dict
:return: Returns a keyed on SampleIDs, and the values are dictionaries keyed on
         OTUID's and their values represent the relative abundance of that OTUID in
         that SampleID.