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

Match object cleaning : function renamed, obsolete functions removed

parent a8ab55fc
No related branches found
No related tags found
No related merge requests found
...@@ -32,13 +32,7 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -32,13 +32,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
@Override @Override
public int compareTo(Match p) { public int compareTo(Match p) {
int k = 0; int k = 0;
try { k = p.getValidSpectraNumber() - this.getValidSpectraNumber();
k = p.get_valid_peptide_number() - this.get_valid_peptide_number();
} catch (MSMSException e) {
String error = "error in compareTo " + e.getMessage();
logger.error(error);
return 0;
}
if (k != 0) if (k != 0)
return (k); return (k);
int i = p.peptides_match.size() - this.peptides_match.size(); int i = p.peptides_match.size() - this.peptides_match.size();
...@@ -128,7 +122,7 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -128,7 +122,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
* @return * @return
* @throws MSMSException * @throws MSMSException
*/ */
private int getSpectraNumberIn(MsRun samp) throws MSMSException { private int getValidSpectraNumberIn(MsRun samp) throws MSMSException {
int i = 0; int i = 0;
for (Peptide pep : peptides_match.values()) { for (Peptide pep : peptides_match.values()) {
if (pep.isValidate()) { if (pep.isValidate()) {
...@@ -146,7 +140,7 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -146,7 +140,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
* @return integer number of spectra * @return integer number of spectra
* @throws MSMSException * @throws MSMSException
*/ */
private int getSpectraNumber() { public int getValidSpectraNumber() {
int i = 0; int i = 0;
for (Peptide pep : peptides_match.values()) { for (Peptide pep : peptides_match.values()) {
if (pep.isValidate()) { if (pep.isValidate()) {
...@@ -164,7 +158,7 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -164,7 +158,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
*/ */
public double getPAI() { public double getPAI() {
// compute PAI // compute PAI
double value = (double) this.getSpectraNumber() double value = (double) this.getValidSpectraNumber()
/ (double) this.get_protein_match() / (double) this.get_protein_match()
.getNumberOfTrypticPeptidesForPAI(); .getNumberOfTrypticPeptidesForPAI();
...@@ -178,7 +172,7 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -178,7 +172,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
*/ */
public double getPAIbyMsRun(MsRun samp) throws MSMSException { public double getPAIbyMsRun(MsRun samp) throws MSMSException {
// compute PAI // compute PAI
double value = (double) this.getSpectraNumberIn(samp) double value = (double) this.getValidSpectraNumberIn(samp)
/ (double) this.get_protein_match() / (double) this.get_protein_match()
.getNumberOfTrypticPeptidesForPAI(); .getNumberOfTrypticPeptidesForPAI();
...@@ -212,15 +206,6 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -212,15 +206,6 @@ public class Match implements Comparable<Match>, GrpProtMatch {
return (sequence.size()); return (sequence.size());
} }
public int get_valid_peptide_number() throws MSMSException {
int i = 0;
for (Peptide pep : peptides_match.values()) {
if (pep.isValidate())
i++;
}
return (i);
}
public ArrayList<Peptide> get_peptide_order_inclus_redon() { public ArrayList<Peptide> get_peptide_order_inclus_redon() {
Collections.sort(peptides_order); Collections.sort(peptides_order);
return (peptides_order); return (peptides_order);
...@@ -233,16 +218,6 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -233,16 +218,6 @@ public class Match implements Comparable<Match>, GrpProtMatch {
return (peptides); return (peptides);
} }
public int get_valid_peptide_number_to(MsRun samp) throws MSMSException {
int i = 0;
for (Peptide pep : peptides_match.values()) {
if (pep.getMsRun().equals(samp) && pep.isValidate()) {
i++;
}
}
return (i);
}
public int get_unique_valid_peptide_number() throws MSMSException { public int get_unique_valid_peptide_number() throws MSMSException {
HashSet<String> sequence = new HashSet<String>(); HashSet<String> sequence = new HashSet<String>();
for (Peptide pep : peptides_match.values()) { for (Peptide pep : peptides_match.values()) {
...@@ -264,36 +239,6 @@ public class Match implements Comparable<Match>, GrpProtMatch { ...@@ -264,36 +239,6 @@ public class Match implements Comparable<Match>, GrpProtMatch {
return (sequence.size()); return (sequence.size());
} }
public int get_coverage_to(MsRun samp) throws MSMSException {
// Unknown sequence
if (this.protein_match.get_sequence().length() == 0) {
return 0;
}
HashMap<Integer, Boolean> seq = new HashMap<Integer, Boolean>();
for (int i = 0; i < this.protein_match.get_sequence().length(); i++) {
int i_po = i + 1;
seq.put(i_po, false);
}
for (Peptide pep : peptides_match.values()) {
if (pep.getMsRun().equals(samp)) {
for (int j = pep.get_start(); j <= pep.get_stop(); j++) {
seq.put(j, true);
}
}
}
int k = 0;
for (boolean ST : seq.values()) {
if (ST)
k++;
}
float cov = (float) k
/ (this.protein_match.get_sequence().length() + 1) * 100;
int cov_temp = (int) cov;
return (cov_temp);
}
public int get_coverage() throws MSMSException { public int get_coverage() throws MSMSException {
// Unknown sequence // Unknown sequence
if (this.protein_match.get_sequence().length() == 0) { if (this.protein_match.get_sequence().length() == 0) {
......
...@@ -25,7 +25,7 @@ public class filter_peptide_evalue extends filter_base { ...@@ -25,7 +25,7 @@ public class filter_peptide_evalue extends filter_base {
if (pep.get_evalue() >= this.peptide_evalue) if (pep.get_evalue() >= this.peptide_evalue)
pep.setValidate(false); pep.setValidate(false);
} }
if (ms.get_valid_peptide_number() > 0) { if (ms.getValidSpectraNumber() > 0) {
numberOfValidMatch++; numberOfValidMatch++;
} else { } else {
ms.setIsvalidate(false); ms.setIsvalidate(false);
......
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