def __init_taxonomy_from_lineages(self, taxonomy_series: pd.Series, taxonomy_notation: Optional[str], order_ranks: Optional[Sequence[str]]) -> pd.DataFrame:
    "Main method that produces taxonomy dataframe from lineages.\n\n        Parameters\n        ----------\n        taxonomy_series\n            :class:`pandas.Series` with taxonomy lineages\n        taxonomy_notation\n            Taxonomy lineage notation style. Can be one of :const:`pmaf.internals._constants.AVAIL_TAXONOMY_NOTATIONS`\n        order_ranks\n            List with the target rank order. Default is set to None. The 'silva' notation require `order_ranks`.\n        "
    if (taxonomy_notation in AVAIL_TAXONOMY_NOTATIONS):
        notation = taxonomy_notation
    else:
        sample_taxon = taxonomy_series.iloc[0]
        notation = indentify_taxon_notation(sample_taxon)
    if (order_ranks is not None):
        if all([(rank in VALID_RANKS) for rank in order_ranks]):
            target_order_ranks = order_ranks
        else:
            raise NotImplementedError
    else:
        target_order_ranks = VALID_RANKS
    if (notation == 'greengenes'):
        lineages = taxonomy_series.reset_index().values.tolist()
        ordered_taxa_list = []
        ordered_indices_list = [elem[0] for elem in lineages]
        for lineage in lineages:
            tmp_lineage = jRegexGG.findall(lineage[1])
            tmp_taxa_dict = {elem[0]: elem[1] for elem in tmp_lineage if (elem[0] in VALID_RANKS)}
            for rank in VALID_RANKS:
                if (rank not in tmp_taxa_dict.keys()):
                    tmp_taxa_dict.update({rank: None})
            tmp_taxa_ordered = [tmp_taxa_dict[rank] for rank in VALID_RANKS]
            ordered_taxa_list.append(([None] + tmp_taxa_ordered))
        taxonomy = pd.DataFrame(index=ordered_indices_list, data=ordered_taxa_list, columns=(['lineage'] + VALID_RANKS))
        return taxonomy
    elif (notation == 'qiime'):
        lineages = taxonomy_series.reset_index().values.tolist()
        tmp_taxa_dict_list = []
        tmp_ranks = set()
        for lineage in lineages:
            tmp_lineage = jRegexQIIME.findall(lineage[1])
            tmp_lineage.sort(key=(lambda x: x[0]))
            tmp_taxa_dict = defaultdict(None)
            tmp_taxa_dict[None] = lineage[0]
            for (rank, taxon) in tmp_lineage:
                tmp_taxa_dict[rank] = taxon
                tmp_ranks.add(rank)
            tmp_taxa_dict_list.append(dict(tmp_taxa_dict))
        tmp_taxonomy_df = pd.DataFrame.from_records(tmp_taxa_dict_list)
        tmp_taxonomy_df.set_index(None, inplace=True)
        tmp_taxonomy_df = tmp_taxonomy_df.loc[:, sorted(list(tmp_ranks))]
        tmp_taxonomy_df.columns = [rank for rank in target_order_ranks[::(- 1)][:len(tmp_ranks)]][::(- 1)]
        for rank in VALID_RANKS:
            if (rank not in tmp_taxonomy_df.columns):
                tmp_taxonomy_df.loc[:, rank] = None
        return tmp_taxonomy_df
    elif (notation == 'silva'):
        lineages = taxonomy_series.reset_index().values.tolist()
        tmp_taxa_dict_list = []
        tmp_ranks = set()
        for lineage in lineages:
            tmp_lineage = lineage[1].split(';')
            tmp_taxa_dict = defaultdict(None)
            tmp_taxa_dict[None] = lineage[0]
            for (rank_i, taxon) in enumerate(tmp_lineage):
                rank = target_order_ranks[rank_i]
                tmp_taxa_dict[rank] = taxon
                tmp_ranks.add(rank)
            tmp_taxa_dict_list.append(dict(tmp_taxa_dict))
        tmp_taxonomy_df = pd.DataFrame.from_records(tmp_taxa_dict_list)
        tmp_taxonomy_df.set_index(None, inplace=True)
        tmp_rank_ordered = [rank for rank in target_order_ranks if (rank in VALID_RANKS)]
        tmp_taxonomy_df = tmp_taxonomy_df.loc[:, tmp_rank_ordered]
        tmp_taxonomy_df.columns = [rank for rank in target_order_ranks[::(- 1)][:len(tmp_ranks)]][::(- 1)]
        for rank in VALID_RANKS:
            if (rank not in tmp_taxonomy_df.columns):
                tmp_taxonomy_df.loc[:, rank] = None
        return tmp_taxonomy_df
    else:
        raise NotImplementedError
Main method that produces taxonomy dataframe from lineages.

Parameters
----------
taxonomy_series
    :class:`pandas.Series` with taxonomy lineages
