private boolean isTargetedSequencingRequired(Library library) { return LimsUtils.isDetailedLibrary(library) && ((DetailedLibrary) library).getLibraryDesignCode().isTargetedSequencingRequired(); }
@Override public String generate(Library library) throws MisoNamingException, IOException { if (!isDetailedLibrary(library)) { throw new IllegalArgumentException("Can only generate an alias for detailed samples"); } DetailedLibrary detailed = (DetailedLibrary) library; switch (detailed.getPlatformType()) { case ILLUMINA: return generateIlluminaLibraryAlias(detailed); case PACBIO: return generatePacBioLibraryAlias(detailed); case OXFORDNANOPORE: return generateOxfordNanoporeLibraryAlias(detailed); default: throw new MisoNamingException("Alias generation is only available for Illumina and PacBio Libraries"); } }
private void validateParentOrThrow(Library library) { if (!isDetailedLibrary(library)) return; if (!isAliquotSample(library.getSample())) { String sc = null; if (isDetailedSample(library.getSample())) { DetailedSample sample = (DetailedSample) library.getSample(); sc = sample.getSampleClass() == null ? "not set" : sample.getSampleClass().getAlias(); } else { sc = "Plain Sample"; } throw new IllegalArgumentException(String.format("Sample Class '%s' is not a valid parent for Libraries. Must be an aliquot", sc)); } }
private void validateAliasUniqueness(Library library) throws IOException { // duplicate aliases may be allowed via naming scheme, or with nonStandardAlias=true in the case of a DetailedLibrary if (namingScheme.duplicateLibraryAliasAllowed() || (LimsUtils.isDetailedLibrary(library) && ((DetailedLibrary) library).hasNonStandardAlias())) { return; } List<Library> potentialDupes = listByAlias(library.getAlias()); for (Library potentialDupe : potentialDupes) { if (library.getId() == AbstractLibrary.UNSAVED_ID || library.getId() != potentialDupe.getId()) { // an existing DIFFERENT library already has this alias throw new IllegalArgumentException("NEW: A library with this alias already exists in the database"); } } }
/** * Checks whether library's alias conforms to the naming scheme. Validation is skipped for DetailedLibraries * {@code if (library.hasNonStandardAlias())} * * @param library * @throws IOException * @throws IllegalArgumentException */ private void validateAliasOrThrow(Library library) throws IOException { validateAliasUniqueness(library); if (!isDetailedLibrary(library) || !((DetailedLibrary) library).hasNonStandardAlias()) { uk.ac.bbsrc.tgac.miso.core.service.naming.validation.ValidationResult aliasValidation = namingScheme.validateLibraryAlias(library .getAlias()); if (!aliasValidation.isValid()) { throw new IllegalArgumentException("Invalid library alias: '" + library.getAlias() + "' - " + aliasValidation.getMessage()); } } }
String generatedAlias = namingScheme.generateLibraryAlias(managed); managed.setAlias(generatedAlias); if (isDetailedLibrary(managed)) {
library.setSpikeIn(getSpikeIn(library.getSpikeIn().getId())); if (isDetailedLibrary(library)) { DetailedLibrary lai = (DetailedLibrary) library; if (lai.getLibraryDesignCode() != null) {
public static LibraryDto asDto(@Nonnull Library from, boolean includeBoxPositions) { LibraryDto dto = null; if (isDetailedLibrary(from)) { dto = asDetailedLibraryDto((DetailedLibrary) from); } else {
if (isDetailedLibrary(target)) { DetailedLibrary dSource = (DetailedLibrary) source; DetailedLibrary dTarget = (DetailedLibrary) target;