@Override public String toString() { return (getFilename()+" "+getPattern()+" "+getInteractionRange()).trim(); }
public ExperimentListItem(Collection<String> experimentLabels, String name, String parentFolders, boolean negative, Integer chunkNumber, Integer largeScaleSize) { this.experimentLabels = experimentLabels; this.name = name; this.negative = negative; this.chunkNumber = chunkNumber; this.largeScaleChunkSize = largeScaleSize; this.parentFolders = removeTrailingSlash(parentFolders); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } ExperimentListItem eli = (ExperimentListItem) obj; return getFilename().equals(eli.getFilename()) && getPattern().equals(eli.getPattern()); }
public static Collection<Interaction> getInteractionsForExperimentListItem(ExperimentListItem eli) { Integer firstInteraction = null; Integer maxInteractions = null; // if there is pagination, get the first and the max result if (eli.getLargeScaleChunkSize() != null) { firstInteraction = (eli.getChunkNumber() - 1) * eli.getLargeScaleChunkSize(); maxInteractions = eli.getLargeScaleChunkSize(); } Collection<String> experimentLabels = eli.getExperimentLabels(); return IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getInteractionDao() .getInteractionByExperimentShortLabel(experimentLabels.toArray(new String[experimentLabels.size()]), firstInteraction, maxInteractions); }
String parentFolder = removeTrailingSlash(matcher.group(1)); String name = matcher.group(2); String strChunk = matcher.group(3); return new ExperimentListItem(Arrays.asList(experimentLabels), name, parentFolder, negative, chunk, largeScaleSize);
/** * Writes a file containing the PSI XML, for the information contained in the ExperimentListItem * * @param eli The ExperimentListItem, which contaisn information about the experiment to be fetched, the pagination and files * @param psiVersion The version of PSI to use * @param cvMapping The cv mapping * @param baseDir The base dir where to put the files * @param validate whether to validate the xml * @throws IOException thrown if there is some problem writing to the file * @return a psiValidatorReport */ public static PsiValidatorReport writePsiData(ExperimentListItem eli, PsiVersion psiVersion, CvMapping cvMapping, File baseDir, boolean validate) throws IOException { File xmlFile = new File(baseDir, eli.getFilename()); Document doc = generatePsiData(eli,psiVersion,cvMapping); if (doc == null) { return new PsiValidatorReport(); } return writeFile(doc, xmlFile, validate); }
private void createExperimentListItems( String name, Collection<SimplifiedAnnotatedObject<Experiment>> exps, Integer chunkNumber, Classification classification, Integer largeScaleChunkSize ) { List<String> labels = new ArrayList<String>(); List<String> labelsNegative = new ArrayList<String>(); for ( SimplifiedAnnotatedObject exp : exps ) { if ( isNegative( exp.getShortLabel() ) ) { labelsNegative.add( exp.getShortLabel() ); } else { labels.add( exp.getShortLabel() ); } } String parentFolders = parentFolders( exps, classification ); if ( !labels.isEmpty() ) { addToList( new ExperimentListItem( labels, name, parentFolders, false, chunkNumber, largeScaleChunkSize ), classification ); } if ( !labelsNegative.isEmpty() ) { addToList( new ExperimentListItem( labelsNegative, name, parentFolders, true, chunkNumber, largeScaleChunkSize ), classification ); } }
public String getFilename() { String strNegative = ""; if (negative) { strNegative = "_negative"; } String fileNumber = ""; if (chunkNumber != null) { fileNumber = "-"+twoDigitNumber(chunkNumber); } String strLargeScale = ""; if (largeScaleChunkSize != null) { if (experimentLabels.size() > 1) { throw new RuntimeException("On large scale items, only one experiment label is allowed"); } strLargeScale = "_"+experimentLabels.iterator().next()+"_"+twoDigitNumber(chunkNumber); fileNumber = ""; } return parentFolders + FileHelper.SLASH + name + strLargeScale + fileNumber + strNegative + FileHelper.XML_FILE_EXTENSION; }
public static Collection<Interaction> getInteractionsForExperimentListItem(ExperimentListItem eli) { Integer firstInteraction = null; Integer maxInteractions = null; // if there is pagination, get the first and the max result if (eli.getLargeScaleChunkSize() != null) { firstInteraction = (eli.getChunkNumber() - 1) * eli.getLargeScaleChunkSize(); maxInteractions = eli.getLargeScaleChunkSize(); } Collection<String> experimentLabels = eli.getExperimentLabels(); return IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getInteractionDao() .getInteractionByExperimentShortLabel(experimentLabels.toArray(new String[experimentLabels.size()]), firstInteraction, maxInteractions); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } ExperimentListItem eli = (ExperimentListItem) obj; return getFilename().equals(eli.getFilename()) && getPattern().equals(eli.getPattern()); }
String parentFolder = removeTrailingSlash(matcher.group(1)); String name = matcher.group(2); String strChunk = matcher.group(3); return new ExperimentListItem(Arrays.asList(experimentLabels), name, parentFolder, negative, chunk, largeScaleSize);
/** * Writes a file containing the PSI XML, for the information contained in the ExperimentListItem * * @param eli The ExperimentListItem, which contaisn information about the experiment to be fetched, the pagination and files * @param psiVersion The version of PSI to use * @param cvMapping The cv mapping * @param baseDir The base dir where to put the files * @param validate whether to validate the xml * @throws IOException thrown if there is some problem writing to the file * @return a psiValidatorReport */ public static PsiValidatorReport writePsiData(ExperimentListItem eli, PsiVersion psiVersion, CvMapping cvMapping, File baseDir, boolean validate) throws IOException { File xmlFile = new File(baseDir, eli.getFilename()); Document doc = generatePsiData(eli,psiVersion,cvMapping); if (doc == null) { return new PsiValidatorReport(); } return writeFile(doc, xmlFile, validate); }
private void createExperimentListItems( String name, Collection<SimplifiedAnnotatedObject<Experiment>> exps, Integer chunkNumber, Classification classification, Integer largeScaleChunkSize ) { List<String> labels = new ArrayList<String>(); List<String> labelsNegative = new ArrayList<String>(); for ( SimplifiedAnnotatedObject exp : exps ) { if ( isNegative( exp.getShortLabel() ) ) { labelsNegative.add( exp.getShortLabel() ); } else { labels.add( exp.getShortLabel() ); } } String parentFolders = parentFolders( exps, classification ); if ( !labels.isEmpty() ) { addToList( new ExperimentListItem( labels, name, parentFolders, false, chunkNumber, largeScaleChunkSize ), classification ); } if ( !labelsNegative.isEmpty() ) { addToList( new ExperimentListItem( labelsNegative, name, parentFolders, true, chunkNumber, largeScaleChunkSize ), classification ); } }
public String getFilename() { String strNegative = ""; if (negative) { strNegative = "_negative"; } String fileNumber = ""; if (chunkNumber != null) { fileNumber = "-"+twoDigitNumber(chunkNumber); } String strLargeScale = ""; if (largeScaleChunkSize != null) { if (experimentLabels.size() > 1) { throw new RuntimeException("On large scale items, only one experiment label is allowed"); } strLargeScale = "_"+experimentLabels.iterator().next()+"_"+twoDigitNumber(chunkNumber); fileNumber = ""; } return parentFolders + FileHelper.SLASH + name + strLargeScale + fileNumber + strNegative + FileHelper.XML_FILE_EXTENSION; }
@Override public String toString() { return (getFilename()+" "+getPattern()+" "+getInteractionRange()).trim(); }
public static Collection<Interaction> getInteractionsForExperimentListItem(ExperimentListItem eli) { Integer firstInteraction = null; Integer maxInteractions = null; // if there is pagination, get the first and the max result if (eli.getLargeScaleChunkSize() != null) { firstInteraction = (eli.getChunkNumber() - 1) * eli.getLargeScaleChunkSize(); maxInteractions = eli.getLargeScaleChunkSize(); } Collection<String> experimentLabels = eli.getExperimentLabels(); return IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getInteractionDao() .getInteractionByExperimentShortLabel(experimentLabels.toArray(new String[experimentLabels.size()]), firstInteraction, maxInteractions); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } ExperimentListItem eli = (ExperimentListItem) obj; return getFilename().equals(eli.getFilename()) && getPattern().equals(eli.getPattern()); }
String parentFolder = removeTrailingSlash(matcher.group(1)); String name = matcher.group(2); String strChunk = matcher.group(3); return new ExperimentListItem(Arrays.asList(experimentLabels), name, parentFolder, negative, chunk, largeScaleSize);
public ExperimentListItem(Collection<String> experimentLabels, String name, String parentFolders, boolean negative, Integer chunkNumber, Integer largeScaleSize) { this.experimentLabels = experimentLabels; this.name = name; this.negative = negative; this.chunkNumber = chunkNumber; this.largeScaleChunkSize = largeScaleSize; this.parentFolders = removeTrailingSlash(parentFolders); }
/** * Writes a file containing the PSI XML, for the information contained in the ExperimentListItem * * @param eli The ExperimentListItem, which contaisn information about the experiment to be fetched, the pagination and files * @param psiVersion The version of PSI to use * @param cvMapping The cv mapping * @param baseDir The base dir where to put the files * @param validate whether to validate the xml * @throws IOException thrown if there is some problem writing to the file * @return a psiValidatorReport */ public static PsiValidatorReport writePsiData(ExperimentListItem eli, PsiVersion psiVersion, CvMapping cvMapping, File baseDir, boolean validate) throws IOException { File xmlFile = new File(baseDir, eli.getFilename()); Document doc = generatePsiData(eli,psiVersion,cvMapping); if (doc == null) { return new PsiValidatorReport(); } return writeFile(doc, xmlFile, validate); }