taxonomy_notation
    Taxonomy lineage notation style. Can be one of :const:`pmaf.internals._constants.AVAIL_TAXONOMY_NOTATIONS`
order_ranks
    List with the target rank order. Default is set to None. The 'silva' notation require `order_ranks`.
def __init_taxonomy_from_lineages(self, taxonomy_series: pd.Series, taxonomy_notation: Optional[str], order_ranks: Optional[Sequence[str]]) -> pd.DataFrame:
    "Main method that produces taxonomy dataframe from lineages.\n\n        Parameters\n        ----------\n        taxonomy_series\n            :class:`pandas.Series` with taxonomy lineages\n        taxonomy_notation\n            Taxonomy lineage notation style. Can be one of :const:`pmaf.internals._constants.AVAIL_TAXONOMY_NOTATIONS`\n        order_ranks\n            List with the target rank order. Default is set to None. The 'silva' notation require `order_ranks`.\n        "
    if (taxonomy_notation in AVAIL_TAXONOMY_NOTATIONS):
        notation = taxonomy_notation
    else:
        sample_taxon = taxonomy_series.iloc[0]
        notation = indentify_taxon_notation(sample_taxon)
    if (order_ranks is not None):
        if all([(rank in VALID_RANKS) for rank in order_ranks]):
            target_order_ranks = order_ranks
        else:
            raise NotImplementedError
    else:
        target_order_ranks = VALID_RANKS
    if (notation == 'greengenes'):
        lineages = taxonomy_series.reset_index().values.tolist()
        ordered_taxa_list = []
        ordered_indices_list = [elem[0] for elem in lineages]
        for lineage in lineages:
            tmp_lineage = jRegexGG.findall(lineage[1])
            tmp_taxa_dict = {elem[0]: elem[1] for elem in tmp_lineage if (elem[0] in VALID_RANKS)}
            for rank in VALID_RANKS:
                if (rank not in tmp_taxa_dict.keys()):
                    tmp_taxa_dict.update({rank: None})
            tmp_taxa_ordered = [tmp_taxa_dict[rank] for rank in VALID_RANKS]
            ordered_taxa_list.append(([None] + tmp_taxa_ordered))
        taxonomy = pd.DataFrame(index=ordered_indices_list, data=ordered_taxa_list, columns=(['lineage'] + VALID_RANKS))
        return taxonomy
    elif (notation == 'qiime'):
        lineages = taxonomy_series.reset_index().values.tolist()
        tmp_taxa_dict_list = []
        tmp_ranks = set()
        for lineage in lineages:
            tmp_lineage = jRegexQIIME.findall(lineage[1])
            tmp_lineage.sort(key=(lambda x: x[0]))
            tmp_taxa_dict = defaultdict(None)
            tmp_taxa_dict[None] = lineage[0]
            for (rank, taxon) in tmp_lineage:
                tmp_taxa_dict[rank] = taxon
                tmp_ranks.add(rank)
            tmp_taxa_dict_list.append(dict(tmp_taxa_dict))
        tmp_taxonomy_df = pd.DataFrame.from_records(tmp_taxa_dict_list)
        tmp_taxonomy_df.set_index(None, inplace=True)
        tmp_taxonomy_df = tmp_taxonomy_df.loc[:, sorted(list(tmp_ranks))]
        tmp_taxonomy_df.columns = [rank for rank in target_order_ranks[::(- 1)][:len(tmp_ranks)]][::(- 1)]
        for rank in VALID_RANKS:
            if (rank not in tmp_taxonomy_df.columns):
                tmp_taxonomy_df.loc[:, rank] = None
        return tmp_taxonomy_df
    elif (notation == 'silva'):
        lineages = taxonomy_series.reset_index().values.tolist()
        tmp_taxa_dict_list = []
        tmp_ranks = set()
        for lineage in lineages:
            tmp_lineage = lineage[1].split(';')
            tmp_taxa_dict = defaultdict(None)
            tmp_taxa_dict[None] = lineage[0]
            for (rank_i, taxon) in enumerate(tmp_lineage):
                rank = target_order_ranks[rank_i]
                tmp_taxa_dict[rank] = taxon
                tmp_ranks.add(rank)
            tmp_taxa_dict_list.append(dict(tmp_taxa_dict))
        tmp_taxonomy_df = pd.DataFrame.from_records(tmp_taxa_dict_list)
        tmp_taxonomy_df.set_index(None, inplace=True)
        tmp_rank_ordered = [rank for rank in target_order_ranks if (rank in VALID_RANKS)]
        tmp_taxonomy_df = tmp_taxonomy_df.loc[:, tmp_rank_ordered]
        tmp_taxonomy_df.columns = [rank for rank in target_order_ranks[::(- 1)][:len(tmp_ranks)]][::(- 1)]
        for rank in VALID_RANKS:
            if (rank not in tmp_taxonomy_df.columns):
                tmp_taxonomy_df.loc[:, rank] = None
        return tmp_taxonomy_df
    else:
        raise NotImplementedError