org.broadinstitute.gatk.utils.sam.GATKSAMRecord.setReadUnmappedFlag()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(62)

本文整理了Java中org.broadinstitute.gatk.utils.sam.GATKSAMRecord.setReadUnmappedFlag()方法的一些代码示例,展示了GATKSAMRecord.setReadUnmappedFlag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GATKSAMRecord.setReadUnmappedFlag()方法的具体详情如下:
包路径:org.broadinstitute.gatk.utils.sam.GATKSAMRecord
类名称:GATKSAMRecord
方法名:setReadUnmappedFlag

GATKSAMRecord.setReadUnmappedFlag介绍

暂无

代码示例

代码示例来源:origin: broadgsa/gatk

@BeforeClass
public void init() {
  SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 1000);
  read = ArtificialSAMUtils.createArtificialRead(header, "read1", 0, 1, BASES.length());
  read.setReadUnmappedFlag(true);
  read.setReadBases(new String(BASES).getBytes());
  read.setBaseQualityString(new String(QUALS));
}

代码示例来源:origin: broadgsa/gatk

@Test( )
public void testCreationFromSAMRecordUnmapped() {
  final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "foo", 0, 1, 5);
  read.setReadUnmappedFlag(true);
  read.setReferenceIndex(-1);
  final GenomeLoc loc = genomeLocParser.createGenomeLoc(read);
  Assert.assertTrue(loc.isUnmapped());
}

代码示例来源: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

@Test( )
public void testCreationFromSAMRecordUnmappedButOnGenome() {
  final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "foo", 0, 1, 5);
  read.setReadUnmappedFlag(true);
  read.setCigarString("*");
  final GenomeLoc loc = genomeLocParser.createGenomeLoc(read);
  Assert.assertEquals(loc.getContig(), read.getReferenceName());
  Assert.assertEquals(loc.getContigIndex(), (int)read.getReferenceIndex());
  Assert.assertEquals(loc.getStart(), read.getAlignmentStart());
  Assert.assertEquals(loc.getStop(), read.getAlignmentStart());
}

代码示例来源:origin: broadgsa/gatk

record.setReadUnmappedFlag(true);

代码示例来源:origin: broadgsa/gatk-protected

@Test
  public void testUnmappedReadsDoNotFail() {
    // create an unmapped read
    final GATKSAMRecord read = new GATKSAMRecord(ArtificialSAMUtils.createArtificialSamHeader());
    read.setReadName("foo");
    read.setReferenceName("*");
    read.setAlignmentStart(100);
    read.setCigarString("*");
    read.setReadUnmappedFlag(true);

    // try to add it to the manager
    final OverhangFixingManager manager = new OverhangFixingManager(null, null, null, 100, 1, 30, false);
    manager.addRead(read); // we just want to make sure that the following call does not fail
    Assert.assertTrue(true);
  }
}

代码示例来源:origin: broadgsa/gatk

@Test(enabled = !DEBUG)
public void testUnmappedAndAllIReadsPassThrough() {
  final int readLength = 10;
  GATKSAMRecord mapped1 = ArtificialSAMUtils.createArtificialRead(header,"mapped1",0,1,readLength);
  GATKSAMRecord mapped2 = ArtificialSAMUtils.createArtificialRead(header,"mapped2",0,1,readLength);
  GATKSAMRecord unmapped = ArtificialSAMUtils.createArtificialRead(header,"unmapped",0,1,readLength);
  GATKSAMRecord allI = ArtificialSAMUtils.createArtificialRead(header,"allI",0,1,readLength);
  unmapped.setReadUnmappedFlag(true);
  unmapped.setCigarString("*");
  allI.setCigarString(readLength + "I");
  List<GATKSAMRecord> reads = Arrays.asList(mapped1, unmapped, allI, mapped2);
  // create the iterator by state with the fake reads and fake records
  li = makeLTBS(reads, DownsamplingMethod.NONE, true);
  Assert.assertTrue(li.hasNext());
  AlignmentContext context = li.next();
  ReadBackedPileup pileup = context.getBasePileup();
  Assert.assertEquals(pileup.depthOfCoverage(), 2, "Should see only 2 reads in pileup, even with unmapped and all I reads");
  final List<GATKSAMRecord> rawReads = li.transferReadsFromAllPreviousPileups();
  Assert.assertEquals(rawReads, reads, "Input and transferred read lists should be the same, and include the unmapped and all I reads");
}

代码示例来源:origin: broadgsa/gatk

read.setProperPairFlag(true);
read.setReadPairedFlag(true);
read.setReadUnmappedFlag(false);
read.setMateUnmappedFlag(false);
read.setReadBases(Utils.dupBytes((byte) 'A', readLength));

代码示例来源:origin: broadgsa/gatk

read.setReadPairedFlag(true);
read.setProperPairFlag(true);
read.setReadUnmappedFlag(false);
read.setMateUnmappedFlag(false);
read.setAlignmentStart(100);
  bad.setReadUnmappedFlag(true);
  tests.add( new Object[]{ "read is unmapped", bad, false });

代码示例来源:origin: broadgsa/gatk-protected

/**
 * Write out a representation of this haplotype as a read
 *
 * @param haplotype a haplotype to write out.  Cannot be null
 * @param paddedRefLoc the reference location.  Cannot be null
 * @param isAmongBestHaplotypes true if among the best haplotypes, false if it was just one possible but not so good
 */
private void writeHaplotype(final Haplotype haplotype,
              final GenomeLoc paddedRefLoc,
              final boolean isAmongBestHaplotypes) {
  final GATKSAMRecord record = new GATKSAMRecord(output.getHeader());
  record.setReadBases(haplotype.getBases());
  record.setAlignmentStart(paddedRefLoc.getStart() + haplotype.getAlignmentStartHapwrtRef());
  record.setBaseQualities(Utils.dupBytes((byte) '!', haplotype.getBases().length));
  record.setCigar(AlignmentUtils.consolidateCigar(haplotype.getCigar()));
  record.setMappingQuality(isAmongBestHaplotypes ? 60 : 0);
  record.setReadName("HC" + uniqueNameCounter++);
  record.setAttribute(AlignmentUtils.HAPLOTYPE_TAG,haplotype.hashCode());
  record.setReadUnmappedFlag(false);
  record.setReferenceIndex(paddedRefLoc.getContigIndex());
  record.setAttribute(SAMTag.RG.toString(), READ_GROUP_ID);
  record.setFlags(16);
  output.add(record);
}

代码示例来源:origin: broadgsa/gatk

read.setReadUnmappedFlag(true);
boundary = get.getAdaptor(read);
Assert.assertEquals(boundary, ReadUtils.CANNOT_COMPUTE_ADAPTOR_BOUNDARY);
read.setReadUnmappedFlag(false);

相关文章

微信公众号

最新文章

更多

GATKSAMRecord类方法