Skip to content

Commit

Permalink
1.6.2 supports MSFragger-Glyco results
Browse files Browse the repository at this point in the history
And fixs some bugs.
  • Loading branch information
KaiLiCn committed Oct 7, 2020
1 parent a1564ee commit 778c021
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 228 deletions.
Binary file modified .DS_Store
Binary file not shown.
402 changes: 199 additions & 203 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion PDV.iml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.9" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.4" level="project" />
<orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.compomics:mascotdatfile:3.6.0" level="project" />
<orderEntry type="library" name="Maven: com.lowagie:itext:2.0.8" level="project" />
<orderEntry type="library" name="Maven: bouncycastle:bcmail-jdk14:138" level="project" />
Expand Down Expand Up @@ -127,7 +128,6 @@
<orderEntry type="library" name="Maven: io.github.msdk:msdk-io-mzxml:0.0.16" level="project" />
<orderEntry type="library" name="Maven: it.unimi.dsi:dsiutils:2.3.6" level="project" />
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.10" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" name="Maven: org.reactome.server.tools:analysis-core:3.3.0" level="project" />
<orderEntry type="library" name="Maven: org.reactome.server.graph:graph-core:1.1.19" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>PDV</groupId>
<artifactId>PDV</artifactId>
<packaging>jar</packaging>
<version>1.6.1</version>
<version>1.6.2</version>
<name>PDV</name>
<url>https://github.com/wenbostar/PDV</url>
<description>An integrative proteomics viewer</description>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/PDVCLI/MaxQuantImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ private void parseResults() throws IOException, MzMLUnmarshallerException {
if (!variableIndex.contains(index)) {
utilitiesModificationName = fixedModificationMap.get(aa) + " of " + aa;
utilitiesModifications.add(new ModificationMatch(utilitiesModificationName, true, index + 1));
} else {
} /**else {
if (Math.abs(expMass - spectrumMass) > 10) {
residues = new ArrayList<>();
residues.add(aa);
Expand All @@ -915,7 +915,7 @@ private void parseResults() throws IOException, MzMLUnmarshallerException {
}
}
}
}
}**/
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/PDVCLI/PDVCLIMainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import PDVCLI.utils.AddInformationPanel;
import PDVGUI.fileimport.MSOneImport;
import PDVGUI.fileimport.MzXMLScanImport;
import PDVGUI.gui.PDVMainClass;
import PDVGUI.gui.utils.TICPanel;
import PDVGUI.utils.Export;
import PDVGUI.utils.ImportPTMsFromUnimod;
import com.compomics.util.enumeration.ImageType;
import com.compomics.util.experiment.biology.*;
import com.compomics.util.experiment.biology.ions.PeptideFragmentIon;
Expand Down Expand Up @@ -240,6 +242,9 @@ private void runCMD(CommandLine commandLine, Options options) throws IOException

this.setVisible(true);

File inputFile = new File(PDVMainClass.getJarFilePath() + "/resources/conf/unimod.xml");
new ImportPTMsFromUnimod(inputFile);

if (commandLine.getOptionValue("rt") != null){
this.idFileType = Integer.valueOf(commandLine.getOptionValue("rt"));
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/PDVCLI/TextImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void parseTextFile() throws IOException {
ArrayList<String> residues = new ArrayList<>();
if(!modificationNames.equals("-")){
for (String singleModification: modificationNames.split(";")){
singleModificationName = singleModification.split("@")[0];
singleModificationName = singleModification.split("@")[0].replace(">", "&gt;");
modificationSite = Integer.valueOf(singleModification.split("@")[1].split("\\[")[0]);
modificationMass = Double.valueOf(singleModification.split("@")[1].split("\\[")[1].replace("]", ""));

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/PDVGUI/fileimport/FragePipeImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,13 @@ private void getParameters() throws IOException {
} else if (header.equalsIgnoreCase("Calculated M/Z")) {
caculatedMZIndex = i;
} else if (header.equalsIgnoreCase("Observed M/Z")) {
String columnName = header.trim().replace(" ", "");
if (columnName.matches(".*\\d+.*")){

columnName = "'" + columnName + "'";
}
columnName = columnName.replaceAll("[^a-zA-Z0-9]", "");
indexToName.put(i, columnName);
observedMZIndex = i;
} else if (header.equalsIgnoreCase("Assigned Modifications")) {
indexToName.put(i, header.trim().replace(" ", ""));
Expand Down
67 changes: 60 additions & 7 deletions src/main/java/PDVGUI/gui/PDVMainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import java.util.*;
import java.util.Date;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* Main class to start soft and show dataBase results
Expand Down Expand Up @@ -256,7 +258,7 @@ public class PDVMainClass extends JFrame {
/**
* Version
*/
private static final String VERSION = "1.6.1";
private static final String VERSION = "1.6.2";

/**
* Main class
Expand Down Expand Up @@ -1704,6 +1706,24 @@ public void run() {

buttonCheck();

ArrayList<String> columnName = new ArrayList<>();
columnName.addAll(scoreName);

columnToSelected = new HashMap<>();
for (String eachColumn: columnName){
columnToSelected.put(eachColumn, false);
}

ArrayList<String> showNames = (ArrayList<String>) Stream.of("SpectrumFile", "Peptide", "ModifiedPeptide", "Retention", "ObservedMass", "ObservedMZ", "CalculatedPeptideMass", "DeltaMass", "Expectation",
"Hyperscore", "Nextscore", "PeptideProphetProbability", "Protein", "Gene").collect(Collectors.toList());

for (String eachColumn: showNames){

if (scoreName.contains(eachColumn)){
columnToSelected.put(eachColumn, true);
}
}

sortColumnJCombox.setModel(new DefaultComboBoxModel(orderName.toArray()));

} catch (SQLException | ClassNotFoundException | IOException e) {
Expand Down Expand Up @@ -2407,7 +2427,45 @@ public void displayFrage(){
frageTableModel = new FrageTableModel(searchParameters, spectrumKeyToSelected, scoreName);
spectrumJTable.setModel(frageTableModel);

ArrayList<String> columnName = new ArrayList<>();
if (isDenovo) {
columnName.add("#Peaks");
columnName.add("N-Gap");
columnName.add("C-Gap");
columnName.add("Score");
} else if(!isFrage){
columnName.add("Other Assumption");
}
columnName.addAll(scoreName);
if(columnToSelected == null){
columnToSelected = new HashMap<>();
for (String eachColumn: columnName){
columnToSelected.put(eachColumn, true);
}
}

updateTable();

for (String key: columnToSelected.keySet()){
if(!columnToSelected.get(key)){
spectrumJTable.getColumn(key).setMinWidth(0);
spectrumJTable.getColumn(key).setMaxWidth(0);
} else {
for (int i = 0; i < 2; i++) {
if (key.equals("Other Assumption")) {
spectrumJTable.getColumn(key).setPreferredWidth(200);
spectrumJTable.getColumn(key).setMinWidth(20);
spectrumJTable.getColumn(key).setMaxWidth(400);
} else {
spectrumJTable.getColumn(key).setPreferredWidth(70);
spectrumJTable.getColumn(key).setMinWidth(20);
spectrumJTable.getColumn(key).setMaxWidth(400);
}
}
}
}
spectrumJTable.revalidate();
spectrumJTable.repaint();
}

/**
Expand Down Expand Up @@ -3260,12 +3318,7 @@ private void columnSelectionJMenuItemActionPerformed(ActionEvent evt){
columnName.add("Other Assumption");
}
columnName.addAll(scoreName);
if(columnToSelected == null){
columnToSelected = new HashMap<>();
for (String eachColumn: columnName){
columnToSelected.put(eachColumn, true);
}
}

new ColumnSelectionDialog(this, spectrumJTable, columnName);
}

Expand Down
102 changes: 89 additions & 13 deletions src/main/java/PDVGUI/gui/utils/SpectrumMainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ public class SpectrumMainPanel extends JPanel {
* Reward ions searched for (x, y or z)
*/
private Integer rewindIon = PeptideFragmentIon.Y_ION;
/**
* Forward ions list searched for (a, b or c)
*/
private ArrayList<Integer> forwardIons = new ArrayList();
/**
* Reward ions list searched for (x, y or z)
*/
private ArrayList<Integer> rewindIons = new ArrayList();
/**
* PTMFactory containing all modifications import from utilities
*/
Expand Down Expand Up @@ -528,8 +536,9 @@ private void initComponents(){
reporterIonsCheckMenuItem.addActionListener(this::reporterIonsCheckMenuItemAction);
otherMenu.add(reporterIonsCheckMenuItem);

glyconsCheckMenuItem.setSelected(true);
glyconsCheckMenuItem.setText("Glycon");
//glyconsCheckMenuItem.setSelected(true);
glyconsCheckMenuItem.setEnabled(false);
glyconsCheckMenuItem.setText("Glycan");
glyconsCheckMenuItem.setFont(menuFont);
glyconsCheckMenuItem.addActionListener(this::glyconsCheckMenuItemAction);
otherMenu.add(glyconsCheckMenuItem);
Expand Down Expand Up @@ -1573,8 +1582,24 @@ public void updateSpectrum(){
maxCharge = currentCharge;
}

sequenceFragmentationPanel = new SequenceFragmentationPanel(
modSequence, annotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
if (forwardIons.size() <= 1 && rewindIons.size() <= 1) {
if (forwardIons.size() != 0) {
forwardIon = forwardIons.get(0);
}

if (rewindIons.size() != 0) {
rewindIon = rewindIons.get(0);
}

sequenceFragmentationPanel = new SequenceFragmentationPanel(modSequence, annotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
sequenceFragmentationPanelMirror = new SequenceFragmentationPanel(
modSequence, annotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
} else {
sequenceFragmentationPanel = new SequenceFragmentationPanel(modSequence, annotations, true, searchParameters.getPtmSettings(), true);
sequenceFragmentationPanelMirror = new SequenceFragmentationPanel(
modSequence, annotations, true, searchParameters.getPtmSettings(), true);
}

sequenceFragmentationPanel.setOpaque(false);
sequenceFragmentationPanel.setBackground(Color.WHITE);

Expand All @@ -1593,8 +1618,6 @@ public void updateSpectrum(){
precursor.getMz(), spectrumIdentificationAssumption.getIdentificationCharge().toString(),
"", 40, false, false, false, 2, false, isDenovo);

sequenceFragmentationPanelMirror = new SequenceFragmentationPanel(
modSequence, annotations, true, searchParameters.getPtmSettings(), PeptideFragmentIon.B_ION, PeptideFragmentIon.Y_ION);
sequenceFragmentationPanelMirror.setMinimumSize(new Dimension(sequenceFragmentationPanelMirror.getPreferredSize().width, sequenceFragmentationPanelMirror.getHeight()));
sequenceFragmentationPanelMirror.setOpaque(false);
sequenceFragmentationPanelMirror.setBackground(Color.WHITE);
Expand Down Expand Up @@ -1624,9 +1647,21 @@ public void updateSpectrum(){

mirrorSpectrumPanel.setAnnotationsMirrored(SpectrumAnnotator.getSpectrumAnnotation(mirroredAnnotations));

mirrorFragmentPanel = new SequenceFragmentationPanel(
modSequence,
mirroredAnnotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
if (forwardIons.size() <= 1 && rewindIons.size() <= 1) {
if (forwardIons.size() != 0) {
forwardIon = forwardIons.get(0);
}

if (rewindIons.size() != 0) {
rewindIon = rewindIons.get(0);
}

mirrorFragmentPanel = new SequenceFragmentationPanel(
modSequence, mirroredAnnotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
} else {
mirrorFragmentPanel = new SequenceFragmentationPanel(
modSequence, mirroredAnnotations, true, searchParameters.getPtmSettings(), true);
}
mirrorFragmentPanel.setMinimumSize(new Dimension(mirrorFragmentPanel.getPreferredSize().width, mirrorFragmentPanel.getHeight()));
mirrorFragmentPanel.setOpaque(false);
mirrorFragmentPanel.setBackground(Color.WHITE);
Expand Down Expand Up @@ -1709,9 +1744,21 @@ public void updateSpectrum(){

checkPeptideSpectrumPanel.setAnnotationsMirrored(SpectrumAnnotator.getSpectrumAnnotation(checkAnnotations));

checkFragmentPanel = new SequenceFragmentationPanel(
checkModSequence,
checkAnnotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
if (forwardIons.size() <= 1 && rewindIons.size() <= 1) {
if (forwardIons.size() != 0) {
forwardIon = forwardIons.get(0);
}

if (rewindIons.size() != 0) {
rewindIon = rewindIons.get(0);
}

checkFragmentPanel = new SequenceFragmentationPanel(
checkModSequence, checkAnnotations, true, searchParameters.getPtmSettings(), forwardIon, rewindIon);
} else {
checkFragmentPanel = new SequenceFragmentationPanel(
checkModSequence, checkAnnotations, true, searchParameters.getPtmSettings(), true);
}
checkFragmentPanel.setMinimumSize(new Dimension(checkFragmentPanel.getPreferredSize().width, checkFragmentPanel.getHeight()));
checkFragmentPanel.setOpaque(false);
checkFragmentPanel.setBackground(Color.WHITE);
Expand Down Expand Up @@ -2026,13 +2073,29 @@ private void updateAnnotationMenus(int precursorCharge, ArrayList<ModificationMa
neutralLossHashMap.put(neutralLoss.name, neutralLoss);
}

int glycanProb = 0;

for (ModificationMatch modificationMatch : modificationMatches) {

NeutralLoss neutralLoss = getPhosphyNeutralLoss(modificationMatch);

if (neutralLoss != null){
neutralLossHashMap.put(neutralLoss.name, neutralLoss);
}

String name = modificationMatch.getTheoreticPtm();
String aa = name.split("of ")[1];
double mass = ptmFactory.getPTM(name).getMass();
if (aa.equals("N") & mass> 203){
glycanProb += 1;
}
}

if (glycanProb >= 1){
glyconsCheckMenuItem.setEnabled(true);
} else {
glyconsCheckMenuItem.setSelected(false);
glyconsCheckMenuItem.setEnabled(false);
}

for (ModificationMatch modificationMatch : checkPeptideModificationMatches) {
Expand Down Expand Up @@ -2146,7 +2209,11 @@ private void updateAnnotationMenus(int precursorCharge, ArrayList<ModificationMa
reporterIonsCheckMenuItem.setSelected(true);
break;
case GLYCAN:
glyconsCheckMenuItem.setSelected(true);
if (glycanProb >= 1){
glyconsCheckMenuItem.setSelected(true);
} else {
glyconsCheckMenuItem.setSelected(false);
}
case TAG_FRAGMENT_ION:
for (int subtype : ionTypes.get(ionType)) {
switch (subtype) {
Expand Down Expand Up @@ -2203,32 +2270,41 @@ private NeutralLoss getPhosphyNeutralLoss(ModificationMatch modificationMatch){
*/
private void updateAnnotationSettings() {

forwardIons = new ArrayList();
rewindIons = new ArrayList();

if (!defaultAnnotationCheckBoxMenuItem.isSelected()) {

specificAnnotationSettings.clearIonTypes();
if (forwardAIonCheckBoxMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(TAG_FRAGMENT_ION, TagFragmentIon.A_ION);
specificAnnotationSettings.addIonType(PEPTIDE_FRAGMENT_ION, PeptideFragmentIon.A_ION);
this.forwardIons.add(0);
}
if (forwardBIonCheckBoxMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(TAG_FRAGMENT_ION, TagFragmentIon.B_ION);
specificAnnotationSettings.addIonType(PEPTIDE_FRAGMENT_ION, PeptideFragmentIon.B_ION);
this.forwardIons.add(1);
}
if (forwardCIonCheckBoxMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(TAG_FRAGMENT_ION, TagFragmentIon.C_ION);
specificAnnotationSettings.addIonType(PEPTIDE_FRAGMENT_ION, PeptideFragmentIon.C_ION);
this.forwardIons.add(2);
}
if (rewardXIonCheckBoxMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(TAG_FRAGMENT_ION, TagFragmentIon.X_ION);
specificAnnotationSettings.addIonType(PEPTIDE_FRAGMENT_ION, PeptideFragmentIon.X_ION);
this.rewindIons.add(3);
}
if (rewardYIonCheckBoxMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(TAG_FRAGMENT_ION, TagFragmentIon.Y_ION);
specificAnnotationSettings.addIonType(PEPTIDE_FRAGMENT_ION, PeptideFragmentIon.Y_ION);
this.rewindIons.add(4);
}
if (rewardZIonCheckBoxMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(TAG_FRAGMENT_ION, TagFragmentIon.Z_ION);
specificAnnotationSettings.addIonType(PEPTIDE_FRAGMENT_ION, PeptideFragmentIon.Z_ION);
this.rewindIons.add(5);
}
if (precursorCheckMenuItem.isSelected()) {
specificAnnotationSettings.addIonType(PRECURSOR_ION);
Expand Down

0 comments on commit 778c021

Please sign in to comment.