diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KinaMine-Galaxy-7-7/src/kinamine/Peptide.java	Tue Feb 20 14:31:15 2018 -0500
@@ -0,0 +1,109 @@
+/**
+ *****************************************************************************
+ * <p>
+ * Copyright (c) Regents of the University of Minnesota. All Rights Reserved.
+ * <p>
+ * Author: Kevin Murray University of Minnesota - (murra668@umn.edu)
+ * <p>
+ *****************************************************************************
+ */
+package kinamine;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Peptide object representing the relevant information from the submitted
+ * peptide report. Stores the values necessary for writing a report formatted
+ * for existing Excel sheets.
+ *
+ * @version 1.0
+ * @author murra668
+ */
+public class Peptide {
+    
+    /** Sequence of peptide. */
+    String seq;
+    
+    /** Accession of Protein associated with this peptide. */
+    List<String> id;
+     
+    /** Full Accessions. */
+    String ref;
+
+    /** Motif of phospho-tyrosine. */
+    ArrayList<String> motif;
+
+    /** Index of phospho-tyrosine in the peptide sequence. */
+    ArrayList<Integer> tyrIndex;
+
+    /** Index of phospho-tyrosine in protein sequence. */
+    ArrayList<Integer> tyrProtIndex;
+
+    /** Length of peptide sequence. */
+    int length;
+
+    /**
+     * Constructs a Peptide object from the parsed peptide info from a line in
+     * the peptide report.
+     *
+     * @param pepInfo tab-separated line of peptide info
+     * @param ids
+     */
+    public Peptide(String[] pepInfo, List ids) {
+         
+        /** Store sequence */
+        this.seq = pepInfo[8];
+
+        /** Store sequence length. */
+        this.length = pepInfo[8].length();
+
+        /** Initialize empty motif array. */
+        this.motif = new ArrayList<>();
+
+        /** Extract peptide references. */
+        this.id = ids;     
+        this.ref = pepInfo[3];
+
+        /** Store the index of phospho-tyrosine of the peptide and protein. */
+        this.tyrIndex = getIndex(pepInfo[9]);
+        this.tyrProtIndex = getIndex(pepInfo[10]);
+    }
+
+    /**
+     * Gets the index of the phospho-tyrosine in the peptide and corresponding
+     * protein, as indicated by the modification column of the peptide report.
+     * There may be more than one phospho-tyr within a peptide.
+     * <p>
+     * Location formatted as Phospho(Y)@index.
+     *
+     * @param mods string of mod locations
+     * @return ArrayList of integers.
+     */
+    private ArrayList<Integer> getIndex(String mods) {
+
+        /** Modifications are separated by ';'. */
+        List<String> psm = Arrays.asList(mods.split(";"));
+
+        /** Initialize new index array. */
+        ArrayList<Integer> index = new ArrayList<>();
+
+        /** Check all modifications. */
+        for (int i = 0; i < psm.size(); i++) {
+
+            /** Check if phospho-tyr. */
+            if (psm.get(i).contains("Phospho(Y)")) {
+
+                /** Trim for correct indexing. */
+                String mod = psm.get(i).trim();
+
+                /** Add to index array */
+                index.add(Integer.valueOf(mod.substring(11)));
+            }
+        }
+
+        return index;
+
+    }
+}