Skip to content

Commit

Permalink
Delete unused methods. The DbTool will be replace by my library in th…
Browse files Browse the repository at this point in the history
…e future.
  • Loading branch information
fcyu committed Mar 10, 2018
1 parent 7251047 commit 24e559b
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/main/java/proteomics/TheoSeq/DbTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,42 +82,4 @@ public Map<String, String> getProSeqMap() {
public Map<String, String> getProAnnotateMap() {
return pro_annotate_map;
}

public Set<Integer> findPeptideLocation(String proteinId, String peptide) throws NullPointerException {
peptide = peptide.trim().replaceAll("[^A-Z]+", "");
Set<Integer> output = new HashSet<>();
int idx = pro_seq_map.get(proteinId).indexOf(peptide);
while (idx >= 0) {
output.add(idx);
idx = pro_seq_map.get(proteinId).indexOf(peptide, idx + 1);
}
if (!output.isEmpty()) {
return output;
} else {
throw new NullPointerException(String.format(Locale.US, "Cannot find the peptide %s from the protein %s.", peptide, proteinId));
}
}

public static Set<String> reduceProteinIdSet(Set<String> input) {
if (input.size() == 1) {
return input;
} else {
Map<String, Integer> tempMap = new HashMap<>();
for (String s : input) {
String[] tempArray = s.split("\\.");
if (tempMap.containsKey(tempArray[0])) {
if (tempMap.get(tempArray[0]) > Integer.valueOf(tempArray[1])) {
tempMap.put(tempArray[0], Integer.valueOf(tempArray[1]));
}
} else {
tempMap.put(tempArray[0], Integer.valueOf(tempArray[1]));
}
}
Set<String> output = new HashSet<>();
for (String s : tempMap.keySet()) {
output.add(s + "." + tempMap.get(s));
}
return output;
}
}
}

0 comments on commit 24e559b

Please sign in to comment.