annotate KinaMine-Galaxy-7-7/src/kinamine/Peptide.java @ 0:67635b462045 draft

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