def to_yaml(self, path=None, subs_folder_path=None, delimiter="<STR_LIT:_>"):
<EOL>if not path:<EOL><INDENT>if not subs_folder_path:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".<EOL>format(self.__class__.__name__))<EOL><DEDENT>_LOGGER.debug("<STR_LIT>",<EOL>self.__class__.__name__, self.name)<EOL>filename = self.generate_filename(delimiter=delimiter)<EOL>_LOGGER.debug("<STR_LIT>", filename)<EOL>path = os.path.join(subs_folder_path, filename)<EOL><DEDENT>_LOGGER.debug("<STR_LIT>",<EOL>self.__class__.__name__, path)<EOL>self.yaml_file = path<EOL>def obj2dict(obj, name=None, <EOL>to_skip=(SAMPLE_SUBANNOTATIONS_KEY, "<STR_LIT>",<EOL>NAME_TABLE_ATTR, "<STR_LIT>")):<EOL><INDENT>"""<STR_LIT>"""<EOL>if name:<EOL><INDENT>_LOGGER.log(<NUM_LIT:5>, "<STR_LIT>".format(name))<EOL><DEDENT>if name == PRJ_REF:<EOL><INDENT>_LOGGER.debug("<STR_LIT>",<EOL>self.__class__.__name__)<EOL>prj_data = grab_project_data(obj)<EOL>_LOGGER.debug("<STR_LIT>".format(prj_data))<EOL>return {k: obj2dict(v, name=k) for k, v in prj_data.items()}<EOL><DEDENT>if isinstance(obj, list):<EOL><INDENT>return [obj2dict(i) for i in obj]<EOL><DEDENT>if isinstance(obj, AttMap):<EOL><INDENT>return {k: obj2dict(v, name=k) for k, v in obj.__dict__.items()<EOL>if k not in to_skip}<EOL><DEDENT>elif isinstance(obj, Mapping):<EOL><INDENT>return {k: obj2dict(v, name=k)<EOL>for k, v in obj.items() if k not in to_skip}<EOL><DEDENT>elif isinstance(obj, (Paths, Sample)):<EOL><INDENT>return {k: obj2dict(v, name=k)<EOL>for k, v in obj.__dict__.items() if<EOL>k not in to_skip}<EOL><DEDENT>elif isinstance(obj, Series):<EOL><INDENT>_LOGGER.warning("<STR_LIT>")<EOL>return obj.to_dict()<EOL><DEDENT>elif hasattr(obj, '<STR_LIT>'):  <EOL><INDENT>return obj.item()<EOL><DEDENT>elif isnull(obj):<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>return obj<EOL><DEDENT><DEDENT>_LOGGER.debug("<STR_LIT>",<EOL>self.__class__.__name__, self.name)<EOL>serial = obj2dict(self)<EOL>"""<STR_LIT>"""<EOL>with open(self.yaml_file, '<STR_LIT:w>') as outfile:<EOL><INDENT>_LOGGER.debug("<STR_LIT>",<EOL>self.__class__.__name__, self.name)<EOL>try:<EOL><INDENT>yaml_data = yaml.safe_dump(serial, default_flow_style=False)<EOL><DEDENT>except yaml.representer.RepresenterError:<EOL><INDENT>_LOGGER.error("<STR_LIT>".format(serial))<EOL>raise<EOL><DEDENT>outfile.write(yaml_data)<EOL><DEDENT>
Serializes itself in YAML format.

:param str path: A file path to write yaml to; provide this or
    the subs_folder_path
:param str subs_folder_path: path to folder in which to place file
    that's being written; provide this or a full filepath
:param str delimiter: text to place between the sample name and the
    suffix within the filename; irrelevant if there's no suffix
:return str: filepath used (same as input if given, otherwise the
    path value that was inferred)
:raises ValueError: if neither full filepath nor path to extant
    parent directory is provided.