/** * If the sample has a PU tag annotation, return that. If not, return the read group id. * * @param rg the read group record * @return platform unit or readgroup id */ private String readGroupValueFromRG(final GATKSAMReadGroupRecord rg) { if ( forceReadGroup != null ) return forceReadGroup; final String platformUnit = rg.getPlatformUnit(); return platformUnit == null ? rg.getId() : platformUnit; }
public void setReadGroup( final GATKSAMReadGroupRecord readGroup ) { mReadGroup = readGroup; retrievedReadGroup = true; setAttribute("RG", mReadGroup.getId()); // todo -- this should be standardized, but we don't have access to SAMTagUtils! }
private Set<GATKSAMRecord> filterNonPassingReads( final ActiveRegion activeRegion ) { final Set<GATKSAMRecord> readsToRemove = new LinkedHashSet<>(); for( final GATKSAMRecord rec : activeRegion.getReads() ) { if( rec.getReadLength() < READ_LENGTH_FILTER_THRESHOLD || rec.getMappingQuality() < READ_QUALITY_FILTER_THRESHOLD || (!isBadMateFilterDisabled && BadMateFilter.hasBadMate(rec)) || (keepRG != null && !rec.getReadGroup().getId().equals(keepRG)) ) { readsToRemove.add(rec); } } activeRegion.removeAll( readsToRemove ); return readsToRemove; }
for ( int readI = 0; readI < nReadsPerLocus; readI++ ) { for ( final GATKSAMReadGroupRecord rg : readGroups ) { final String readName = String.format("%s.%d.%d.%s", baseName, locus, readI, rg.getId()); final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, readName, 0, alignmentStart + locus, readLength); read.setReadGroup(rg);
protected Set<GATKSAMRecord> filterNonPassingReads( final ActiveRegion activeRegion) { final Set<GATKSAMRecord> readsToRemove = new LinkedHashSet<>(); for( final GATKSAMRecord rec : activeRegion.getReads() ) { //TODO: Takuto points out that this is questionable. Let's think hard abut it. // KCIBUL: only perform read quality filtering on tumor reads... if (isReadFromNormal(rec)) { if( rec.getReadLength() < MIN_READ_LENGTH ) { readsToRemove.add(rec); } } else if( rec.getReadLength() < MIN_READ_LENGTH || rec.getMappingQuality() < MQthreshold || BadMateFilter.hasBadMate(rec) || (keepRG != null && !rec.getReadGroup().getId().equals(keepRG)) ) { readsToRemove.add(rec); } } activeRegion.removeAll(readsToRemove); return readsToRemove; }
@Override public Integer map(ReferenceContext referenceContext, GATKSAMRecord read, RefMetaDataTracker RefMetaDataTracker) { final String rgID = read.getReadGroup().getId(); final PerReadGroupInfo info = readGroupInfo.get(rgID); if ( info.needsMoreData() ) { info.readLength.add(read.getReadLength()); info.nReadsSeen++; if ( read.getReadPairedFlag() ) { info.nReadsPaired++; if ( read.getInferredInsertSize() != 0) { info.insertSize.add(Math.abs(read.getInferredInsertSize())); } } } return null; }