@Override public String getPlatform() { if ( !retrievedPlatform ) { mPlatform = super.getPlatform(); retrievedPlatform = true; } return mPlatform; }
/** * @param header * @return Return the set of platforms, uppercase. Will be null iff header is null */ public static Set<String> getPlatforms(SAMFileHeader header) { Set<String> platforms = null; if (header != null) { List<SAMReadGroupRecord> readGroups = header.getReadGroups(); if (readGroups != null) { platforms = new HashSet<String>(); for (SAMReadGroupRecord rg : readGroups) { String platform = rg.getPlatform(); if (platform != null) { platforms.add(platform.toUpperCase()); } } } } // Hack for Moleculo if(header.getProgramRecord("MAFtoSAM") != null) { platforms.add("MOLECULO"); } return platforms; }
/** * Determines the list of read groups that meet the user's criteria for inclusion (based on id, platform, or sample) * @param header the merged header for all input files * @param samplesToKeep the list of specific samples specified by the user * @return a Set of read group IDs that meet the user's criteria, empty if all RGs should be included */ private Set<String> determineReadGroupsOfInterest(final SAMFileHeader header, final Set<String> samplesToKeep) { //If no filter options that use read group information have been supplied, exit early if (platform == null && readGroup == null && samplesToKeep.isEmpty()) return Collections.emptySet(); if ( platform != null ) platform = platform.toUpperCase(); final Set<String> result = new HashSet<>(); for (final SAMReadGroupRecord rg : header.getReadGroups()) { // To be eligible for output, a read group must: // NOT have an id that is blacklisted on the command line (note that String.equals(null) is false) // AND NOT have a platform that contains the blacklisted platform from the command line // AND have a sample that is whitelisted on the command line if (!rg.getReadGroupId().equals(readGroup) && (platform == null || !rg.getPlatform().toUpperCase().contains(platform)) && (samplesToKeep.isEmpty() || samplesToKeep.contains(rg.getSample()))) result.add(rg.getReadGroupId()); } if (result.isEmpty()) throw new UserException.BadArgumentValue("-sn/-sf/-platform/-readGroup", "No read groups remain after pruning based on the supplied parameters"); return result; }
public static String getTypeID( SAMReadGroupRecord r, DoCOutputType.Partition type ) { if ( type == DoCOutputType.Partition.sample ) { return r.getSample(); } else if ( type == DoCOutputType.Partition.readgroup ) { return String.format("%s_rg_%s",r.getSample(),r.getReadGroupId()); } else if ( type == DoCOutputType.Partition.library ) { return r.getLibrary(); } else if ( type == DoCOutputType.Partition.center ) { return r.getSequencingCenter(); } else if ( type == DoCOutputType.Partition.platform ) { return r.getPlatform(); } else if ( type == DoCOutputType.Partition.sample_by_center ) { return String.format("%s_cn_%s",r.getSample(),r.getSequencingCenter()); } else if ( type == DoCOutputType.Partition.sample_by_platform) { return String.format("%s_pl_%s",r.getSample(),r.getPlatform()); } else if ( type == DoCOutputType.Partition.sample_by_platform_by_center ) { return String.format("%s_pl_%s_cn_%s",r.getSample(),r.getPlatform(),r.getSequencingCenter()); } else { throw new ReviewedGATKException("Invalid type ID sent to getTypeID. This is a BUG!"); } }
/** * Returns the platform name for a read group given its index. * * @param group the index of the targeted read group in the range * [1,{@link #getReadGroupCount()}] * @return never <code>null</code>. */ protected final String getPlatformName(final int group) { checkReadGroupIndex(group); return getHeader().getReadGroups().get(group - 1).getPlatform(); }
partition.add(rg.getPlatform()); partition.add(String.format("%s_pl_%s",rg.getSample(),rg.getPlatform())); partition.add(String.format("%s_pl_%s_cn_%s",rg.getSample(),rg.getPlatform(),rg.getSequencingCenter()));
final String platformValue = record.getPlatform(); if (platformValue == null || "".equals(platformValue)) { addError(new SAMValidationError(Type.MISSING_PLATFORM_VALUE,
final String platformValue = record.getPlatform(); if (platformValue == null || "".equals(platformValue)) { addError(new SAMValidationError(Type.MISSING_PLATFORM_VALUE,
final String platformValue = record.getPlatform(); if (platformValue == null || "".equals(platformValue)) { addError(new SAMValidationError(Type.MISSING_PLATFORM_VALUE,
setTableValue(table, rgID, "platform", rg.getPlatform()); setTableValue(table, rgID, "center", rg.getSequencingCenter()); try {
if (RGFO != null) rg.setFlowOrder(RGFO); log.info(String.format("Created read-group ID=%s PL=%s LB=%s SM=%s%n", rg.getId(), rg.getPlatform(), rg.getLibrary(), rg.getSample()));
if (RGFO != null) rg.setFlowOrder(RGFO); log.info(String.format("Created read-group ID=%s PL=%s LB=%s SM=%s%n", rg.getId(), rg.getPlatform(), rg.getLibrary(), rg.getSample()));