@Override
  public Set<File> generateFilePaths(SequencerPoolPartition partition) throws SubmissionException {
    Set<File> filePaths = new HashSet<File>();
    if ((partition.getSequencerPartitionContainer().getRun().getFilePath()) == null) {
      throw new SubmissionException("No valid run filepath!");
    }

    Pool<? extends Poolable> 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<? extends Dilution> libraryDilutions = pool.getDilutions();
        if (libraryDilutions.isEmpty()) {
          throw new SubmissionException("Collection of libraryDilutions is empty");
        } else {
          for (Dilution l : libraryDilutions) {
            Set<File> files = generateFilePath(partition, l);
            filePaths.addAll(files);
          }
        }
      }
    }
    return filePaths;
  }
 @Override
 public Set<File> generateFilePath(SequencerPoolPartition partition, Dilution l)
     throws SubmissionException {
   Pool<? extends Poolable> pool = partition.getPool();
   if (pool != null) {
     if (pool.getExperiments() != null) {
       Collection<Experiment> experiments = pool.getExperiments();
       Experiment experiment = experiments.iterator().next();
       StringBuilder filePath = new StringBuilder();
       if (!"".equals(basePath)) {
         filePath.append(
             partition.getSequencerPartitionContainer().getRun().getFilePath()
                 + "/Data/Intensities/BaseCalls/PAP/Project_"
                 + experiment.getStudy().getProject().getAlias()
                 + "/Sample_"
                 + l.getLibrary().getName()
                 + "/"
                 + l.getLibrary().getName());
       } else {
         filePath.append(
             basePath
                 + "/"
                 + experiment.getStudy().getProject().getAlias()
                 + "/Sample_"
                 + l.getLibrary().getName()
                 + "/"
                 + l.getLibrary().getName());
       }
       if (l.getLibrary().getTagBarcodes() != null && !l.getLibrary().getTagBarcodes().isEmpty()) {
         filePath.append("_");
         for (TagBarcode tb : l.getLibrary().getTagBarcodes().values()) {
           filePath.append(tb.getSequence());
         }
       }
       filePath.append("_L00" + partition.getPartitionNumber() + "*.fastq.gz");
       Set<File> files = new HashSet<File>();
       files.add(new File(filePath.toString()));
       return files;
     } else {
       throw new SubmissionException("partition.getPool=null!");
     }
   } else {
     throw new SubmissionException("Collection of experiments is empty");
   }
 }
  @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");
    }
  }
  @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);
  }