本文整理了Java中org.broadinstitute.gatk.utils.sam.GATKSAMRecord.setReadGroup()
方法的一些代码示例,展示了GATKSAMRecord.setReadGroup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GATKSAMRecord.setReadGroup()
方法的具体详情如下:
包路径:org.broadinstitute.gatk.utils.sam.GATKSAMRecord
类名称:GATKSAMRecord
方法名:setReadGroup
暂无
代码示例来源:origin: broadgsa/gatk-protected
public static final GATKSAMRecord addReadGroup(GATKSAMRecord rec, String readGroupName) {
GATKSAMReadGroupRecord rgRec = new GATKSAMReadGroupRecord(readGroupName);
rgRec.setSample("sample");
rec.setReadGroup(rgRec);
return rec;
}
代码示例来源:origin: broadgsa/gatk
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);
reads.add(read);
代码示例来源:origin: broadgsa/gatk-protected
public GATKSAMRecord makeRead(final int start, final int length) {
final byte[] quals = Utils.dupBytes((byte)30, length);
final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "read " + readCounter++, 0, start + getStart(), ref.substring(start, start + length).getBytes(), quals, length + "M");
read.setReadGroup(rg);
return read;
}
}
代码示例来源:origin: broadgsa/gatk
private GATKSAMRecord makeRead() {
final SAMReadGroupRecord rg = header.getReadGroups().get(0);
final String readName = String.format("%s.%d.%s", "read", readI, rg.getId());
final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, readName, 0, 1, readLength);
read.setReadGroup(new GATKSAMReadGroupRecord(rg));
if ( payloadInBytes > 0 )
// add a payload byte array to push memory use per read even higher
read.setAttribute("PL", new byte[payloadInBytes]);
return read;
}
}
代码示例来源:origin: broadgsa/gatk
/**
* Create an artificial read based on the parameters. The cigar string will be *M, where * is the length of the read
*
* @param header the SAM header to associate the read with
* @param name the name of the read
* @param refIndex the reference index, i.e. what chromosome to associate it with
* @param alignmentStart where to start the alignment
* @param bases the sequence of the read
* @param qual the qualities of the read
* @return the artificial read
*/
public static GATKSAMRecord createArtificialRead(SAMFileHeader header, String name, int refIndex, int alignmentStart, byte[] bases, byte[] qual) {
if (bases.length != qual.length) {
throw new ReviewedGATKException("Passed in read string is different length then the quality array");
}
GATKSAMRecord rec = createArtificialRead(header, name, refIndex, alignmentStart, bases.length);
rec.setReadBases(bases);
rec.setBaseQualities(qual);
rec.setReadGroup(new GATKSAMReadGroupRecord("x"));
if (refIndex == -1) {
rec.setReadUnmappedFlag(true);
}
return rec;
}
代码示例来源:origin: broadgsa/gatk
/**
* Clears all attributes except ReadGroup of the read.
*/
public GATKSAMRecord simplify () {
GATKSAMReadGroupRecord rg = getReadGroup(); // save the read group information
byte[] insQuals = (this.getAttribute(BQSR_BASE_INSERTION_QUALITIES) == null) ? null : getBaseInsertionQualities();
byte[] delQuals = (this.getAttribute(BQSR_BASE_DELETION_QUALITIES) == null) ? null : getBaseDeletionQualities();
this.clearAttributes(); // clear all attributes from the read
this.setReadGroup(rg); // restore read group
if (insQuals != null)
this.setBaseQualities(insQuals, EventType.BASE_INSERTION); // restore base insertion if we had any
if (delQuals != null)
this.setBaseQualities(delQuals, EventType.BASE_DELETION); // restore base deletion if we had any
return this;
}
代码示例来源:origin: broadgsa/gatk
private GATKSAMRecord makeOverlappingRead(final String leftFlank, final int leftQual, final String overlapBases,
final byte[] overlapQuals, final String rightFlank, final int rightQual,
final int alignmentStart) {
final String bases = leftFlank + overlapBases + rightFlank;
final int readLength = bases.length();
final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "myRead", 0, alignmentStart, readLength);
final byte[] leftQuals = Utils.dupBytes((byte) leftQual, leftFlank.length());
final byte[] rightQuals = Utils.dupBytes((byte) rightQual, rightFlank.length());
final byte[] quals = Utils.concat(leftQuals, overlapQuals, rightQuals);
read.setCigarString(readLength + "M");
read.setReadBases(bases.getBytes());
for ( final EventType type : EventType.values() )
read.setBaseQualities(quals, type);
read.setReadGroup(rgForMerged);
read.setMappingQuality(60);
return read;
}
代码示例来源:origin: broadgsa/gatk
@Test(enabled = true)
public void testMaxCyclePasses() {
int readLength = RAC.MAXIMUM_CYCLE_VALUE;
GATKSAMRecord read = ReadUtils.createRandomRead(readLength);
read.setReadPairedFlag(true);
read.setReadGroup(new GATKSAMReadGroupRecord("MY.ID"));
read.getReadGroup().setPlatform("illumina");
ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1);
covariate.recordValues(read, readCovariates);
}
}
代码示例来源:origin: broadgsa/gatk
@Test(enabled = true, expectedExceptions={UserException.class})
public void testMoreThanMaxCycleFails() {
int readLength = RAC.MAXIMUM_CYCLE_VALUE + 1;
GATKSAMRecord read = ReadUtils.createRandomRead(readLength);
read.setReadPairedFlag(true);
read.setReadGroup(new GATKSAMReadGroupRecord("MY.ID"));
read.getReadGroup().setPlatform("illumina");
ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1);
covariate.recordValues(read, readCovariates);
}
代码示例来源:origin: broadgsa/gatk
private static void runTest(final GATKSAMReadGroupRecord rg, final String expected, final ReadGroupCovariate covariate) {
GATKSAMRecord read = ReadUtils.createRandomRead(10);
read.setReadGroup(rg);
ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1);
covariate.recordValues(read, readCovariates);
verifyCovariateArray(readCovariates.getMismatchesKeySet(), expected, covariate);
}
代码示例来源:origin: broadgsa/gatk
protected GATKSAMRecord buildSAMRecord(final String readName, final String contig, final int alignmentStart) {
GATKSAMRecord record = new GATKSAMRecord(header);
record.setReadName(readName);
record.setReferenceIndex(dictionary.getSequenceIndex(contig));
record.setAlignmentStart(alignmentStart);
record.setCigarString("1M");
record.setReadString("A");
record.setBaseQualityString("A");
record.setReadGroup(readGroup);
return record;
}
代码示例来源:origin: broadgsa/gatk
allI.setReadGroup(new GATKSAMReadGroupRecord(bamBuilder.getHeader().getReadGroups().get(0)));
代码示例来源:origin: broadgsa/gatk-protected
read.setReferenceName(loc.getContig());
read.setReadNegativeStrandFlag(false);
read.setReadGroup(sampleRG(sample));
代码示例来源:origin: broadgsa/gatk
final GATKSAMReadGroupRecord rg = new GATKSAMReadGroupRecord(rgs);
rg.setPlatform("illumina");
read.setReadGroup(rg);
read.setReadNegativeStrandFlag(rnd.nextBoolean());
final byte[] mQuals = read.getBaseQualities(EventType.BASE_SUBSTITUTION);
代码示例来源:origin: broadgsa/gatk
protected GATKSAMRecord buildSAMRecord(String readName, String contig, int alignmentStart, int alignmentEnd) {
SAMFileHeader header = ArtificialSAMUtils.createDefaultReadGroup(new SAMFileHeader(), "test", "test");
header.setSequenceDictionary(dictionary);
header.setSortOrder(SAMFileHeader.SortOrder.coordinate);
GATKSAMRecord record = new GATKSAMRecord(header);
record.setReadName(readName);
record.setReferenceIndex(dictionary.getSequenceIndex(contig));
record.setAlignmentStart(alignmentStart);
Cigar cigar = new Cigar();
int len = alignmentEnd - alignmentStart + 1;
cigar.add(new CigarElement(len, CigarOperator.M));
record.setCigar(cigar);
record.setReadString(new String(new char[len]).replace("\0", "A"));
record.setBaseQualities(new byte[len]);
record.setReadGroup(new GATKSAMReadGroupRecord(header.getReadGroup("test")));
return record;
}
代码示例来源:origin: broadgsa/gatk-protected
correctedRead.setReadBases(inputRead.getReadBases());
correctedRead.setReadString(inputRead.getReadString());
correctedRead.setReadGroup(inputRead.getReadGroup());
return correctedRead;
代码示例来源:origin: broadgsa/gatk
if (samRG != null) {
GATKSAMReadGroupRecord rg = new GATKSAMReadGroupRecord(samRG);
emptyRead.setReadGroup(rg);
代码示例来源:origin: broadgsa/gatk
@Test(enabled = true)
public void testSimpleCycles() {
short readLength = 10;
GATKSAMRecord read = ReadUtils.createRandomRead(readLength);
read.setReadPairedFlag(true);
read.setReadGroup(new GATKSAMReadGroupRecord("MY.ID"));
read.getReadGroup().setPlatform("illumina");
ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1);
covariate.recordValues(read, readCovariates);
verifyCovariateArray(readCovariates.getMismatchesKeySet(), 1, (short) 1);
read.setReadNegativeStrandFlag(true);
covariate.recordValues(read, readCovariates);
verifyCovariateArray(readCovariates.getMismatchesKeySet(), readLength, -1);
read.setSecondOfPairFlag(true);
covariate.recordValues(read, readCovariates);
verifyCovariateArray(readCovariates.getMismatchesKeySet(), -readLength, 1);
read.setReadNegativeStrandFlag(false);
covariate.recordValues(read, readCovariates);
verifyCovariateArray(readCovariates.getMismatchesKeySet(), -1, -1);
}
代码示例来源:origin: broadgsa/gatk
private GATKSAMRecord createReadOffContig(final SAMFileHeader header, final boolean negStrand, final int pre, final int post) {
final int contigLen = header.getSequence(0).getSequenceLength();
final int readLen = pre + contigLen + post;
final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "read1", 0, 1, readLen);
read.setAlignmentStart(1);
read.setCigar(TextCigarCodec.decode(pre + "S" + contigLen + "M" + post + "S"));
read.setBaseQualities(Utils.dupBytes((byte) 30, readLen));
read.setReadBases(Utils.dupBytes((byte)'A', readLen));
read.setMappingQuality(60);
read.setMateAlignmentStart(1);
read.setProperPairFlag(true);
read.setReadPairedFlag(true);
read.setInferredInsertSize(30);
read.setReadNegativeStrandFlag(negStrand);
read.setMateNegativeStrandFlag(! negStrand);
read.setReadGroup(new GATKSAMReadGroupRecord("foo"));
return read;
}
代码示例来源:origin: broadgsa/gatk
setReadGroup(rg);
内容来源于网络,如有侵权,请联系作者删除!