Skip to content
Snippets Groups Projects
Commit 6577611d authored by Olivier Langella's avatar Olivier Langella
Browse files

PAI computing method checked

All PAI computed in xtp are using the same method : number of spectrums from valid peptides divided by the theoretical number of tryptic peptides
parent 1f8f27c0
No related branches found
No related tags found
No related merge requests found
......@@ -120,17 +120,69 @@ public class Match implements Comparable<Match>, GrpProtMatch {
return (samples);
}
public int get_spectra_numbers_to(MsRun samp) throws MSMSException {
/**
* count number of spectra coming from one MsRun (MS sample)
*
* @param samp
* the sample to count spectra from
* @return
* @throws MSMSException
*/
private int getSpectraNumberIn(MsRun samp) throws MSMSException {
int i = 0;
for (Peptide pep : peptides_match.values()) {
if (pep.getMsRun().equals(samp))
if (pep.isValidate()) {
if (pep.getMsRun().equals(samp)) {
i++;
}
}
}
return (i);
}
/**
* count number of spectra in this match
*
* @return integer number of spectra
* @throws MSMSException
*/
private int getSpectraNumber() {
int i = 0;
for (Peptide pep : peptides_match.values()) {
if (pep.isValidate()) {
i++;
}
}
return (i);
}
public int get_spectra_numbers() {
return (this.peptides_match.size());
/**
* compute the Protein Abundance Index (PAI)
*
* @return
*/
public double getPAI() {
// compute PAI
double value = (double) this.getSpectraNumber()
/ (double) this.get_protein_match()
.getNumberOfTrypticPeptidesForPAI();
return value;
}
/**
* compute the Protein Abundance Index (PAI) within an MsRun
*
* @return
*/
public double getPAIbyMsRun(MsRun samp) throws MSMSException {
// compute PAI
double value = (double) this.getSpectraNumberIn(samp)
/ (double) this.get_protein_match()
.getNumberOfTrypticPeptidesForPAI();
return value;
}
public int get_unique_valid_peptide_number_to(MsRun samp)
......@@ -161,8 +213,8 @@ public class Match implements Comparable<Match>, GrpProtMatch {
}
public ArrayList<Peptide> get_peptide_order() {
ArrayList<Peptide> peptides = new ArrayList<Peptide>(peptides_match
.values());
ArrayList<Peptide> peptides = new ArrayList<Peptide>(
peptides_match.values());
Collections.sort(peptides);
return (peptides);
}
......
......@@ -33,7 +33,7 @@ public class Protein implements GrpProtein {
private String dbxref_type;
private String dbxref_accession;
private boolean isReversed;
// constructeur
......@@ -70,10 +70,10 @@ public class Protein implements GrpProtein {
logger.debug("Corrected reverse protein description");
this.description = S.replaceFirst("\\:reversed$", "");
this.setReversed(true);
} else if(S.split(" ")[0].matches(".*\\|reversed$")){
this.isReversed=true;
} else if (S.split(" ")[0].matches(".*\\|reversed$")) {
this.isReversed = true;
this.description = S;
}else
} else
this.description = S;
this.search_dbxref();
// logger.debug("set_description end");
......@@ -115,10 +115,6 @@ public class Protein implements GrpProtein {
return (mw);
}
public int get_PAI_count() {
return (PAI_count);
}
public String get_description() {
return (description);
}
......@@ -215,6 +211,12 @@ public class Protein implements GrpProtein {
}
/**
* get the theoretical number of tryptic peptides between 800 and 2500
* Daltons for one protein
*
* @return integer number of possible tryptic peptides
*/
private int determined_PAI_count() {
int count = 0;
Hashtable<String, String> aa = new Hashtable<String, String>();
......@@ -326,13 +328,18 @@ public class Protein implements GrpProtein {
public boolean isReversed() {
return isReversed;
}
public void setReversed(boolean rev) {
this.isReversed=rev;
//forced reverse annotation on protein accession
if(isReversed){
this.isReversed = rev;
// forced reverse annotation on protein accession
if (isReversed) {
this.description = description.replaceFirst(" ", "|reversed ");
}
}
@Override
public int getNumberOfTrypticPeptidesForPAI() {
return this.PAI_count;
}
}
......@@ -80,8 +80,8 @@ public class swt_table_protein extends swt_table_base {
if (filter.equals(""))
is_filter = true;
else {
test = pattern.matcher(((Match)hashProt.getGrpProtMatch())
.get_protein_match().get_description());
test = pattern.matcher(((Match) hashProt.getGrpProtMatch())
.get_protein_match().get_description());
if (test.matches())
is_filter = true;
// if (hashProt.getMatch().get_protein_match()
......@@ -122,7 +122,8 @@ public class swt_table_protein extends swt_table_base {
int contain_multi = 0;
for (HashSampleScan hash : phospho) {
if (phospho.getGrpProtMatch()
.getBestPeptideToHashSampleScan(hash).getGrpPhosphoModifs().size() > 1) {
.getBestPeptideToHashSampleScan(hash)
.getGrpPhosphoModifs().size() > 1) {
contain_multi++;
}
}
......@@ -145,8 +146,7 @@ public class swt_table_protein extends swt_table_base {
}
item.setText(6,
"" + hashProt.getUniquePeptideHashSampleScan());
item.setText(7, "" + (float) hashProt.size()
/ top.get_protein_match().get_PAI_count());
item.setText(7, "" + (float) hashProt.getPAI());
}
if (!color)
item.setBackground(table.getDisplay().getSystemColor(
......
......@@ -148,4 +148,34 @@ public class HashSampleScanSetProt extends HashSampleScanSet {
}
return (grpMsSampleList);
}
/**
* compute the Protein Abundance Index (PAI)
*
* @return
*/
public double getPAI() {
// compute PAI
double value = (double) this.getTotalHashSampleScan()
/ (double) this.match.getGrpProtein()
.getNumberOfTrypticPeptidesForPAI();
return value;
}
/**
* compute the Protein Abundance Index (PAI) within an MsRun
*
* @return
*/
public double getPAIbyMsRun(GrpMsSample samp) throws MSMSException {
// compute PAI
double value = (double) getTotalHashSampleScantoMsRun(samp)
/ (double) this.match.getGrpProtein()
.getNumberOfTrypticPeptidesForPAI();
return value;
}
}
......@@ -3,8 +3,10 @@ package fr.inra.pappso.xtandempipeline.grouping.interfaces;
public interface GrpProtein extends Comparable<GrpProtein> {
String getAccession();
@Override
public int compareTo(GrpProtein arg0);
public int getNumberOfTrypticPeptidesForPAI();
}
......@@ -467,11 +467,12 @@ public class ProticDbMlWriter {
+ XtandemPipelineSession.getInstance().getConfig()
.get_peptide_evalue(),
"X!TandemPipeline filter on peptide evalue");
//TODO write database filter
//this.writeCvParam("PROTICdbO:0000324", ""
// + XtandemPipelineSession.getInstance().getConfig().get_database_filter(),
// "X!TandemPipeline filter on peptide evalue");
// TODO write database filter
// this.writeCvParam("PROTICdbO:0000324", ""
// +
// XtandemPipelineSession.getInstance().getConfig().get_database_filter(),
// "X!TandemPipeline filter on peptide evalue");
writer.writeEndElement();// processingMethod
......@@ -766,7 +767,7 @@ public class ProticDbMlWriter {
// id: PROTICdbO:0000335
// name: X!TandemPipeline PAI
this.writeCvParam("PROTICdbO:0000335",
"" + prot.get_PAI_count(), "PAI");
"" + hashProt.getPAI(), "PAI");
// [Term]
// id: PROTICdbO:0000337
......
......@@ -190,10 +190,8 @@ public class OdsComparPaiOutput {
for (String msSampleName : msRunOrderedList.keySet()) {
// compute PAI
double value = (double) topMatch
.get_spectra_numbers_to(this.msRunOrderedList
.get(msSampleName))
/ (double) topMatch.get_protein_match().get_PAI_count();
double value = sg.getHashSampleScanSetProtList().get(0)
.getPAIbyMsRun(this.msRunOrderedList.get(msSampleName));
if (value > 0) {
odsTable.writeCell(value);
......@@ -203,6 +201,15 @@ public class OdsComparPaiOutput {
// S.append("\t");
}
/*
* value = topMatch.getPAIbyMsRun(this.msRunOrderedList
* .get(msSampleName));
*
* if (value > 0) { odsTable.writeCell(value); // S.append("\t"
* + value); } else { odsTable.writeCell("");
*
* // S.append("\t"); }
*/
}
logger.debug("writeOneSubGroup end");
......
......@@ -172,13 +172,14 @@ public class OdsProteinOutput {
logger.debug("writeOneProtein begin " + group + sg);
odsTable.writeLine();
Protein prot = (Protein) hashProt.getGrpProtMatch().getGrpProtein();
Match match = (Match) hashProt.getGrpProtMatch();
Protein prot = match.getGrpProtein();
odsTable.writeCell(Utils.getPappsoGroupId(group));
odsTable.writeCell(Utils.getPappsoSubGroupId(group, sg));
odsTable.writeCell(Utils.getPappsoGroupingNumber(group, sg, k));
odsTable.writeCell(prot.get_description());
odsTable.writeCell(prot.get_evalue());
Match match = (Match) hashProt.getGrpProtMatch();
// odsTable.writeCell("Coverage");
odsTable.writeCell(match.get_coverage());
// odsTable.writeCell("MW");
......@@ -199,8 +200,9 @@ public class OdsProteinOutput {
// odsTable.writeCell("Uniques");
odsTable.writeCell(hashProt.getUniquePeptideHashSampleScan());
// odsTable.writeCell("PAI");
odsTable.writeCell(new Double((float) hashProt
.getTotalHashSampleScan() / prot.get_PAI_count()));
//odsTable.writeCell(new Double((float) hashProt
// .getTotalHashSampleScan() / prot.get_PAI_count()));
odsTable.writeCell(hashProt.getPAI());
/*
* ancien PAI odsTable.writeCell(new Double((float)
* top.get_spectra_numbers_to(sample) /
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment