@Override
  public Set<File> generateFilePaths(SequencerPoolPartition partition) throws SubmissionException {
    log.debug("Generating filepaths for partition " + partition.getId());
    Set<File> filePaths = new HashSet<File>();

    Pool pool = partition.getPool();
    if (pool == null) {
      throw new SubmissionException("partition.getPool=null!");
    } else {
      Collection<Experiment> experiments = pool.getExperiments();
      if (experiments.isEmpty()) {
        throw new SubmissionException("Collection or experiments is empty");
      } else {
        Collection<LibraryDilution> libraryDilutions = pool.getDilutions();
        if (libraryDilutions.isEmpty()) {
          throw new SubmissionException("Collection or libraryDilutions is empty");
        } else {
          for (Experiment e : experiments) {
            StringBuilder filePath = new StringBuilder();

            filePath.append(partition.getSequencerPartitionContainer().getRun().getFilePath());
            filePath.append("/Data/Intensities/BaseCalls/PAP/Project_");
            filePath.append(e.getStudy().getProject().getAlias());
            filePath.append("/Sample_");

            for (LibraryDilution l : libraryDilutions) {
              // filePath.append(l.getLibrary().getName()+"/");
              /*
                      +l.getLibrary().getName()+"_"+l.getLibrary().getTagBarcode().getSequence());
              filePath.append("L00"+lane.getPartitionNumber())
              */
              String folder = filePath.toString() + l.getLibrary().getName() + "/*.fastq.gz";
              // System.out.println(folder);
              File file = new File(folder);
              filePaths.add(file);
            }
          }
        }
      }
    }
    return (filePaths);
  }
  @Override
  public File generateFilePath(SequencerPoolPartition partition, LibraryDilution l)
      throws SubmissionException {
    log.debug("Generating filepaths for partition " + partition.getId());

    Pool pool = partition.getPool();
    if (pool != null) {
      if (pool.getExperiments() != null) {

        Collection<Experiment> experiments = pool.getExperiments();
        Experiment experiment = experiments.iterator().next();
        // String filePath =
        // lane.getFlowcell().getRun().getFilePath()+"/Data/Intensities/BaseCalls/PAP/Project_"+
        String filePath =
            partition.getSequencerPartitionContainer().getRun().getFilePath()
                + "/Data/Intensities/BaseCalls/PAP/Project_"
                + experiment.getStudy().getProject().getAlias()
                + "/Sample_"
                + l.getLibrary().getName()
                + "/"
                + l.getLibrary().getName()
                + "_"
                + l.getLibrary().getTagBarcode().getSequence()
                + "_L00"
                + partition.getPartitionNumber()
                + "*.fastq.gz";
        // System.out.println(filePath);
        File file = new File(filePath);
        return (file);
      } else {
        throw new SubmissionException("partition.getPool=null!");
      }
    } else {
      throw new SubmissionException("Collection of experiments is empty");
    }
  }