コード例 #1
0
 def test_tostring(self):
     for seq in self.simple_sequences:
         self.assertEqual(
             seq, parser.tostring(parser.parse(seq, labels=uppercase)))
         self.assertEqual(
             seq,
             parser.tostring(
                 parser.parse(seq, True, True, labels=uppercase), False))
コード例 #2
0
ファイル: main.web.py プロジェクト: bschulzlab/DIALib
def generate_Yion(Ytype, aa_mass, ion_maxcharge, ion_type, labels, temp):
    str_seq = parser.tostring(temp, False)
    for m in range(ion_maxcharge):
        if "Y" in ion_type:
            yield Ion(seq=temp, charge=m + 1, ion_type="Y",
                      mz=mass.fast_mass2(str_seq, charge=m + 1, aa_mass=aa_mass, labels=labels),
                      fragment_number=int(Ytype[1:]) + 1)
コード例 #3
0
ファイル: main.web.py プロジェクト: bschulzlab/DIALib
def generate_byion(aa_mass, b_stop_at, ion_maxcharge, ion_type, labels, seq_len, temp, y_stop_at, b_selected, y_selected):
    for s in range(seq_len):
        if not (s + 1) == 1:
            for m in range(ion_maxcharge):
                for ion in ion_type:
                    if ion == "y":
                        position = seq_len - s - 1
                        if y_stop_at > -1:
                            if position <= y_stop_at:
                                continue
                        if y_selected:
                            if position in y_selected:
                                seq = temp[position:]
                                str_seq = parser.tostring(seq, False)
                                # print(str_seq)
                                yield Ion(seq=temp, ion_type=ion, charge=m + 1,
                                          mz=mass.fast_mass2(str_seq, ion_type=ion, charge=m + 1, aa_mass=aa_mass,
                                                             labels=labels), fragment_number=s + 1)
                        else:
                            seq = temp[position:]
                            str_seq = parser.tostring(seq, False)
                            # print(str_seq)
                            yield Ion(seq=temp, ion_type=ion, charge=m + 1,
                                      mz=mass.fast_mass2(str_seq, ion_type=ion, charge=m + 1, aa_mass=aa_mass,
                                                         labels=labels), fragment_number=s + 1)
                    elif ion == "b":
                        position = s + 1
                        if position == seq_len:
                            continue
                        if b_stop_at > -1:
                            if position > b_stop_at:
                                continue
                        if b_selected:
                            if s in b_selected:
                                seq = temp[:position]
                                str_seq = parser.tostring(seq, False)
                                # print(str_seq)
                                yield Ion(seq=temp, ion_type=ion, charge=m + 1,
                                          mz=mass.fast_mass2(str_seq, ion_type=ion, charge=m + 1, aa_mass=aa_mass,
                                                             labels=labels), fragment_number=s + 1)
                        else:
                            seq = temp[:position]
                            str_seq = parser.tostring(seq, False)
                            # print(str_seq)
                            yield Ion(seq=temp, ion_type=ion, charge=m + 1,
                                      mz=mass.fast_mass2(str_seq, ion_type=ion, charge=m + 1, aa_mass=aa_mass,
                                                         labels=labels), fragment_number=s + 1)
コード例 #4
0
ファイル: main.web.py プロジェクト: AspirinCode/DIALib
def fragmenting(i,
                rec,
                ms,
                mv,
                query_unique,
                protein_id,
                unique_q3=None,
                y=None):
    labels, aa_mass, seq = prepare_libraries(i['_protein']['_sequence'],
                                             static=ms,
                                             variable=mv)
    seq_len = len(seq)
    result = []
    msMap = {m['label']: m['m_label'] for m in ms}

    for f in generate_fragments(seq[:], static=ms, variable=mv):
        # print(f)
        new_seq = parser.tostring(f, False)
        print('Current: ' + new_seq)
        precursor_mz = mass.fast_mass2(new_seq,
                                       charge=i['_precursor_charge'],
                                       aa_mass=aa_mass,
                                       labels=labels)
        variable = ''

        for r in i['_rt']:
            for ion in fragments_by(aa_mass,
                                    i['_charge'],
                                    i['_protein']['_ion_type'],
                                    labels,
                                    seq_len,
                                    f,
                                    mv,
                                    Ytype=y,
                                    b_stop_at=i['_b_stop_at'],
                                    y_stop_at=i['_y_stop_at'],
                                    by_static=i['_by_run'],
                                    b_selected=i['_b_selected'],
                                    y_selected=i['_y_selected']):
                create_row(f, i, ion, msMap, mv, precursor_mz, query_unique, r,
                           rec, result, seq, seq_len, unique_q3, variable,
                           protein_id)

    return result, query_unique