Skip to content

Commit

Permalink
* Made export to Unipept fully functional
Browse files Browse the repository at this point in the history
* Added commons codecs v1.12 mvn dependency to pom.xml
* Updated to MPA version 1.9.1
  • Loading branch information
thilus committed Jul 4, 2019
1 parent 2c0a95b commit f7a646f
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 56 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,5 +349,10 @@
<artifactId>org-openide-util-lookup</artifactId>
<version>RELEASE110</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
</dependencies>
</project>
1 change: 0 additions & 1 deletion src/de/mpa/analysis/UnipeptAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class UnipeptAnalyzer {
public UnipeptAnalyzer(List<PeptideHit> peptideHits) {
for (PeptideHit peptideHit : peptideHits) {
peptideSequences.add(peptideHit.getSequence());
System.out.println(peptideHit.getSequence());
}
analyzeInUnipept(peptideSequences);
}
Expand Down
4 changes: 2 additions & 2 deletions src/de/mpa/client/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public class Constants {
/**
* The application version number.
*/
public final static String VER_NUMBER = "1.9.0";
public final static String VER_NUMBER = "1.9.1";

/**
* The application version date.
*/
public final static String VER_DATE = "06/2019";
public final static String VER_DATE = "07/2019";

/**
* The client frame minimum width in pixels.
Expand Down
30 changes: 16 additions & 14 deletions src/de/mpa/client/model/FileExperiment.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,22 @@ public DbSearchResult getSearchResult() {
File file = new File(filePath);
String pathname = file.getAbsolutePath();
// Check if reader already has the current experiment selected.
if (GenericContainer.MGFReaders.get(pathname) == null || !file.getName().equals(GenericContainer.MGFReaders.get(pathname).getFilename())) {
client.firePropertyChange("new message", null, "INDEXING SPECTRA");
try {
client.firePropertyChange("resetcur", -1L, file.length());
MascotGenericFileReader mgfReader = new MascotGenericFileReader(new File(pathname));

GenericContainer.SpectrumPosMap.put(pathname, mgfReader.getSpectrumPositions(false));
client.firePropertyChange("indeterminate", true, false);
client.firePropertyChange("new message", null, "INDEXING SPECTRA FINISHED");
mgfReader.setSpectrumPositions(GenericContainer.SpectrumPosMap.get(pathname));
GenericContainer.MGFReaders.put(pathname, mgfReader);
} catch (IOException e) {
e.printStackTrace();
Client.getInstance().firePropertyChange("new message", null, "INDEXING SPECTRA FAILED");
if (false) {
if (GenericContainer.MGFReaders.get(pathname) == null || !file.getName().equals(GenericContainer.MGFReaders.get(pathname).getFilename())) {
client.firePropertyChange("new message", null, "INDEXING SPECTRA");
try {
client.firePropertyChange("resetcur", -1L, file.length());
MascotGenericFileReader mgfReader = new MascotGenericFileReader(new File(pathname));

GenericContainer.SpectrumPosMap.put(pathname, mgfReader.getSpectrumPositions(false));
client.firePropertyChange("indeterminate", true, false);
client.firePropertyChange("new message", null, "INDEXING SPECTRA FINISHED");
mgfReader.setSpectrumPositions(GenericContainer.SpectrumPosMap.get(pathname));
GenericContainer.MGFReaders.put(pathname, mgfReader);
} catch (IOException e) {
e.printStackTrace();
Client.getInstance().firePropertyChange("new message", null, "INDEXING SPECTRA FAILED");
}
}
}
}
Expand Down
21 changes: 12 additions & 9 deletions src/de/mpa/client/model/dbsearch/DbSearchResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ public PeptideHit getPeptideHit(String sequence) {
}
return null;
}

/**
* Returns a list of all peptides found in the results (including duplicate entries).
* @return list of all peptides found in the results
*/
public List<PeptideHit> getAllPeptideHits() {
List<PeptideHit> peptideList = new ArrayList<PeptideHit>();
for (ProteinHit proteinHit : this.getProteinHits().values()) {
peptideList.addAll(proteinHit.getPeptideHitList());
}
return peptideList;
}

/**
* Returns the spectrum match for a particular search spectrum ID.
Expand Down Expand Up @@ -316,15 +328,6 @@ public int getDistinctPeptideCount() {
return this.getMetaProteins().getPeptideSet().size();
}

/**
* @return peptidelist
*/
public List<PeptideHit> getPeptideList() {
return new ArrayList<PeptideHit>(this.getMetaProteins().getPeptideSet());
//System.out.println(this.getMetaProteins().getPeptideList().toString());
//return this.visMetaProteins.getPeptideList();
}

/**
* Returns the number of peptides with PTMs.
* @return the number of modified peptides
Expand Down
29 changes: 0 additions & 29 deletions src/de/mpa/client/model/dbsearch/ProteinHitList.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public class ProteinHitList extends ArrayList<ProteinHit> implements Serializabl
* The set of spectrum matches with distinct search spectrum IDs.
*/
private Set<SpectrumMatch> matchSet;

/**
* The global list of peptides found within the search result.
*/
private List<PeptideHit> peptideList;

/**
* Flag to indicate whether the cached sets need to be regenerated.
Expand Down Expand Up @@ -143,19 +138,6 @@ public Set<PeptideHit> getPeptideSet() {
return peptideSet;
}

/**
* Utility method to return a list of peptide hits with all sequence
* strings - including duplicated peptides
* @return the peptide hit list
*/
public List<PeptideHit> getPeptideList() {
if (this.hasChanged) {
regenerateSets();
}

return peptideList;
}

/**
* Utility method to return a set of spectrum matches with distinct search
* spectrum IDs.
Expand All @@ -174,7 +156,6 @@ public Set<SpectrumMatch> getMatchSet() {
private void regenerateSets() {
proteinSet = new TreeSet<ProteinHit>();
peptideSet = new TreeSet<PeptideHit>();
peptideList = new ArrayList<PeptideHit>();
matchSet = new TreeSet<SpectrumMatch>();
if (!this.isEmpty()) {
// check whether this list contains meta-proteins or proteins
Expand All @@ -184,27 +165,17 @@ private void regenerateSets() {
MetaProteinHit metaProteinHit = (MetaProteinHit) proteinHit;
proteinSet.addAll(metaProteinHit.getProteinSet());
peptideSet.addAll(metaProteinHit.getPeptideSet());
peptideList.addAll(metaProteinHit.getPeptideHitList());
matchSet.addAll(metaProteinHit.getMatchSet());
// TODO: please also check whether we need this for unipept at all?
// Case check what happens once the user hits the "Process results" button for the meta-protein generation: is the peptide list still the same or do need to have an update here?

}
} else {
// this list contains protein hits
for (ProteinHit proteinHit : this) {
List<PeptideHit> peptideHitList = proteinHit.getPeptideHitList();
for (PeptideHit peptideHit : peptideHitList) {
matchSet.addAll(peptideHit.getSpectrumMatches());
//peptideList.add(peptideHit);
}
peptideSet.addAll(peptideHitList);
System.out.println(peptideSet.size());

peptideList.addAll(peptideHitList);
System.out.println(peptideList.size());
proteinSet.add(proteinHit);

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/de/mpa/client/ui/ClientFrameMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ private void exportCSV() {
private void exportUnipept() {
Client client = Client.getInstance();

UnipeptAnalyzer unipeptAnalyzer = new UnipeptAnalyzer(client.getDatabaseSearchResult().getPeptideList());
UnipeptAnalyzer unipeptAnalyzer = new UnipeptAnalyzer(client.getDatabaseSearchResult().getAllPeptideHits());
URI unipeptURI = unipeptAnalyzer.getUnipeptURI();

try {
Expand Down

0 comments on commit f7a646f

Please sign in to comment.