# Path: ssbio/databases/kegg.py
# class KEGGProp(SeqProp):
#     def __init__(self, seq, id, name='<unknown name>', description='<unknown description>',
#                  fasta_path=None, txt_path=None, gff_path=None):
#         SeqProp.__init__(self, id=id, seq=seq, name=name, description=description,
#                          sequence_path=fasta_path, metadata_path=txt_path, feature_path=gff_path)
#         self.kegg = id
# 
#     @SeqProp.metadata_path.setter
#     def metadata_path(self, m_path):
#         """Provide pointers to the paths of the metadata file
# 
#         Args:
#             m_path: Path to metadata file
# 
#         """
#         if not m_path:
#             self.metadata_dir = None
#             self.metadata_file = None
# 
#         else:
#             if not op.exists(m_path):
#                 raise OSError('{}: file does not exist!'.format(m_path))
# 
#             if not op.dirname(m_path):
#                 self.metadata_dir = '.'
#             else:
#                 self.metadata_dir = op.dirname(m_path)
#             self.metadata_file = op.basename(m_path)
# 
#             # TODO: update using Biopython's built in SeqRecord parser
#             # Just updating IDs and stuff
#             self.update(parse_kegg_gene_metadata(self.metadata_path), overwrite=True)
# 
#     def download_seq_file(self, outdir, force_rerun=False):
#         kegg_seq_file = download_kegg_aa_seq(gene_id=self.id,
#                                              outdir=outdir,
#                                              force_rerun=force_rerun)
#         if kegg_seq_file:
#             self.sequence_path = kegg_seq_file
#         else:
#             log.warning('{}: no sequence file available'.format(self.id))
# 
#     def download_metadata_file(self, outdir, force_rerun=False):
#         kegg_metadata_file = download_kegg_gene_metadata(gene_id=self.id,
#                                                          outdir=outdir,
#                                                          force_rerun=force_rerun)
#         if kegg_metadata_file:
#             self.metadata_path = kegg_metadata_file
#         else:
#             log.warning('{}: no metadata file available'.format(self.id))


import pytest
import os.path as op
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
from BCBio import GFF
from ssbio.databases.kegg import KEGGProp
    """Original SeqRecord loaded from sequence file"""
    return SeqIO.read(fasta_path, "fasta")

@pytest.fixture(scope='module')
def kegg_id():
    return 'mtu:Rv0417'

@pytest.fixture(scope='module')
def fasta_file():
    return 'mtu-Rv0417.faa'

@pytest.fixture(scope='module')
def txt_file():
    return 'mtu-Rv0417.kegg'

@pytest.fixture(scope='module')
def fasta_path(test_files_sequences, fasta_file):
    return op.join(test_files_sequences, fasta_file)

@pytest.fixture(scope='module')
def txt_path(test_files_sequences, txt_file):
    return op.join(test_files_sequences, txt_file)

@pytest.fixture(scope='class')
def keggprop_with_i(kegg_id):
    return KEGGProp(id=kegg_id,
                    seq=None)

@pytest.fixture(scope='class')
def keggprop_with_i_s_m_f(kegg_id, fasta_path, txt_path):

# Path: ssbio/databases/kegg.py
# class KEGGProp(SeqProp):
#     def __init__(self, seq, id, name='<unknown name>', description='<unknown description>',
#                  fasta_path=None, txt_path=None, gff_path=None):
#         SeqProp.__init__(self, id=id, seq=seq, name=name, description=description,
#                          sequence_path=fasta_path, metadata_path=txt_path, feature_path=gff_path)
#         self.kegg = id
# 
#     @SeqProp.metadata_path.setter
#     def metadata_path(self, m_path):
#         """Provide pointers to the paths of the metadata file
# 
#         Args:
#             m_path: Path to metadata file
# 
#         """
#         if not m_path:
#             self.metadata_dir = None
#             self.metadata_file = None
# 
#         else:
#             if not op.exists(m_path):
#                 raise OSError('{}: file does not exist!'.format(m_path))
# 
#             if not op.dirname(m_path):
#                 self.metadata_dir = '.'
#             else:
#                 self.metadata_dir = op.dirname(m_path)
#             self.metadata_file = op.basename(m_path)
# 
#             # TODO: update using Biopython's built in SeqRecord parser
#             # Just updating IDs and stuff
#             self.update(parse_kegg_gene_metadata(self.metadata_path), overwrite=True)
# 
#     def download_seq_file(self, outdir, force_rerun=False):
#         kegg_seq_file = download_kegg_aa_seq(gene_id=self.id,
#                                              outdir=outdir,
#                                              force_rerun=force_rerun)
#         if kegg_seq_file:
#             self.sequence_path = kegg_seq_file
#         else:
#             log.warning('{}: no sequence file available'.format(self.id))
# 
#     def download_metadata_file(self, outdir, force_rerun=False):
#         kegg_metadata_file = download_kegg_gene_metadata(gene_id=self.id,
#                                                          outdir=outdir,
#                                                          force_rerun=force_rerun)
#         if kegg_metadata_file:
#             self.metadata_path = kegg_metadata_file
#         else:
#             log.warning('{}: no metadata file available'.format(self.id))


# Path: ssbio/test/test_databases_kegg.py
import pytest
import os.path as op
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
from BCBio import GFF
from ssbio.databases.kegg import KEGGProp

    """Original SeqRecord loaded from sequence file"""
    return SeqIO.read(fasta_path, "fasta")

@pytest.fixture(scope='module')
def kegg_id():
    return 'mtu:Rv0417'

@pytest.fixture(scope='module')
def fasta_file():
    return 'mtu-Rv0417.faa'

@pytest.fixture(scope='module')
def txt_file():
    return 'mtu-Rv0417.kegg'

@pytest.fixture(scope='module')
def fasta_path(test_files_sequences, fasta_file):
    return op.join(test_files_sequences, fasta_file)

@pytest.fixture(scope='module')
def txt_path(test_files_sequences, txt_file):
    return op.join(test_files_sequences, txt_file)

@pytest.fixture(scope='class')
def keggprop_with_i(kegg_id):
    return KEGGProp(id=kegg_id,
                    seq=None)

@pytest.fixture(scope='class')
def keggprop_with_i_s_m_f(kegg_id, fasta_path, txt_path):

    return KEGGProp(id=kegg_id,