Skip to content
Snippets Groups Projects
Commit 30a09084 authored by langella's avatar langella
Browse files

git-svn-id: https://subversion.renater.fr/xtandempipeline/trunk@346 b8ef2a07-7df7-436f-90b9-41648038564b
parent 364871c8
No related branches found
No related tags found
No related merge requests found
......@@ -11,9 +11,10 @@ public class PeptideStore {
MsRunSet msRunSet = new MsRunSet();
static public PeptideStore getInstance() {
logger.debug("getInstance");
//logger.debug("getInstance");
if (store == null) {
store = new PeptideStoreClassic();
//store = new PeptideStoreMapDb();
}
return (store);
}
......
......@@ -10,63 +10,68 @@ import org.apache.log4j.Logger;
import fr.inra.pappso.xtandempipeline.MsException.MSMSException;
import fr.inra.pappso.xtandempipeline.class_msms.IdentificationDataFile.IdentificationDataSource;
public class MsRunSet extends HashSet<MsRun>{
public class MsRunSet extends HashSet<MsRun> {
/**
*
*/
private static final long serialVersionUID = 1859166854395591445L;
private static final Logger logger = Logger.getLogger(MsRunSet.class);
private HashMap<String,MsRun> name2msRun= new HashMap<String,MsRun>(0);
private HashMap<String, MsRun> name2msRun = new HashMap<String, MsRun>(0);
public MsRunSet() {
}
/**
* @param Take name of sample, this is normally the filename without extension
* @param Take
* name of sample, this is normally the filename without
* extension
* @return MsRun instance
*/
public MsRun getInstance(String sampleName) {
//Remove file extension for storing sample
// Remove file extension for storing sample
sampleName = sampleName.replaceAll("\\.xml$", "");
sampleName = sampleName.replaceAll("\\.dat$", "");
if (name2msRun.containsKey(sampleName)) {
// logger.debug("get MsRun by sample name " + sampleName);
return name2msRun.get(sampleName);
}
logger.debug("add "+sampleName);
// logger.debug("add new MsRun with sample name " + sampleName);
MsRun msRun = new MsRun(sampleName);
name2msRun.put(sampleName, msRun);
this.add(msRun);
return msRun;
}
/**
* @param Take name of sample from file by removing extension.
* @param Take
* name of sample from file by removing extension.
* @return MsRun instance
* @throws MSMSException
* @throws MSMSException
*/
public MsRun getInstance(IdentificationDataSource sampleFile) throws MSMSException {
public MsRun getInstance(IdentificationDataSource sampleFile)
throws MSMSException {
String sampleName = sampleFile.getName();
//Remove file extension for storing sample
sampleName = sampleName.replaceAll("\\.xml$", "");
sampleName = sampleName.replaceAll("\\.dat$", "");
if (name2msRun.containsKey(sampleName)) {
return name2msRun.get(sampleName);
}
logger.debug("add "+sampleName);
MsRun msRun = new MsRun(sampleName);
name2msRun.put(sampleName, msRun);
this.add(msRun);
return msRun;
return getInstance(sampleName);
}
public ArrayList<MsRun> getMsRunList(){
public ArrayList<MsRun> getMsRunList() {
ArrayList<MsRun> msRunList = new ArrayList<MsRun>(this);
Collections.sort(msRunList);
return (msRunList);
}
public boolean containsMsRunFromThisDataSource(
IdentificationDataSource dataSourceToParse) throws MSMSException {
String sampleName = dataSourceToParse.getName();
sampleName = sampleName.replaceAll("\\.xml$", "");
sampleName = sampleName.replaceAll("\\.dat$", "");
if (name2msRun.containsKey(sampleName)) {
return true;
}
return false;
}
}
......@@ -37,23 +37,24 @@ public class individual extends process {
// Ecrire le process et penser à relever des StopException
for (int i = 0; i < dataSources.size(); i++) {
IdentificationDataSource dataSourceToParse = dataSources.get(i);
// parsing
this.set_view("Analysing file : " + (i + 1) + "/"
+ dataSources.size() + "\n" + "Parsing file : "
+ dataSources.get(i).getName());
+ dataSourceToParse.getName());
// Is sample exist? Get previous identification
Identification identtemp = null;
for (int m = 0; m < identifications.size(); m++) {
MsRunSet samples = identifications.get(m).get_samples();
MsRun test = samples.getInstance(dataSources.get(i));
if (test == null) {
String message = "MsRun test is null";
logger.error(message);
throw new MSMSException(message);
logger.debug("identifications.size() "+identifications.size());
MsRunSet samples = identifications.get(m).getMsRunSet();
for (MsRun sample : samples) {
logger.debug("msRun name : " + sample.getSampleName());
}
if (samples.contains(test))
if (samples.containsMsRunFromThisDataSource(dataSourceToParse)) {
identtemp = identifications.get(m);
logger.debug("found " + dataSourceToParse.getName());
}
}
// xtandem handler;
// if (identtemp != null)
......@@ -66,8 +67,7 @@ public class individual extends process {
// identifications.add(handler.get_identifications());
// Load identification from datasource
identifications.add(dataSources.get(i)
.loadIdentification(identtemp));
identifications.add(dataSourceToParse.loadIdentification(identtemp));
// verification pas arreté
if (this.isStop())
......
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