本文整理汇总了Java中htsjdk.samtools.SAMReadGroupRecord.getSample方法的典型用法代码示例。如果您正苦于以下问题:Java SAMReadGroupRecord.getSample方法的具体用法?Java SAMReadGroupRecord.getSample怎么用?Java SAMReadGroupRecord.getSample使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SAMReadGroupRecord
的用法示例。
在下文中一共展示了SAMReadGroupRecord.getSample方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSamplesFromHeader
import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
/**
* Pull out the sample names from a SAMFileHeader
*
* note that we use a TreeSet so that they are sorted
*
* @param header the sam file header
* @return list of strings representing the sample names
*/
public static Set<String> getSamplesFromHeader( final SAMFileHeader header ) {
// get all of the unique sample names
final Set<String> samples = new TreeSet<>();
final List<SAMReadGroupRecord> readGroups = header.getReadGroups();
for ( SAMReadGroupRecord readGroup : readGroups ) {
final String sample = readGroup.getSample();
if ( sample != null ) {
samples.add(sample);
}
}
return samples;
}
示例2: PicardAlignment
import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
public PicardAlignment(SAMRecord record) {
super();
this.record = record;
this.flags = record.getFlags();
String refName = record.getReferenceName();
Genome genome = GenomeManager.getInstance().getCurrentGenome();
this.chr = genome == null ? refName : genome.getCanonicalChrName(refName);
// SAMRecord is 1 based inclusive. IGV is 0 based exclusive.
this.end = record.getAlignmentEnd(); // might be modified later for soft clipping
this.start = record.getAlignmentStart() - 1; // might be modified later for soft clipping
if (record.getReadPairedFlag()) {
String mateReferenceName = record.getMateReferenceName();
String mateChr = genome == null ? mateReferenceName : genome.getCanonicalChrName(mateReferenceName);
this.setMate(new ReadMate(mateChr,
record.getMateAlignmentStart() - 1,
record.getMateNegativeStrandFlag(),
record.getMateUnmappedFlag()));
}
String keySequence = null;
SAMFileHeader header = record.getHeader();
String flowOrder = null;
if (header != null) {
readGroup = (String) record.getAttribute("RG");
if (readGroup != null) {
SAMReadGroupRecord rgRec = header.getReadGroup(readGroup);
if (rgRec != null) {
this.sample = rgRec.getSample();
this.library = rgRec.getLibrary();
flowOrder = rgRec.getFlowOrder();
keySequence = rgRec.getKeySequence();
}
}
}
Object colorTag = record.getAttribute("YC");
if (colorTag != null) {
try {
color = ColorUtilities.stringToColor(colorTag.toString(), null);
} catch (Exception e) {
log.error("Error interpreting color tag: " + colorTag, e);
}
}
setPairOrientation();
setPairStrands();
createAlignmentBlocks(record.getCigarString(), record.getReadBases(), record.getBaseQualities(),
getFlowSignals(flowOrder, keySequence), flowOrder, this.getFlowSignalsStart());
}
示例3: FingerprintIdDetails
import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
public FingerprintIdDetails(final SAMReadGroupRecord rg, final String file) {
this(rg.getPlatformUnit(), file);
this.sample = rg.getSample();
this.library = rg.getLibrary();
}
示例4: getKey
import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
@Override
protected String getKey(SAMReadGroupRecord rg) {
return rg.getSample();
}
示例5: getSampleName
import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
/**
* Returns the sample name associated with the provided read's read group.
*
* @param read read whose sample name to retrieve
* @param header SAM header containing read groups
* @return the sample name for the provided read's read group as a String,
* or null if the read has no read group.
*/
public static String getSampleName( final GATKRead read, final SAMFileHeader header ) {
final SAMReadGroupRecord readGroup = getSAMReadGroupRecord(read, header);
return readGroup != null ? readGroup.getSample() : null;
}