Java Code Examples for htsjdk.samtools.SAMFileHeader#getReadGroup()
The following examples show how to use
htsjdk.samtools.SAMFileHeader#getReadGroup() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Merge.java From cramtools with Apache License 2.0 | 6 votes |
private static SAMFileHeader mergeHeaders(List<RecordSource> sources) { SAMFileHeader header = new SAMFileHeader(); for (RecordSource source : sources) { SAMFileHeader h = source.reader.getFileHeader(); for (SAMSequenceRecord seq : h.getSequenceDictionary().getSequences()) { if (header.getSequenceDictionary().getSequence(seq.getSequenceName()) == null) header.addSequence(seq); } for (SAMProgramRecord pro : h.getProgramRecords()) { if (header.getProgramRecord(pro.getProgramGroupId()) == null) header.addProgramRecord(pro); } for (String comment : h.getComments()) header.addComment(comment); for (SAMReadGroupRecord rg : h.getReadGroups()) { if (header.getReadGroup(rg.getReadGroupId()) == null) header.addReadGroup(rg); } } return header; }
Example 2
Source File: LibraryIdGenerator.java From picard with MIT License | 5 votes |
/** * Gets the library name from the header for the record. If the RG tag is not present on * the record, or the library isn't denoted on the read group, a constant string is * returned. */ public static String getLibraryName(final SAMFileHeader header, final SAMRecord rec) { final String readGroupId = (String) rec.getAttribute(ReservedTagConstants.READ_GROUP_ID); if (readGroupId != null) { final SAMReadGroupRecord rg = header.getReadGroup(readGroupId); if (rg != null) { final String libraryName = rg.getLibrary(); if (null != libraryName) return libraryName; } } return UNKNOWN_LIBRARY; }
Example 3
Source File: LibraryIdGenerator.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Gets the library name from the header for the read group id. If the read group id is null * or the library isn't denoted on the read group, a constant string is * returned. */ public static String getLibraryName(final SAMFileHeader header, String readGroupId) { if (readGroupId != null) { final SAMReadGroupRecord rg = header.getReadGroup(readGroupId); if (rg != null) { final String libraryName = rg.getLibrary(); if (null != libraryName) return libraryName; } } return UNKNOWN_LIBRARY; }