0
|
1 /**
|
|
2 *****************************************************************************
|
|
3 * <p>
|
|
4 * Copyright (c) Regents of the University of Minnesota. All Rights Reserved.
|
|
5 * <p>
|
|
6 * Author: Kevin Murray University of Minnesota - (murra668@umn.edu)
|
|
7 * <p>
|
|
8 *****************************************************************************
|
|
9 */
|
|
10 package kinamine;
|
|
11
|
|
12 import java.util.ArrayList;
|
|
13 import java.util.Arrays;
|
|
14 import java.util.List;
|
|
15
|
|
16 /**
|
|
17 * Peptide object representing the relevant information from the submitted
|
|
18 * peptide report. Stores the values necessary for writing a report formatted
|
|
19 * for existing Excel sheets.
|
|
20 *
|
|
21 * @version 1.0
|
|
22 * @author murra668
|
|
23 */
|
|
24 public class Peptide {
|
|
25
|
|
26 /** Sequence of peptide. */
|
|
27 String seq;
|
|
28
|
|
29 /** Accession of Protein associated with this peptide. */
|
|
30 List<String> id;
|
|
31
|
|
32 /** Full Accessions. */
|
|
33 String ref;
|
|
34
|
|
35 /** Motif of phospho-tyrosine. */
|
|
36 ArrayList<String> motif;
|
|
37
|
|
38 /** Index of phospho-tyrosine in the peptide sequence. */
|
|
39 ArrayList<Integer> tyrIndex;
|
|
40
|
|
41 /** Index of phospho-tyrosine in protein sequence. */
|
|
42 ArrayList<Integer> tyrProtIndex;
|
|
43
|
|
44 /** Length of peptide sequence. */
|
|
45 int length;
|
|
46
|
|
47 /**
|
|
48 * Constructs a Peptide object from the parsed peptide info from a line in
|
|
49 * the peptide report.
|
|
50 *
|
|
51 * @param pepInfo tab-separated line of peptide info
|
|
52 * @param ids
|
|
53 */
|
|
54 public Peptide(String[] pepInfo, List ids) {
|
|
55
|
|
56 /** Store sequence */
|
|
57 this.seq = pepInfo[8];
|
|
58
|
|
59 /** Store sequence length. */
|
|
60 this.length = pepInfo[8].length();
|
|
61
|
|
62 /** Initialize empty motif array. */
|
|
63 this.motif = new ArrayList<>();
|
|
64
|
|
65 /** Extract peptide references. */
|
|
66 this.id = ids;
|
|
67 this.ref = pepInfo[3];
|
|
68
|
|
69 /** Store the index of phospho-tyrosine of the peptide and protein. */
|
|
70 this.tyrIndex = getIndex(pepInfo[9]);
|
|
71 this.tyrProtIndex = getIndex(pepInfo[10]);
|
|
72 }
|
|
73
|
|
74 /**
|
|
75 * Gets the index of the phospho-tyrosine in the peptide and corresponding
|
|
76 * protein, as indicated by the modification column of the peptide report.
|
|
77 * There may be more than one phospho-tyr within a peptide.
|
|
78 * <p>
|
|
79 * Location formatted as Phospho(Y)@index.
|
|
80 *
|
|
81 * @param mods string of mod locations
|
|
82 * @return ArrayList of integers.
|
|
83 */
|
|
84 private ArrayList<Integer> getIndex(String mods) {
|
|
85
|
|
86 /** Modifications are separated by ';'. */
|
|
87 List<String> psm = Arrays.asList(mods.split(";"));
|
|
88
|
|
89 /** Initialize new index array. */
|
|
90 ArrayList<Integer> index = new ArrayList<>();
|
|
91
|
|
92 /** Check all modifications. */
|
|
93 for (int i = 0; i < psm.size(); i++) {
|
|
94
|
|
95 /** Check if phospho-tyr. */
|
|
96 if (psm.get(i).contains("Phospho(Y)")) {
|
|
97
|
|
98 /** Trim for correct indexing. */
|
|
99 String mod = psm.get(i).trim();
|
|
100
|
|
101 /** Add to index array */
|
|
102 index.add(Integer.valueOf(mod.substring(11)));
|
|
103 }
|
|
104 }
|
|
105
|
|
106 return index;
|
|
107
|
|
108 }
|
|
109 }
|