diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index f9a97df1..73034c3a 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -52,8 +52,43 @@ jobs: with: path: | staging/*.zip - staging/*.jar upload-release-files: true release-upload-url: ${{ steps.get_current_release.outputs.upload_url }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build_and_push_docker: + name: Push new Docker image to Docker Hub + runs-on: ubuntu-latest + needs: build + if: ${{ github.repository == 'mpc-bioinformatics/pia' && github.event_name != 'pull_request' }} + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push the Docker dev image + if: ${{ github.event_name == 'push' }} + run: | + docker build -f ./Dockerfile-dev --tag julianusz/pia:dev ./ + docker push julianusz/pia:dev + + - name: Build and push the Docker release image + if: ${{ github.event_name == 'release' }} + run: | + version=${{ github.ref }} + version=(${version//\// }) + version=${version[2]} + docker build -f ./Dockerfile --tag julianusz/pia:${version} ./ + docker tag julianusz/pia:${version} julianusz/pia:latest + docker push julianusz/pia:${version} + docker push julianusz/pia:latest diff --git a/.gitignore b/.gitignore index 51d21fef..f2cdb8dd 100755 --- a/.gitignore +++ b/.gitignore @@ -52,5 +52,3 @@ log/ logs/ target/ .idea/ -/docker/ -Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..453296c4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM eclipse-temurin:8-jre-focal + +LABEL MAINTAINERS="Julian Uszkoreit "\ + description="Docker image for command line execution of PIA - Protein Inference Algorithms" + +# prepare zip and wget +RUN apt-get update; \ + apt-get install -y unzip wget; \ + apt-get clean + +#preparing directories +RUN mkdir -p /data/in; mkdir -p /data/out; mkdir -p /opt/pia; + +# download latest PIA zip and uncompress +RUN cd /opt/pia; \ + curl -s https://api.github.com/repos/mpc-bioinformatics/pia/releases/latest | grep -oP '"browser_download_url": "\K(.*pia.*.zip)(?=")' | wget -qi - -O pia.zip; \ + unzip pia.zip; \ + rm pia.zip; \ + mv pia*.jar pia.jar; + +# cleanup +RUN apt-get remove -y unzip wget; + +ENTRYPOINT ["java", "-jar", "/opt/pia/pia.jar"] +CMD ["--help"] diff --git a/Dockerfile-dev b/Dockerfile-dev new file mode 100644 index 00000000..6e375594 --- /dev/null +++ b/Dockerfile-dev @@ -0,0 +1,34 @@ +# the building container +FROM maven:3-eclipse-temurin-8 AS builder + +RUN mkdir -p /tmp/pia +COPY . /tmp/pia/ +RUN mvn -f /tmp/pia/pom.xml -Dmaven.test.skip --settings /tmp/pia/.mvn/unblock-mirrors.xml package + + +# start the real container +FROM eclipse-temurin:8-jre-focal + +LABEL MAINTAINERS="Julian Uszkoreit "\ + description="Docker image for command line execution of PIA - Protein Inference Algorithms" + +# prepare zip and wget +RUN apt-get update; \ + apt-get install -y unzip wget; \ + apt-get clean + +#preparing directories +RUN mkdir -p /data/in; mkdir -p /data/out; mkdir -p /opt/pia; + +# copy just build PIA zip and uncompress +COPY --from=builder /tmp/pia/target/pia*.zip /opt/pia/pia.zip +RUN cd /opt/pia; \ + unzip pia.zip; \ + rm pia.zip; \ + mv pia*.jar pia.jar; + +# cleanup +RUN apt-get remove -y unzip wget; + +ENTRYPOINT ["java", "-jar", "/opt/pia/pia.jar"] +CMD ["--help"] diff --git a/pom.xml b/pom.xml index 5b58c14c..ef954daf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.mpc.pia pia - 1.4.0 + 1.4.1 PIA - Protein Inference Algorithms https://github.com/mpc-bioinformatics/pia @@ -51,11 +51,10 @@ 1.13.0 5.0.24 4.2.8 - 2.8.1 + 2.8.2 4.6.1 1.0.392 3.20.1 - 3.1.1 2.12.0 @@ -237,12 +236,6 @@ - - org.ehcache - ehcache - ${ehcache.version} - - xerces diff --git a/src/main/java/de/mpc/pia/intermediate/compiler/PIACachedCompiler.java b/src/main/java/de/mpc/pia/intermediate/compiler/PIACachedCompiler.java deleted file mode 100755 index e56db3ad..00000000 --- a/src/main/java/de/mpc/pia/intermediate/compiler/PIACachedCompiler.java +++ /dev/null @@ -1,340 +0,0 @@ -package de.mpc.pia.intermediate.compiler; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.collections4.BidiMap; -import org.apache.commons.collections4.bidimap.DualHashBidiMap; -import org.apache.log4j.Logger; -import org.ehcache.Cache; -import org.ehcache.PersistentCacheManager; -import org.ehcache.config.builders.CacheConfigurationBuilder; -import org.ehcache.config.builders.CacheManagerBuilder; -import org.ehcache.config.builders.ResourcePoolsBuilder; -import org.ehcache.config.units.EntryUnit; -import org.ehcache.config.units.MemoryUnit; - -import uk.ac.ebi.jmzidml.model.mzidml.SpectrumIdentification; -import de.mpc.pia.intermediate.Accession; -import de.mpc.pia.intermediate.PIAInputFile; -import de.mpc.pia.intermediate.Peptide; -import de.mpc.pia.intermediate.PeptideSpectrumMatch; - -/** - * This class is used to read in one or several input files and compile them - * into one PIA XML intermediate file. - * - * @author julian - * - */ -public class PIACachedCompiler extends PIACompiler { - - /** logger for this class */ - private static final Logger LOGGER = Logger.getLogger(PIACachedCompiler.class); - - - /** the cache manager */ - private PersistentCacheManager cacheManager; - - /** bidirectional map from accession IDs to strings with the actual accessions */ - private BidiMap accessionIDsToStrings; - - /** the accessions */ - private List accessions; - - /** bidirectional map from peptide IDs to the peptide seqeunces */ - private BidiMap peptideIDsToSequences; - - /** the peptides */ - private List peptides; - - /** the psm IDs */ - private List spectraIDs; - - /** map of spectra, maps from the IDs to the PSMs */ - private Cache spectra; - - /** maps from the accession IDs to the peptide IDs, used to calculate clusters*/ - private Map> accPepMapIDs; - - /** maps from the peptide to the accessions, used to calculate the clusters */ - private Map> pepAccMapIDs; - - - /** temporary path for caches */ - private Path tmpPath; - - /** alias for the PSM cache */ - private static final String SPECTRUM_MATCH_CACHE_ALIAS = "psms-cache"; - - - - private static final long DISK_SPACE_GB = 4; - - - /** - * Basic constructor - */ - public PIACachedCompiler() { - super(); - - try { - tmpPath = Files.createTempDirectory("pia_cache"); - } catch (IOException e) { - LOGGER.error(e); - throw new AssertionError(e); - } - - accessionIDsToStrings = new DualHashBidiMap<>(); - accessions = new ArrayList<>(); - - peptideIDsToSequences = new DualHashBidiMap<>(); - peptides = new ArrayList<>(); - - spectraIDs = new ArrayList<>(); - cacheManager = CacheManagerBuilder.newCacheManagerBuilder() - .with(CacheManagerBuilder.persistence(tmpPath.toString())) - .withCache(SPECTRUM_MATCH_CACHE_ALIAS, CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, PeptideSpectrumMatch.class, - ResourcePoolsBuilder.newResourcePoolsBuilder() - .heap(100000, EntryUnit.ENTRIES) - .disk(DISK_SPACE_GB, MemoryUnit.GB, false) - ) - ) - .build(true); - - spectra = cacheManager.getCache(SPECTRUM_MATCH_CACHE_ALIAS, Long.class, PeptideSpectrumMatch.class); - - accPepMapIDs = new HashMap<>(); - pepAccMapIDs = new HashMap<>(); - } - - - @Override - public Accession getAccession(String acc) { - Long accId = accessionIDsToStrings.getKey(acc); - if (accId != null) { - return accessions.get(accId.intValue() - 1); - } else { - return null; - } - } - - - @Override - public Accession getAccession(Long accId) { - return accessions.get(accId.intValue() - 1); - } - - - @Override - public Accession insertNewAccession(String accessionStr, String dbSequence) { - Long accId = (long) (accessions.size() + 1); - Accession acc = new Accession(accId, accessionStr, dbSequence); - - accessions.add(acc); - accessionIDsToStrings.put(accId, accessionStr); - - return acc; - } - - - @Override - public int getNrAccessions() { - return accessions.size(); - } - - - @Override - public Set getAllAccessionIDs() { - return accessionIDsToStrings.keySet(); - } - - - @Override - public Peptide getPeptide(String sequence) { - Long pepId = peptideIDsToSequences.getKey(sequence); - if (pepId != null) { - return peptides.get(pepId.intValue() - 1); - } else { - return null; - } - } - - - @Override - public Peptide getPeptide(Long peptideID) { - return peptides.get(peptideID.intValue() - 1); - } - - - @Override - public Peptide insertNewPeptide(String sequence) { - Long pepId = (long) (peptides.size() + 1); - - Peptide peptide = new Peptide(pepId, sequence); - peptides.add(peptide); - peptideIDsToSequences.put(pepId, sequence); - - return peptide; - } - - - @Override - public int getNrPeptides() { - return peptides.size(); - } - - - @Override - public Set getAllPeptideIDs() { - return peptideIDsToSequences.keySet(); - } - - - @Override - public PeptideSpectrumMatch getPeptideSpectrumMatch(Long psmId) { - return spectra.get(psmId); - } - - - @Override - public PeptideSpectrumMatch createNewPeptideSpectrumMatch(Integer charge, - double massToCharge, double deltaMass, Double rt, String sequence, - int missed, String sourceID, String spectrumTitle, - PIAInputFile file, SpectrumIdentification spectrumID) { - Long id = (long) (spectraIDs.size() + 1); - - // the PSM is added later, as it might be changed - return new PeptideSpectrumMatch(id, charge, - massToCharge, deltaMass, rt, sequence, missed, sourceID, - spectrumTitle, file, spectrumID); - } - - - @Override - public void insertCompletePeptideSpectrumMatch(PeptideSpectrumMatch psm) { - Long id = psm.getID(); - if (!spectra.containsKey(id)) { - spectraIDs.add(id); - spectra.put(id, psm); - } else { - LOGGER.warn("PSM " + id + " already in the compiler, this might be invalid!"); - } - } - - - @Override - public int getNrPeptideSpectrumMatches() { - return spectraIDs.size(); - } - - - @Override - public List getAllPeptideSpectrumMatcheIDs() { - return spectraIDs; - } - - - @Override - public Set getPeptidesFromConnectionMap(String acc) { - Long accId = accessionIDsToStrings.getKey(acc); - - if ((accId != null) && accPepMapIDs.containsKey(accId)) { - Set pepSet = new HashSet<>(); - accPepMapIDs.get(accId).stream().forEach( pepId -> pepSet.add(peptides.get(pepId.intValue() -1))); - return pepSet; - } - return null; - } - - - @Override - public Set getAccessionsFromConnectionMap(String pep) { - Long pepId = peptideIDsToSequences.getKey(pep); - if ((pepId != null) && pepAccMapIDs.containsKey(pepId)) { - Set accSet = new HashSet<>(); - pepAccMapIDs.get(pepId).stream().forEach( accId -> accSet.add(accessions.get(accId.intValue() - 1))); - return accSet; - } - return null; - } - - - @Override - public List getPepIDsFromConnectionMap(Long accId) { - return accPepMapIDs.get(accId); - } - - - @Override - public List getAccIDsFromConnectionMap(Long pepId) { - return pepAccMapIDs.get(pepId); - } - - - @Override - public void addAccessionPeptideConnection(Accession accession, Peptide peptide) { - Long pepId = peptide.getID(); - Long accId = accession.getID(); - - if (!accPepMapIDs.containsKey(accId)) { - if (accessionIDsToStrings.containsKey(accId) && peptideIDsToSequences.containsKey(pepId)) { - accPepMapIDs.put(accId, new ArrayList<>()); - } else { - // this was called erroneous, insert a null (which will provoke a NullPointerException) - LOGGER.error("accession or peptide was not inserted into the compiler. " - + "acc: " + accessionIDsToStrings.containsKey(accId) + " (" + accId + ')' - + ", pep: " + peptideIDsToSequences.containsKey(pepId) + " (" + pepId + ')'); - accPepMapIDs.put(accId, null); - } - } - - if (!pepAccMapIDs.containsKey(pepId)) { - if (accessionIDsToStrings.containsKey(accId) && peptideIDsToSequences.containsKey(pepId)) { - pepAccMapIDs.put(pepId, new ArrayList<>()); - } else { - // this was called erroneous, insert a null (which will provoke a NullPointerException) - LOGGER.error("accession or peptide was not inserted into the compiler. " - + "acc: " + accessionIDsToStrings.containsKey(accId) + " (" + accId + ')' - + ", pep: " + peptideIDsToSequences.containsKey(pepId) + " (" + pepId + ')'); - pepAccMapIDs.put(pepId, null); - } - } - - List pepIds = accPepMapIDs.get(accId); - if (!pepIds.contains(pepId)) pepIds.add(pepId); - - List accIds = pepAccMapIDs.get(pepId); - if (!accIds.contains(accId)) accIds.add(accId); - - } - - - @Override - public void clearConnectionMap() { - accPepMapIDs.clear(); - pepAccMapIDs.clear(); - } - - - @Override - public void finish() { - if (cacheManager != null) { - spectra.clear(); - cacheManager.close(); - } - - try { - Files.deleteIfExists(tmpPath.toAbsolutePath()); - } catch (IOException e) { - LOGGER.error(e); - } - } -} diff --git a/src/main/java/de/mpc/pia/intermediate/compiler/parser/FastaHeaderInfos.java b/src/main/java/de/mpc/pia/intermediate/compiler/parser/FastaHeaderInfos.java index b98c5a4a..56de7a37 100755 --- a/src/main/java/de/mpc/pia/intermediate/compiler/parser/FastaHeaderInfos.java +++ b/src/main/java/de/mpc/pia/intermediate/compiler/parser/FastaHeaderInfos.java @@ -64,7 +64,7 @@ public String matchRegex() { @Override public FastaHeaderInfos parseHeader(String header) { Matcher matcher; - Pattern pattern = Pattern.compile("^>?((?:[OPQ][0-9][A-Z0-9]{3}[0-9])|(?:[A-NR-Z][0-9](?:[A-Z][A-Z0-9]{2}[0-9]){1,2}))\\|([^ ]+_[^ ]+).*$"); + Pattern pattern = Pattern.compile("^>?((?:[OPQ][0-9][A-Z0-9]{3}[0-9])|(?:[A-NR-Z][0-9](?:[A-Z][A-Z0-9]{2}[0-9]){1,2}))\\|([^_]+_[^ ]+) .*$"); matcher = pattern.matcher(header); diff --git a/src/main/java/de/mpc/pia/intermediate/compiler/parser/IdXMLFileParser.java b/src/main/java/de/mpc/pia/intermediate/compiler/parser/IdXMLFileParser.java index 87052c2f..2249af8c 100755 --- a/src/main/java/de/mpc/pia/intermediate/compiler/parser/IdXMLFileParser.java +++ b/src/main/java/de/mpc/pia/intermediate/compiler/parser/IdXMLFileParser.java @@ -94,7 +94,7 @@ public class IdXMLFileParser { /** the modification pattern like "Carbamidomethyl (C)" */ - private static final Pattern MODIFICATION_PATTERN_NAME_RESIDUE = Pattern.compile("^(.+)\\(([^)]+)\\)$"); + private static final Pattern MODIFICATION_PATTERN_NAME_RESIDUE = Pattern.compile("^([^)]+)\\(([^)]+)\\)$"); /** the modification pattern like "C+57.0215" */ private static final Pattern MODIFICATION_PATTERN_RESIDUE_SHIFT = Pattern.compile("^(.*)([+-]\\d*\\.\\d*)$"); diff --git a/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzTabParser.java b/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzTabParser.java index 8dbe0f9c..7ec7b136 100644 --- a/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzTabParser.java +++ b/src/main/java/de/mpc/pia/intermediate/compiler/parser/MzTabParser.java @@ -5,7 +5,6 @@ import de.mpc.pia.intermediate.PIAInputFile; import de.mpc.pia.intermediate.Peptide; import de.mpc.pia.intermediate.PeptideSpectrumMatch; -import de.mpc.pia.intermediate.compiler.PIACachedCompiler; import de.mpc.pia.intermediate.compiler.PIACompiler; import de.mpc.pia.modeller.score.ScoreModel; import de.mpc.pia.modeller.score.ScoreModelEnum; @@ -173,11 +172,6 @@ private MzTabParser(PIACompiler compiler, String fileName) { public static boolean getDataFromMzTabFile(String name, String fileName, PIACompiler compiler) { boolean retOk; - if (compiler instanceof PIACachedCompiler) { - LOGGER.error("Parsing of mzTab files does not work with this compiler, as the complete PSM cannot be inserted at once."); - return false; - } - MzTabParser parser = new MzTabParser(compiler, fileName); retOk = parser.initializeParser(); diff --git a/src/test/java/de/mpc/pia/intermediate/compiler/PIACachedCompilerTest.java b/src/test/java/de/mpc/pia/intermediate/compiler/PIACachedCompilerTest.java deleted file mode 100755 index 1b560710..00000000 --- a/src/test/java/de/mpc/pia/intermediate/compiler/PIACachedCompilerTest.java +++ /dev/null @@ -1,154 +0,0 @@ -package de.mpc.pia.intermediate.compiler; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Before; -import org.junit.Ignore; - -import de.mpc.pia.intermediate.Accession; -import de.mpc.pia.modeller.PIAModeller; -import de.mpc.pia.modeller.protein.ReportProtein; -import de.mpc.pia.modeller.protein.inference.SpectrumExtractorInference; -import de.mpc.pia.modeller.protein.scoring.AbstractScoring; -import de.mpc.pia.modeller.protein.scoring.MultiplicativeScoring; -import de.mpc.pia.modeller.protein.scoring.settings.PSMForScoring; -import de.mpc.pia.modeller.report.filter.AbstractFilter; -import de.mpc.pia.modeller.report.filter.FilterComparator; -import de.mpc.pia.modeller.report.filter.RegisteredFilters; -import de.mpc.pia.modeller.report.filter.impl.PSMScoreFilter; -import de.mpc.pia.modeller.score.ScoreModelEnum; -import de.mpc.pia.modeller.score.FDRData.DecoyStrategy; - -public class PIACachedCompilerTest { - - private File idXMLtandemFile; - private File idXMLmsgfFile; - private File idXMLexpectedFile; - private double scoreDelta = 0.000001; - - private String piaIntermediateFileName = "PIACachedCompilerTest.pia.xml"; - - - @Before - public void setUp() { - idXMLtandemFile = new File(PIACompilerTest.class.getResource("/merge1-tandem-fdr_filtered-015.idXML").getPath()); - idXMLmsgfFile = new File(PIACompilerTest.class.getResource("/merge1-msgf-fdr_filtered-015.idXML").getPath()); - idXMLexpectedFile = new File(PIACompilerTest.class.getResource("/yeast-gold-015-filtered-proteins.csv").getPath()); - } - - - @Ignore - public void testPIACompilerCompilationAndAnalysis() throws IOException { - PIACompiler piaCompiler = new PIACachedCompiler(); - - assertEquals(true, piaCompiler.getDataFromFile("tandem", idXMLtandemFile.getAbsolutePath(), null, null)); - assertEquals(true, piaCompiler.getDataFromFile("msgf", idXMLmsgfFile.getAbsolutePath(), null, null)); - - piaCompiler.buildClusterList(); - piaCompiler.buildIntermediateStructure(); - - piaCompiler.setName("testFile"); - - - // write out the file - File piaIntermediateFile = File.createTempFile(piaIntermediateFileName, null); - piaCompiler.writeOutXML(piaIntermediateFile); - piaCompiler.finish(); - - - // now make an analysis - PIAModeller piaModeller = new PIAModeller(piaIntermediateFile.getAbsolutePath()); - - piaModeller.setCreatePSMSets(true); - - piaModeller.getPSMModeller().setAllDecoyPattern("s.*"); - piaModeller.getPSMModeller().setAllTopIdentifications(0); - - piaModeller.getPSMModeller().calculateAllFDR(); - piaModeller.getPSMModeller().calculateCombinedFDRScore(); - - piaModeller.setConsiderModifications(false); - - // protein level - SpectrumExtractorInference seInference = new SpectrumExtractorInference(); - - seInference.addFilter( - new PSMScoreFilter(FilterComparator.less_equal, false, 0.01, ScoreModelEnum.PSM_LEVEL_FDR_SCORE.getShortName())); - - seInference.setScoring(new MultiplicativeScoring(new HashMap<>())); - seInference.getScoring().setSetting(AbstractScoring.SCORING_SETTING_ID, ScoreModelEnum.PSM_LEVEL_FDR_SCORE.getShortName()); - seInference.getScoring().setSetting(AbstractScoring.SCORING_SPECTRA_SETTING_ID, PSMForScoring.ONLY_BEST.getShortName()); - - piaModeller.getProteinModeller().infereProteins(seInference); - - piaModeller.getProteinModeller().updateFDRData(DecoyStrategy.ACCESSIONPATTERN, "s.*", 0.01); - piaModeller.getProteinModeller().updateDecoyStates(); - piaModeller.getProteinModeller().calculateFDR(); - - - List filters = new ArrayList<>(); - filters.add(RegisteredFilters.NR_GROUP_UNIQUE_PEPTIDES_PER_PROTEIN_FILTER.newInstanceOf( - FilterComparator.greater_equal, 2, false)); - - - // get the expected values - Map> expectedValues = new HashMap<>(426); - - BufferedReader br = new BufferedReader(new FileReader(idXMLexpectedFile)); - String line; - int nrLine = 0; - while ((line = br.readLine()) != null) { - if (nrLine++ < 1) { - continue; - } - - String split[] = line.split("\",\""); - List entries = new ArrayList<>(); - - entries.add(Double.parseDouble(split[1])); - entries.add(Integer.parseInt(split[2])); - entries.add(Integer.parseInt(split[3])); - entries.add(Integer.parseInt(split[4])); - entries.add(Boolean.parseBoolean(split[5])); - entries.add(Double.parseDouble(split[6])); - entries.add(Double.parseDouble(split[7].substring(0, split[7].length()-1))); - - expectedValues.put(split[0].substring(1), entries); - } - br.close(); - - // compare the values - for (ReportProtein prot : piaModeller.getProteinModeller().getFilteredReportProteins(filters)) { - StringBuilder accSb = new StringBuilder(); - for (Accession acc : prot.getAccessions()) { - accSb.append(acc.getAccession()); - accSb.append(','); - } - accSb.deleteCharAt(accSb.length()-1); - - List values = expectedValues.get(accSb.toString()); - assertNotNull("These accessions are not expected: " + accSb, values); - - assertEquals("Wrong score for " + accSb, (Double)(values.get(0)), prot.getScore(), scoreDelta); - assertEquals("Wrong number of peptides for " + accSb, values.get(1), prot.getNrPeptides()); - assertEquals("Wrong number of PSMs for " + accSb, values.get(2), prot.getNrPSMs()); - assertEquals("Wrong number of spectra for " + accSb, values.get(3), prot.getNrSpectra()); - assertEquals("Wrong decoy state for " + accSb, values.get(4), prot.getIsDecoy()); - assertEquals("Wrong FDR for " + accSb, (Double)(values.get(5)), prot.getFDR(), scoreDelta); - assertEquals("Wrong q-value for " + accSb, (Double)(values.get(6)), prot.getQValue(), scoreDelta); - } - - piaIntermediateFile.delete(); - } - -} diff --git a/src/test/java/de/mpc/pia/intermediate/compiler/parser/PrideXMLParserTest.java b/src/test/java/de/mpc/pia/intermediate/compiler/parser/PrideXMLParserTest.java index 7f4d0cc6..61aa0dd6 100644 --- a/src/test/java/de/mpc/pia/intermediate/compiler/parser/PrideXMLParserTest.java +++ b/src/test/java/de/mpc/pia/intermediate/compiler/parser/PrideXMLParserTest.java @@ -7,6 +7,8 @@ import org.junit.Test; import uk.ac.ebi.pride.jaxb.xml.PrideXmlReader; +import static org.junit.Assert.assertTrue; + import java.io.File; import java.io.IOException; import java.net.URI; @@ -42,10 +44,12 @@ public void setUp() throws Exception { public void getDataFromPrideXMLFileTest() throws IOException { PIACompiler compiler = new PIASimpleCompiler(); - compiler.getDataFromFile(prideXMLFile.getName(), - prideXMLFile.getAbsolutePath(), - null, - InputFileParserFactory.InputFileTypes.PRIDEXML_INPUT.getFileTypeShort()); + assertTrue( + compiler.getDataFromFile(prideXMLFile.getName(), + prideXMLFile.getAbsolutePath(), + null, + InputFileParserFactory.InputFileTypes.PRIDEXML_INPUT.getFileTypeShort()) + ); compiler.buildClusterList(); @@ -55,33 +59,6 @@ public void getDataFromPrideXMLFileTest() throws IOException { compiler.writeOutXML(piaIntermediateFile); compiler.finish(); - - /* - PIAModeller piaModeller = new PIAModeller(piaIntermediateFile.getAbsolutePath()); - - // PSM level - piaModeller.setCreatePSMSets(true); - assertEquals("createPSMSets should be true", true, piaModeller.getCreatePSMSets()); - - piaModeller.getPSMModeller().setAllDecoyPattern(FDRData.DecoyStrategy.SEARCHENGINE.toString()); - - piaModeller.getPSMModeller().calculateAllFDR(); - piaModeller.getPSMModeller().calculateCombinedFDRScore(); - - SpectrumExtractorInference seInference = new SpectrumExtractorInference(); - - seInference.addFilter(new PSMScoreFilter(FilterComparator.less_equal, false, 0.01, ScoreModelEnum.PSM_LEVEL_COMBINED_FDR_SCORE.getShortName())); - - seInference.setScoring(new MultiplicativeScoring(new HashMap())); - seInference.getScoring().setSetting(AbstractScoring.scoringSettingID, ScoreModelEnum.PSM_LEVEL_COMBINED_FDR_SCORE.getShortName()); - seInference.getScoring().setSetting(AbstractScoring.scoringSpectraSettingID, PSMForScoring.ONLY_BEST.getShortName()); - - piaModeller.getProteinModeller().infereProteins(seInference); - - List proteins = piaModeller.getProteinModeller().getFilteredReportProteins(null); - - Assert.assertTrue(reader.getIdentIds().size() - 1 == proteins.size()); - */ } } \ No newline at end of file