diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
index 2594458..2ceddbe 100644
--- a/nbproject/build-impl.xml
+++ b/nbproject/build-impl.xml
@@ -79,43 +79,7 @@ is divided into following sections:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set platform.home
- Must set platform.bootcp
- Must set platform.java
- Must set platform.javac
-
- The J2SE Platform is not correctly set up.
- Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files.
- Either open the project in the IDE and setup the Platform with the same name or add it manually.
- For example like this:
- ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
- or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used)
-
+
@@ -245,6 +209,20 @@ is divided into following sections:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -314,7 +292,7 @@ is divided into following sections:
-
+
@@ -354,7 +332,7 @@ is divided into following sections:
-
+
@@ -435,7 +413,7 @@ is divided into following sections:
-
+
@@ -458,7 +436,7 @@ is divided into following sections:
-
+
@@ -497,7 +475,7 @@ is divided into following sections:
-
+
@@ -577,7 +555,7 @@ is divided into following sections:
-
+
@@ -602,7 +580,7 @@ is divided into following sections:
-
+
@@ -782,9 +760,6 @@ is divided into following sections:
-
-
-
@@ -800,9 +775,7 @@ is divided into following sections:
-
-
-
+
@@ -827,7 +800,7 @@ is divided into following sections:
-
+
@@ -854,7 +827,7 @@ is divided into following sections:
-
+
@@ -1052,7 +1025,7 @@ is divided into following sections:
To run this application from the command line without Ant, try:
- ${platform.java} -jar "${dist.jar.resolved}"
+ java -jar "${dist.jar.resolved}"
@@ -1261,13 +1234,10 @@ is divided into following sections:
-
-
-
-
+
-
+
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
index 1120ab7..64f3ee8 100644
--- a/nbproject/genfiles.properties
+++ b/nbproject/genfiles.properties
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=fd898e9c
+build.xml.data.CRC32=be8a7bc0
build.xml.script.CRC32=3dec13ec
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=fd898e9c
-nbproject/build-impl.xml.script.CRC32=6eb89762
+nbproject/build-impl.xml.data.CRC32=be8a7bc0
+nbproject/build-impl.xml.script.CRC32=f54f9770
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
diff --git a/nbproject/private/profiler/attach.xml b/nbproject/private/profiler/attach.xml
new file mode 100644
index 0000000..ee37697
--- /dev/null
+++ b/nbproject/private/profiler/attach.xml
@@ -0,0 +1,13 @@
+
+
+
+
+4841
+false
+Java application
+true
+false
+Java application
+rappsilber.gui.XiDBStarter
+
+
diff --git a/nbproject/private/profiler/settings.xml b/nbproject/private/profiler/settings.xml
new file mode 100644
index 0000000..30c44a8
--- /dev/null
+++ b/nbproject/private/profiler/settings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+#org.netbeans.modules.profiler.v2.features.ThreadsFeature@#org.netbeans.modules.profiler.v2.features.MonitorFeature@#org.netbeans.modules.profiler.v2.features.MethodsFeature@
+false
+
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 9eebe5e..e9334a7 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -79,7 +79,7 @@ manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
-platform.active=JDK_1.7
+platform.active=default_platform
project.license=apache20
run.classpath=\
${javac.classpath}:\
diff --git a/nbproject/project.xml b/nbproject/project.xml
index f924d77..a2fdc44 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -4,7 +4,6 @@
XiSearch
-
diff --git a/src/rappsilber/applications/SimpleXiProcessLinearIncluded.java b/src/rappsilber/applications/SimpleXiProcessLinearIncluded.java
index 0e0f95a..f10b5a7 100644
--- a/src/rappsilber/applications/SimpleXiProcessLinearIncluded.java
+++ b/src/rappsilber/applications/SimpleXiProcessLinearIncluded.java
@@ -180,7 +180,13 @@ protected void fragmentTree() {
setStatus("Build Fragmenttree - splitting by peptide mass");
Logger.getLogger(SimpleXiProcess.class.getName()).log(Level.INFO, "Build Fragment Tree - splitting by peptide mass");
// m_Fragments = new rappsilber.ms.lookup.fragments.FragmentTreeSlimedMTvArrayOnly(m_peptides, getSequenceList(), getCPUs(), getConfig());
- m_Fragments = new rappsilber.ms.lookup.fragments.FragmentTreeSlimedArrayMassSplitBuild(m_peptides, getSequenceList(), getCPUs(), getConfig());
+
+ String tree = getConfig().retrieveObject("FRAGMENTTREE", "default").toLowerCase();
+ if (tree.contentEquals("default")) {
+ m_Fragments = new rappsilber.ms.lookup.fragments.FragmentTreeSlimedArrayMassSplitBuild(m_peptides, getSequenceList(), getCPUs(), getConfig());
+ } else if (tree.contentEquals("int")) {
+ m_Fragments = new rappsilber.ms.lookup.fragments.FragmentTreeSlimedIntArray(m_peptides, getSequenceList(), getCPUs(), getConfig());
+ }
// m_Fragments = new rappsilber.ms.lookup.fragments.FragmentMapDB(m_peptides, getSequenceList(), getCPUs(), getConfig());
}
diff --git a/src/rappsilber/applications/SimpleXiProcessOpenModificationXlink.java b/src/rappsilber/applications/SimpleXiProcessOpenModificationXlink.java
index fbbd8e1..1c6d1be 100644
--- a/src/rappsilber/applications/SimpleXiProcessOpenModificationXlink.java
+++ b/src/rappsilber/applications/SimpleXiProcessOpenModificationXlink.java
@@ -18,6 +18,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@@ -291,7 +292,14 @@ public void process(SpectraAccess input, ResultWriter output) {
// for some spectra we are not sure of the charge state
// so we have to considere every possible one for these
// spectraAllchargeStatess
- for (Spectra spectra : spectraAllchargeStatess.getChargeStateSpectra()) {
+
+ Collection specs;
+ if (isRelaxedPrecursorMatching())
+ specs = spectraAllchargeStatess.getRelaxedAlternativeSpectra();
+ else
+ specs = spectraAllchargeStatess.getAlternativeSpectra();
+
+ for (Spectra spectra : specs) {
HashMapList alphaPeptides = new HashMapList();
diff --git a/src/rappsilber/ms/lookup/fragments/FragmentTreeSlimedIntArray.java b/src/rappsilber/ms/lookup/fragments/FragmentTreeSlimedIntArray.java
new file mode 100644
index 0000000..2ecd5ed
--- /dev/null
+++ b/src/rappsilber/ms/lookup/fragments/FragmentTreeSlimedIntArray.java
@@ -0,0 +1,682 @@
+/*
+ * Copyright 2016 Lutz Fischer .
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package rappsilber.ms.lookup.fragments;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import rappsilber.config.RunConfig;
+import rappsilber.ms.ToleranceUnit;
+import rappsilber.ms.lookup.peptides.PeptideLookup;
+import rappsilber.ms.sequence.Iterators.PeptideIterator;
+import rappsilber.ms.sequence.Peptide;
+import rappsilber.ms.sequence.Sequence;
+import rappsilber.ms.sequence.SequenceList;
+import rappsilber.ms.sequence.ions.Fragment;
+import rappsilber.ms.statistics.utils.UpdateableInteger;
+import rappsilber.utils.Util;
+
+
+public class FragmentTreeSlimedIntArray implements FragmentLookup, FragmentCollection{
+ private static final long serialVersionUID = -119704332506558616L;
+
+ private int m_FragmentCount = 0;
+ private ToleranceUnit m_Tolerance;
+ private SequenceList m_list;
+ private Integer m_RunningThreads = 0;
+ private int m_nextTree = 0;
+ private long m_maxPeptides = Long.MAX_VALUE;
+
+ private double m_MinimumMass = 0;
+ private double m_MaximumPeptideMass = Double.MAX_VALUE;
+
+ private int m_PeptidesPerThread = 10;
+ private AtomicInteger m_processedSequences = new AtomicInteger(0);
+
+ private PeptideIterator m_peptides = null;
+ private int[] peptides_perTree;
+
+ public int divide = 20000;
+ public double MAX_VALUE = Integer.MAX_VALUE/(double)divide;
+
+
+ /**
+ * @return the m_list
+ */
+ public SequenceList getSequeneList() {
+ return m_list;
+ }
+
+
+
+
+ private class InnerTreeMap extends TreeMap {
+ private static final long serialVersionUID = -4038223287995095272L;
+ }
+
+
+ InnerTreeMap[] m_threadTrees;
+ int[] m_perTreeCount;
+ RunConfig m_config = null;
+ int m_total_Peptides;
+
+
+
+
+ private class addingPeptideTreeByMass implements Runnable{
+ PeptideLookup m_peptides;
+// Iterator m_it;
+ InnerTreeMap m_targetTree;
+ int tree;
+ long max_peps = Long.MAX_VALUE;
+ private double minMass = 0;
+ private double maxMass = Double.MAX_VALUE;
+
+
+ public addingPeptideTreeByMass(PeptideLookup peptides, int tree) {
+ m_peptides = peptides;
+ m_targetTree = m_threadTrees[tree];
+ this.tree = tree;
+ }
+
+ public addingPeptideTreeByMass(Iterator it, int tree) {
+ m_targetTree = m_threadTrees[tree];
+ this.tree = tree;
+ this.max_peps = max_peps;
+ }
+
+ public void setMassRange(double min, double max) {
+ setMinMass(min);
+ setMaxMass(max);
+ }
+
+ public void run() {
+ long pep_count=0;
+ long lastPepCount = 0;
+ int countRounds=0;
+ int m_localFragmentCount = 0;
+ synchronized(m_RunningThreads) {
+ m_RunningThreads++;
+ }
+ try {
+ //Peptide pep;
+ ArrayList peps = m_peptides.getForExactMassRange(getMinMass(), getMaxMass());
+ int count = 0;
+ for (Peptide pep : peps ) {
+ if (++pep_count > max_peps)
+ break;
+
+ try {
+ if (pep.getMass() < m_MaximumPeptideMass && pep.getMass() > m_MinimumMass) {
+ ArrayList frags;
+ if (m_config == null) {
+ frags = pep.getPrimaryFragments();
+
+ } else {
+ frags = pep.getPrimaryFragments(m_config);
+
+
+ }
+ for (int i = 0; i < frags.size(); i++) {
+ Fragment f = frags.get(i);
+ addFragment(pep, f.getMass(), m_targetTree, tree);
+
+ }
+ }
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+
+ if (++count == 5000) {
+ int total = m_processedSequences.addAndGet(count);
+ Logger.getLogger(FragmentTreeSlimedMTv2.class.getName()).log(Level.INFO, "Fragmentation ("+tree + "): " + total + " Peptides"+ ((int)(total/(double)m_total_Peptides * 100)) + "%");
+ m_config.getStatusInterface().setStatus("Fragmentation: " + ((int)(total/(double)m_total_Peptides * 100)) + "% of Peptides" );
+ count = 0;
+
+ }
+
+ }
+
+ double total = m_processedSequences.addAndGet(count);
+
+ Logger.getLogger(FragmentTreeSlimedMTv2.class.getName()).log(Level.INFO, "Fragmentation: " + total + " Peptides");
+ m_config.getStatusInterface().setStatus("Fragmentation: " + ((int)(total/(double)m_total_Peptides * 100)) + "% of Peptides" );
+
+
+// synchronized(m_processedSequences) {
+// m_processedSequences.value+=(pep_count-lastPepCount);
+// }
+
+ } catch (Exception error) {
+ Logger.getLogger(FragmentTreeSlimedMTv2.class.getName()).log(Level.SEVERE, "error while building fragment tree",error);
+ System.err.println(error);
+ error.printStackTrace(System.err);
+ System.exit(0);
+
+ }
+ synchronized(m_RunningThreads) {
+ m_RunningThreads--;
+ }
+
+ }
+
+ /**
+ * @return the minMass
+ */
+ public double getMinMass() {
+ return minMass;
+ }
+
+ /**
+ * @param minMass the minMass to set
+ */
+ public void setMinMass(double minMass) {
+ this.minMass = minMass;
+ }
+
+ /**
+ * @return the maxMass
+ */
+ public double getMaxMass() {
+ return maxMass;
+ }
+
+ /**
+ * @param maxMass the maxMass to set
+ */
+ public void setMaxMass(double maxMass) {
+ this.maxMass = maxMass;
+ }
+
+ }
+
+
+
+ public FragmentTreeSlimedIntArray(SequenceList list, double tolerance, int threads){
+ this(list, new ToleranceUnit(tolerance, "da"), threads, Double.MAX_VALUE, null);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup peptideList, SequenceList list, double tolerance, int threads){
+ this(peptideList, list, new ToleranceUnit(tolerance, "da"), threads, Double.MAX_VALUE, null);
+ }
+
+ public FragmentTreeSlimedIntArray(SequenceList list, double tolerance, int threads, RunConfig config){
+ this(list, new ToleranceUnit(tolerance, "da"), threads, Double.MAX_VALUE, config);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup peptideList, SequenceList list, double tolerance, int threads, RunConfig config){
+ this(peptideList, list, new ToleranceUnit(tolerance, "da"), threads, Double.MAX_VALUE, config);
+ }
+
+ public FragmentTreeSlimedIntArray(SequenceList list, ToleranceUnit Tolerance, int threads){
+ this(list, Tolerance, threads, Double.MAX_VALUE,null);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup peptideList, SequenceList list, ToleranceUnit Tolerance, int threads){
+ this(peptideList, list, Tolerance, threads, Double.MAX_VALUE,null);
+ }
+
+
+ public FragmentTreeSlimedIntArray(SequenceList list, ToleranceUnit Tolerance, int threads, RunConfig config){
+ this(list, Tolerance, threads, Double.MAX_VALUE,config);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup peptideList, SequenceList list, ToleranceUnit Tolerance, int threads, RunConfig config){
+ this(peptideList, list, Tolerance, threads, Double.MAX_VALUE,config);
+ }
+
+ public FragmentTreeSlimedIntArray(SequenceList list, int threads, RunConfig config){
+ this(list, config.getFragmentTolerance(), threads, Double.MAX_VALUE,config);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup peptideList, SequenceList list, int threads, RunConfig config){
+ this(peptideList, list, config.getFragmentTolerance(), threads, Double.MAX_VALUE,config);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup peptideList, long maxPeptides, Peptide lastPeptide, SequenceList list, int threads, RunConfig config){
+ this(peptideList, maxPeptides, lastPeptide, list, config.getFragmentTolerance(), threads, Double.MAX_VALUE,config);
+ }
+
+// public FragmentTreeSlimedMTv2(SequenceList sequences, PeptideLookup peptides, int threads, RunConfig config){
+// this(sequences, peptides, config.getFragmentTolerance(), threads, Double.MAX_VALUE,config);
+// }
+
+ public FragmentTreeSlimedIntArray(SequenceList list, ToleranceUnit Tolerance, int threads, double MaximumPeptideMass, RunConfig config){
+ m_MaximumPeptideMass = MaximumPeptideMass;
+ m_list = list;
+ m_Tolerance = Tolerance;
+ m_FragmentCount = 0;
+ m_threadTrees = new InnerTreeMap[threads];
+ m_perTreeCount = new int[threads];
+ m_config = config;
+
+ insertFragements(list.iterator());
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup PeptideList, SequenceList list, ToleranceUnit Tolerance, int threads, double MaximumPeptideMass, RunConfig config){
+// threads = 3;
+ m_MaximumPeptideMass = MaximumPeptideMass;
+ m_list = list;
+ m_Tolerance = Tolerance;
+ m_FragmentCount = 0;
+ m_threadTrees = new InnerTreeMap[threads];
+ m_perTreeCount = new int[threads];
+ m_config = config;
+ m_total_Peptides = PeptideList.size();
+ m_peptides = PeptideList.iterator();
+
+ insertFragementsFromPeptides(PeptideList);
+ }
+
+ public FragmentTreeSlimedIntArray(PeptideLookup PeptideList, long maxPeptides, Peptide lastPeptide, SequenceList list, ToleranceUnit Tolerance, int threads, double MaximumPeptideMass, RunConfig config){
+// threads = 3;
+ m_MaximumPeptideMass = MaximumPeptideMass;
+ m_list = list;
+ m_Tolerance = Tolerance;
+ m_FragmentCount = 0;
+ m_threadTrees = new InnerTreeMap[threads];
+ m_perTreeCount = new int[threads];
+ m_config = config;
+ m_total_Peptides = PeptideList.size();
+ m_peptides = PeptideList.iteratorAfter(lastPeptide);
+ m_maxPeptides = maxPeptides;
+
+ insertFragementsFromPeptides(PeptideList);
+ }
+
+ public void insertFragements(Iterator sequences) {
+ throw new UnsupportedOperationException("Sorry this FragmentLookup only works on PeptideTree");
+ }
+
+
+ public void insertFragementsFromPeptides(PeptideLookup peptides) {
+// int FragmentCountLast = 0;
+ int threads = m_threadTrees.length;
+ long rest = m_maxPeptides % threads; // how many would we miss
+ addingPeptideTreeByMass[] addingRuannables = new addingPeptideTreeByMass[threads];
+ Thread[] addingThreads = new Thread[threads];
+ //PeptideIterator pIt = PeptideList.peptides();
+ double massStep = (peptides.getMaximumMass()+1)/threads/10;
+ double endmass = peptides.getMaximumMass();
+ double startmass = 0;
+
+
+ for (int i=0; i getForMass(double mass) {
+ int min = (int) (m_Tolerance.getMinRange(mass)*divide);
+ int max = (int) (m_Tolerance.getMaxRange(mass)*divide);
+
+ ArrayList ret = new ArrayList();
+ Peptide[] allPeptides = m_list.getAllPeptideIDs();
+ for (int t = 0; t entries;
+ entries = m_threadTrees[t].subMap(min,max).values();
+ Iterator it = entries.iterator();
+ while (it.hasNext()) {
+ int[] ids = it.next();
+ for (int i = 0; i < ids.length; i++) {
+// if (allPeptides[ids.m_peptideIds[i]] == null)
+// System.err.println("found it");
+ ret.add(allPeptides[ids[i]]);
+ }
+ }
+ }
+ return ret;
+ }
+
+ public ArrayList getForMass(double mass, double referenceMass) {
+ ArrayList ret = new ArrayList();
+ int min = (int) (m_Tolerance.getMinRange(mass, referenceMass)*divide);
+ int max = (int) (m_Tolerance.getMaxRange(mass, referenceMass)*divide);
+ for (int t = 0; t entries = m_threadTrees[t].subMap(min,max).values();
+ Peptide[] allPeptides = m_list.getAllPeptideIDs();
+ Iterator it = entries.iterator();
+ while (it.hasNext()) {
+ int[] ids = it.next();
+ for (int i = 0; i < ids.length; i++) {
+ ret.add(allPeptides[ids[i]]);
+ }
+ }
+ }
+ return ret;
+ }
+
+ public ArrayList getForMass(double mass, double referenceMass, double maxPepass) {
+ ArrayList ret = new ArrayList();
+ int min = (int) (m_Tolerance.getMinRange(mass, referenceMass)*divide);
+ int max = (int) (m_Tolerance.getMaxRange(mass, referenceMass)*divide);
+ for (int t = 0; t entries = m_threadTrees[t].subMap(min,max).values();
+ Peptide[] allPeptides = m_list.getAllPeptideIDs();
+ Iterator it = entries.iterator();
+ while (it.hasNext()) {
+ int[] ids = it.next();
+ for (int i = 0; i < ids.length; i++) {
+ Peptide p = allPeptides[ids[i]];
+ if (p.getMass() getPeptidesExactFragmentMass(double mass) {
+ return getPeptidesExactFragmentMass(mass*divide);
+ }
+
+ protected ArrayList getPeptidesExactFragmentMass(int mass) {
+ ArrayList ret = new ArrayList();
+ Peptide[] allPeptides = m_list.getAllPeptideIDs();
+ for (int t = 0; t ret = new ArrayList();
+ for (int t = 0; t to)
+// System.err.println("count peptides From > to");
+ for (int[] e : m_threadTrees[t].subMap(min,max).values()) {
+ count += e.length;
+ }
+ }
+ return count;
+ }
+
+ public int countPeptides(double mass, double referenceMass) {
+ int count = 0;
+ int min = (int) (m_Tolerance.getMinRange(mass, referenceMass)*divide);
+ int max = (int) (m_Tolerance.getMaxRange(mass, referenceMass)*divide);
+// ArrayList ret = new ArrayList();
+ for (int t = 0; t getPeptidesForMasses(double mass) {
+ HashMap ret = new HashMap();
+ int min = (int) (m_Tolerance.getMinRange(mass)*divide);
+ int max = (int) (m_Tolerance.getMaxRange(mass)*divide);
+ for (int t = 0; t entries = m_threadTrees[t].subMap(min, max).values();
+ Peptide[] allPeptides = m_list.getAllPeptideIDs();
+ Iterator it = entries.iterator();
+ while (it.hasNext()) {
+ int[] ids = it.next();
+ for (int i = 0; i < ids.length; i++)
+ ret.put(allPeptides[ids[i]], mass);
+ }
+ }
+ return ret;
+ }
+
+ public void setTolerance(ToleranceUnit tolerance) {
+ m_Tolerance = tolerance;
+ }
+
+
+
+
+ private void addFragment(Peptide pep, double mass, InnerTreeMap targetTree, int tree) {
+ // fragments exceding maxvalue can not be represented and are therefore ignored
+ if (mass > MAX_VALUE) {
+ return;
+ }
+ int[] src=null;
+ int[] newEntry;
+ src = targetTree.get(mass);
+ if (src != null) {
+ newEntry = java.util.Arrays.copyOf(src, src.length + 1);
+ newEntry[src.length] = pep.getPeptideIndex();
+ } else {
+ newEntry = new int[] {pep.getPeptideIndex()};
+ }
+ targetTree.put((int)(mass*divide), newEntry);
+ m_FragmentCount ++;
+ m_perTreeCount[tree] ++;
+ }
+
+ public void addFragment(Peptide pep, double mass) {
+ synchronized (m_threadTrees) {
+ addFragment(pep, mass, m_threadTrees[m_nextTree], m_nextTree);
+ }
+ }
+
+ public int getFragmentCount() {
+ int count = 0;
+ for (int i = 0 ; i < m_threadTrees.length; i++)
+ count += m_perTreeCount[i];
+ return count;
+ }
+
+ public void printStatistic(PrintStream out) {
+
+ int minSize = Integer.MAX_VALUE;
+ int maxSize = Integer.MIN_VALUE;
+ int count = 0;
+
+ for (int i = 0; i < m_threadTrees.length; i++) {
+ java.util.Set s = m_threadTrees[i].keySet();
+ Iterator it = s.iterator();
+ while (it.hasNext()) {
+ Integer k = it.next();
+ int[] v = m_threadTrees[i].get(k);
+ minSize = Math.min(minSize, v.length);
+ maxSize = Math.max(maxSize, v.length);
+ count += v.length;
+ }
+ }
+
+
+
+ out.println("==============================");
+ out.println("== Statistic ===");
+ out.println("==============================");
+ //out.println("==distinct masses: " + this.size());
+ out.println("==min peptides per mass: " + minSize/(double)divide);
+ out.println("==max peptides per mass: " + maxSize/(double)divide);
+ //out.println("==avarage peptides per mass: " + count/(double)this.size());
+ out.println("==============================");
+ }
+
+ public void dump(String path) throws IOException {
+ dump(new FileWriter(path));
+ }
+
+ public void dump(Writer out) throws IOException {
+ BufferedWriter bw = new BufferedWriter(out);
+ Peptide[] allPeptides = m_list.getAllPeptideIDs();
+ HashSet masses = new HashSet();
+ for (int i = 0; i < m_threadTrees.length; i++) {
+ java.util.Set s = m_threadTrees[i].keySet();
+ masses.addAll(s);
+ }
+
+ Integer[] ma = masses.toArray(new Integer[0]);
+
+ java.util.Arrays.sort(ma);
+
+ for (Integer m : ma) {
+ ArrayList peps = this.getPeptidesExactFragmentMass(m);
+ java.util.Collections.sort(peps, new Comparator() {
+
+ @Override
+ public int compare(Peptide o1, Peptide o2) {
+ int ret = Double.compare(o1.length(), o2.length());
+ if (ret == 0)
+ ret = o1.toString().compareTo(o2.toString());
+ return ret;
+ }
+ });
+
+ bw.append(Double.toString(m));
+ for (Peptide p : peps)
+ bw.append(", " + p.getSequence().getFastaHeader().substring(0, Math.min(40,p.getSequence().getFastaHeader().length())) + ":" + p.toString());
+
+ bw.newLine();
+ }
+
+
+
+
+ }
+
+ public void shrink() {
+// Thread[] waitThreads = new Thread[m_threadTrees.length];
+ for (int i = 0; i < m_threadTrees.length; i++) {
+ final InnerTreeMap it = m_threadTrees[i];
+
+// Runnable runnable = new Runnable() {
+//
+// public void run() {
+// for (FragmentTreeSlimedElement e : it.values().toArray(new FragmentTreeSlimedElement[0])) {
+// e.shrink();
+// }
+// }
+// };
+// waitThreads[i] = new Thread(runnable);
+// waitThreads[i].start();
+ }
+
+// boolean finished = false;
+// while (!finished ) {
+// finished =true;
+// for (int i = 0; i < m_threadTrees.length; i++) {
+// try {
+// waitThreads[i].join();
+// } catch (InterruptedException ex) {
+// finished = false;
+// }
+// }
+// }
+
+ }
+
+ @Override
+ public Peptide lastFragmentedPeptide() {
+ return m_peptides.current();
+ }
+
+ public PeptideIterator getPeptideIterator() {
+ return m_peptides;
+ }
+
+
+}
diff --git a/src/rappsilber/ms/sequence/NonProteinPeptide.java b/src/rappsilber/ms/sequence/NonProteinPeptide.java
index 2a9750b..e2e1e7b 100644
--- a/src/rappsilber/ms/sequence/NonProteinPeptide.java
+++ b/src/rappsilber/ms/sequence/NonProteinPeptide.java
@@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
import rappsilber.config.RunConfig;
import rappsilber.ms.ToleranceUnit;
import rappsilber.ms.crosslinker.CrossLinker;
@@ -113,20 +114,34 @@ public static Peptide randomPeptide(Peptide p, RunConfig conf, boolean basicAmin
* @param conf
* @return
*/
- public static ArrayList permutePeptide(Peptide p, RunConfig conf) {
- ArrayList ret = new ArrayList();
+ public static Iterable permutePeptide(final Peptide p, final RunConfig conf) {
AminoAcid[] aaa = p.toArray();
PermArray perm = new PermArray(aaa);
+ final Iterator iter = perm.iterator();
- for (AminoAcid[] permaa : perm) {
- NonProteinPeptide npp = new NonProteinPeptide(permaa, p.getPositions(), p.isDecoy());
- FastaHeader fh=p.getSequence().getSplitFastaHeader();
- npp.getSequence().setFastaHeader(new FastaHeader(fh.getAccession() + " Randomized peptide", fh.getAccession(), fh.getName(),"Randomized peptide" ));
- npp.setCTerminal(p.isCTerminal());
- npp.setNTerminal(p.isNTerminal());
- ret.add(npp);
- }
- return ret;
+ return new Iterable() {
+ @Override
+ public Iterator iterator() {
+ return new Iterator() {
+ @Override
+ public boolean hasNext() {
+
+ return iter.hasNext();
+ }
+
+ @Override
+ public Peptide next() {
+ AminoAcid[] permaa = iter.next();
+ NonProteinPeptide npp = new NonProteinPeptide(permaa, p.getPositions(), p.isDecoy());
+ FastaHeader fh=p.getSequence().getSplitFastaHeader();
+ npp.getSequence().setFastaHeader(new FastaHeader("RAN_" + fh.getAccession(), fh.getAccession(), fh.getName(),"Randomized peptide" ));
+ npp.setCTerminal(p.isCTerminal());
+ npp.setNTerminal(p.isNTerminal());
+ return npp;
+ }
+ };
+ }
+ };
}
//
diff --git a/src/rappsilber/utils/XiVersion.java b/src/rappsilber/utils/XiVersion.java
index b754783..1427def 100644
--- a/src/rappsilber/utils/XiVersion.java
+++ b/src/rappsilber/utils/XiVersion.java
@@ -21,7 +21,7 @@
* @author Lutz Fischer
*/
public class XiVersion {
- public static final String m_revstring="$Rev: 715 $";
+ public static final String m_revstring="$Rev: 716 $";
// overlap
// public static final int m_major = 1;
// public static final int m_minor = 2;
@@ -29,7 +29,9 @@ public class XiVersion {
public static Version version = new Version(1, 6, m_revstring);
- public final String changes = "v1.6.714\n"+
+ public final String changes = "v1.6.715\n"+
+ " new\n"+
+ "v1.6.714\n"+
" Speed up for candidate selection\n"+
"v1.6.713\n"+
" BugFix: manual start of database searches failed\n"+