Пример #1
0
def test_peptide_plan_add(data, peptide_length, expected_len, expected_data):
    plan = models.PeptidePlan(peptide_length)

    for tup in data:
        plan.add(tup)

    assert (len(plan) == expected_len)
    assert (plan.combinations == set(expected_data))
Пример #2
0
def peptide_plans(request):
    plan_tup = request.getfixturevalue(request.param)
    peptide_plan = models.PeptidePlan(plan_tup.length)

    for tup in plan_tup.reg_combos + plan_tup.cap_combos:
        peptide_plan.add(tup)

    return peptide_plan
    def generate(self, monomers, peptide_length, num_peptides):
        c_cap_monomers = self._get_c_cap_monomers(monomers)
        peptide_plan = models.PeptidePlan(peptide_length)

        self._create_minimum_list(monomers, c_cap_monomers, peptide_plan)
        self._create_remaining_list(monomers, c_cap_monomers, peptide_plan,
                                    num_peptides)

        return [peptide_plan]
Пример #4
0
def test_peptide_plan_iter(peptide_plan_data):
    data, peptide_length = peptide_plan_data
    plan = models.PeptidePlan(peptide_length)

    for tup in data:
        plan.add(tup)

    for combination in plan:
        assert (combination in data)
        data.remove(combination)
    def import_data(self, filepath, peptide_length):
        peptide_plan = models.PeptidePlan(peptide_length)

        num_lines_in_file = -1
        for i, line in enumerate(utils.load_text(filepath)):
            combo = tuple(map(int, line.strip('\n').split(',')))
            peptide_plan.add(combo)
            num_lines_in_file = i

        self._validate_peptide_plan(peptide_plan, num_lines_in_file)

        return self.saver.save([peptide_plan])
Пример #6
0
def test_peptide_plan_data(peptide_plan_data):
    data, peptide_length = peptide_plan_data
    plan = models.PeptidePlan(peptide_length)

    for tup in data:
        plan.add(tup)

    plan_data = plan.data()

    assert isinstance(plan_data, plan.PeptidePlanData)
    assert isinstance(plan_data.reg_combos, np.ndarray)
    assert isinstance(plan_data.cap_combos, np.ndarray)
    assert np.array_equal(plan_data.reg_combos, np.array([data[0]]))
    assert np.array_equal(plan_data.cap_combos, np.array([data[1]]))
    assert plan_data.length == peptide_length
Пример #7
0
def test_peptide_plan_add_fail(data, peptide_length):
    plan = models.PeptidePlan(peptide_length)

    with pytest.raises(RuntimeError):
        for tup in data:
            plan.add(tup)
Пример #8
0
def test_peptide_plan_constructor(length):
    plan = models.PeptidePlan(length)

    assert plan.reg_length == length
    assert plan.cap_length == length + 1