public GATKSAMReadGroupRecord(SAMReadGroupRecord record) { super(record.getReadGroupId(), record); }
public void addReadGroup(final SAMReadGroupRecord readGroup) { if (mReadGroupMap.containsKey(readGroup.getReadGroupId())) { throw new IllegalArgumentException("Read group with group id " + readGroup.getReadGroupId() + " already exists in SAMFileHeader!"); } mReadGroups.add(readGroup); mReadGroupMap.put(readGroup.getReadGroupId(), readGroup); }
public void addReadGroup(final SAMReadGroupRecord readGroup) { if (mReadGroupMap.containsKey(readGroup.getReadGroupId())) { throw new IllegalArgumentException("Read group with group id " + readGroup.getReadGroupId() + " already exists in SAMFileHeader!"); } mReadGroups.add(readGroup); mReadGroupMap.put(readGroup.getReadGroupId(), readGroup); }
public void addReadGroup(final SAMReadGroupRecord readGroup) { if (mReadGroupMap.containsKey(readGroup.getReadGroupId())) { throw new IllegalArgumentException("Read group with group id " + readGroup.getReadGroupId() + " already exists in SAMFileHeader!"); } mReadGroups.add(readGroup); mReadGroupMap.put(readGroup.getReadGroupId(), readGroup); }
/** * Replace entire list of read groups. The given list is stored, not copied. */ public void setReadGroups(final List<SAMReadGroupRecord> readGroups) { mReadGroups = readGroups; mReadGroupMap.clear(); for (final SAMReadGroupRecord readGroupRecord : readGroups) { mReadGroupMap.put(readGroupRecord.getReadGroupId(), readGroupRecord); } }
/** * Replace entire list of read groups. The given list is stored, not copied. */ public void setReadGroups(final List<SAMReadGroupRecord> readGroups) { mReadGroups = readGroups; mReadGroupMap.clear(); for (final SAMReadGroupRecord readGroupRecord : readGroups) { mReadGroupMap.put(readGroupRecord.getReadGroupId(), readGroupRecord); } }
/** * Replace entire list of read groups. The given list is stored, not copied. */ public void setReadGroups(final List<SAMReadGroupRecord> readGroups) { mReadGroups = readGroups; mReadGroupMap.clear(); for (final SAMReadGroupRecord readGroupRecord : readGroups) { mReadGroupMap.put(readGroupRecord.getReadGroupId(), readGroupRecord); } }
private static String stratifyReadGroup(final SAMRecord sam) { return sam.getReadGroup().getReadGroupId(); } }
private static String stratifyReadGroup(final SAMRecord sam) { return sam.getReadGroup().getReadGroupId(); } }
public boolean filterOut( final SAMRecord read ) { final SAMReadGroupRecord readGroup = read.getReadGroup(); return !( readGroup != null && readGroup.getReadGroupId().equals( READ_GROUP_TO_KEEP ) ); } }
private void pruneReadGroups(final SAMFileHeader header) { if (readGroupsToKeep.isEmpty()) return; final List<SAMReadGroupRecord> readGroups = new ArrayList<>(); for (final SAMReadGroupRecord rg : header.getReadGroups()) { if (readGroupsToKeep.contains(rg.getReadGroupId())) readGroups.add(rg); } header.setReadGroups(readGroups); } }
private boolean compareReadGroup(final SAMReadGroupRecord samReadGroupRecord1, final SAMReadGroupRecord samReadGroupRecord2) { boolean ret = compareValues(samReadGroupRecord1.getReadGroupId(), samReadGroupRecord2.getReadGroupId(), "Read Group ID"); ret = compareValues(samReadGroupRecord1.getSample(), samReadGroupRecord2.getSample(), "Sample for read group " + samReadGroupRecord1.getReadGroupId()) && ret; ret = compareValues(samReadGroupRecord1.getLibrary(), samReadGroupRecord2.getLibrary(), "Library for read group " + samReadGroupRecord1.getReadGroupId()) && ret; final String[] attributes = {"DS", "PU", "PI", "CN", "DT", "PL"}; for (final String attribute : attributes) { ret = compareValues(samReadGroupRecord1.getAttribute(attribute), samReadGroupRecord2.getAttribute(attribute), attribute + " for read group " + samReadGroupRecord1.getReadGroupId()) && ret; } return ret; }
protected String getRGLine(final SAMReadGroupRecord readGroup) { final String[] fields = new String[2 + readGroup.getAttributes().size()]; fields[0] = HEADER_LINE_START + HeaderRecordType.RG; fields[1] = SAMReadGroupRecord.READ_GROUP_ID_TAG + TAG_KEY_VALUE_SEPARATOR + readGroup.getReadGroupId(); encodeTags(readGroup, fields, 2); return StringUtil.join(FIELD_SEPARATOR, fields); }
protected String getRGLine(final SAMReadGroupRecord readGroup) { final String[] fields = new String[2 + readGroup.getAttributes().size()]; fields[0] = HEADER_LINE_START + HeaderRecordType.RG; fields[1] = SAMReadGroupRecord.READ_GROUP_ID_TAG + TAG_KEY_VALUE_SEPARATOR + readGroup.getReadGroupId(); encodeTags(readGroup, fields, 2); return StringUtil.join(FIELD_SEPARATOR, fields); }
private void writeRGLine(final SAMReadGroupRecord readGroup) { final String[] fields = new String[2 + readGroup.getAttributes().size()]; fields[0] = HEADER_LINE_START + HeaderRecordType.RG; fields[1] = SAMReadGroupRecord.READ_GROUP_ID_TAG + TAG_KEY_VALUE_SEPARATOR + readGroup.getReadGroupId(); encodeTags(readGroup, fields, 2); println(StringUtil.join(FIELD_SEPARATOR, fields)); }
@Test public void testReadGroupIdGetters() throws Exception { final SAMReadGroupRecord rg = new SAMReadGroupRecord("rg1"); Assert.assertEquals(rg.getId(), "rg1"); Assert.assertEquals(rg.getReadGroupId(), "rg1"); }
/** * Returns the ID for a read group given its index. * * @param index the index of the targeted read group in the range * [1,{@link #getReadGroupCount()}] * @return never <code>null</code> and must be unique to each * possible read group index. */ protected final String getReadGroupId(final int index) { checkReadGroupIndex(index); return getHeader().getReadGroups().get(index - 1).getReadGroupId(); }
private void validateReadGroup(final SAMRecord record, final SAMFileHeader header) { final SAMReadGroupRecord rg = record.getReadGroup(); if (rg == null) { addError(new SAMValidationError(Type.RECORD_MISSING_READ_GROUP, "A record is missing a read group", record.getReadName())); } else if (header.getReadGroup(rg.getId()) == null) { addError(new SAMValidationError(Type.READ_GROUP_NOT_FOUND, "A record has a read group not found in the header: ", record.getReadName() + ", " + rg.getReadGroupId())); } }
private void validateReadGroup(final SAMRecord record, final SAMFileHeader header) { final SAMReadGroupRecord rg = record.getReadGroup(); if (rg == null) { addError(new SAMValidationError(Type.RECORD_MISSING_READ_GROUP, "A record is missing a read group", record.getReadName())); } else if (header.getReadGroup(rg.getId()) == null) { addError(new SAMValidationError(Type.READ_GROUP_NOT_FOUND, "A record has a read group not found in the header: ", record.getReadName() + ", " + rg.getReadGroupId())); } }
private void validateReadGroup(final SAMRecord record, final SAMFileHeader header) { final SAMReadGroupRecord rg = record.getReadGroup(); if (rg == null) { addError(new SAMValidationError(Type.RECORD_MISSING_READ_GROUP, "A record is missing a read group", record.getReadName())); } else if (header.getReadGroup(rg.getId()) == null) { addError(new SAMValidationError(Type.READ_GROUP_NOT_FOUND, "A record has a read group not found in the header: ", record.getReadName() + ", " + rg.getReadGroupId())); } }