# Path: modules/pepdata/common.py
# def _prepare_memoization_key(args, kwargs):
# def memoize(fn):
#     def wrapped_fn(*args, **kwargs):
# def int_or_seq(x):
# def dataframe_from_counts(counts):


import pandas as pd
from .common import bad_amino_acids, cache
        mask &= df.Peptide.str.len() == peptide_length
    if hla_type:
        mask &= df.Allele.str.contains(hla_type)
    if source_protein:
        mask &= df.Protein.str.contains(source_protein)
    return df[mask]

def load_tumor_set(*args, **kwargs):
    df = load_tumor(*args, **kwargs)
    return set(df.Peptide)


def load_virus(
        peptide_length=None,
        hla_type=None,
        source_protein=None,
        nrows=None):
    """
    Virus antigens.
    This data set is a list of 44 HLA-A2 restricted T cell epitopes,
    9 amino acids in length, derived from human medically important viruses.
    The epitopes were experimentally characterized based on immune recognition
    of HLA molecule and T cell stimulation. It could be used as a validation
    dataset for computational models to predict T cell epitopes.
    """
    path = cache.fetch(
        filename="virus_epitopes_A2.csv",
        download_url="http://bio.dfci.harvard.edu/DFRMLI/datasets/virus_epitopes_A2.htm",
        subdir="pepdata")
    df = pd.read_csv(path, skipinitialspace=True, nrows=nrows)

# Path: modules/pepdata/common.py
# def _prepare_memoization_key(args, kwargs):
# def memoize(fn):
#     def wrapped_fn(*args, **kwargs):
# def int_or_seq(x):
# def dataframe_from_counts(counts):


# Path: modules/pepdata/danafarber.py
import pandas as pd
from .common import bad_amino_acids, cache

        mask &= df.Peptide.str.len() == peptide_length
    if hla_type:
        mask &= df.Allele.str.contains(hla_type)
    if source_protein:
        mask &= df.Protein.str.contains(source_protein)
    return df[mask]

def load_tumor_set(*args, **kwargs):
    df = load_tumor(*args, **kwargs)
    return set(df.Peptide)


def load_virus(
        peptide_length=None,
        hla_type=None,
        source_protein=None,
        nrows=None):
    """
    Virus antigens.
    This data set is a list of 44 HLA-A2 restricted T cell epitopes,
    9 amino acids in length, derived from human medically important viruses.
    The epitopes were experimentally characterized based on immune recognition
    of HLA molecule and T cell stimulation. It could be used as a validation
    dataset for computational models to predict T cell epitopes.
    """
    path = cache.fetch(
        filename="virus_epitopes_A2.csv",
        download_url="http://bio.dfci.harvard.edu/DFRMLI/datasets/virus_epitopes_A2.htm",
        subdir="pepdata")
    df = pd.read_csv(path, skipinitialspace=True, nrows=nrows)

    mask = ~df.Epitope.str.contains(bad_amino_acids)