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 {
@Override
public int compareTo(Match p) {
int k = 0;
try {
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;
}
k = p.getValidSpectraNumber() - this.getValidSpectraNumber();
if (k != 0)
return (k);
int i = p.peptides_match.size() - this.peptides_match.size();
......@@ -128,7 +122,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
* @return
* @throws MSMSException
*/
private int getSpectraNumberIn(MsRun samp) throws MSMSException {
private int getValidSpectraNumberIn(MsRun samp) throws MSMSException {
int i = 0;
for (Peptide pep : peptides_match.values()) {
if (pep.isValidate()) {
......@@ -146,7 +140,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
* @return integer number of spectra
* @throws MSMSException
*/
private int getSpectraNumber() {
public int getValidSpectraNumber() {
int i = 0;
for (Peptide pep : peptides_match.values()) {
if (pep.isValidate()) {
......@@ -164,7 +158,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
*/
public double getPAI() {
// compute PAI
double value = (double) this.getSpectraNumber()
double value = (double) this.getValidSpectraNumber()
/ (double) this.get_protein_match()
.getNumberOfTrypticPeptidesForPAI();
......@@ -178,7 +172,7 @@ public class Match implements Comparable<Match>, GrpProtMatch {
*/
public double getPAIbyMsRun(MsRun samp) throws MSMSException {
// compute PAI
double value = (double) this.getSpectraNumberIn(samp)
double value = (double) this.getValidSpectraNumberIn(samp)
/ (double) this.get_protein_match()
.getNumberOfTrypticPeptidesForPAI();
......@@ -212,15 +206,6 @@ public class Match implements Comparable<Match>, GrpProtMatch {
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() {
Collections.sort(peptides_order);
return (peptides_order);
......@@ -233,16 +218,6 @@ public class Match implements Comparable<Match>, GrpProtMatch {
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 {
HashSet<String> sequence = new HashSet<String>();
for (Peptide pep : peptides_match.values()) {
......@@ -264,36 +239,6 @@ public class Match implements Comparable<Match>, GrpProtMatch {
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 {
// Unknown sequence
if (this.protein_match.get_sequence().length() == 0) {
......
......@@ -25,7 +25,7 @@ public class filter_peptide_evalue extends filter_base {
if (pep.get_evalue() >= this.peptide_evalue)
pep.setValidate(false);
}
if (ms.get_valid_peptide_number() > 0) {
if (ms.getValidSpectraNumber() > 0) {
numberOfValidMatch++;
} else {
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