当前位置: 首页>>代码示例>>Java>>正文


Java SAMRecord.setAlignmentStart方法代码示例

本文整理汇总了Java中net.sf.samtools.SAMRecord.setAlignmentStart方法的典型用法代码示例。如果您正苦于以下问题:Java SAMRecord.setAlignmentStart方法的具体用法?Java SAMRecord.setAlignmentStart怎么用?Java SAMRecord.setAlignmentStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.samtools.SAMRecord的用法示例。


在下文中一共展示了SAMRecord.setAlignmentStart方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAlignmentOfRecord

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
@Test
public void testAlignmentOfRecord() throws Exception {
    SAMRecord record = new SAMRecord(this.header);
    record.setReadBases("TCCGTTAGTC".getBytes());
    record.setReadName(queryName);
    record.setCigarString("1S3M1I4M1S");
    record.setReferenceIndex(0);
    record.setReferenceName(this.referenceName);
    record.setAlignmentStart(2);

    assertEquals(referenceName, record.getReferenceName());

    Alignment result = SAMBEASTUtils.alignmentOfRecord(record, this.reference);
    assertEquals(2, result.getTaxonCount());
    assertEquals(new String(reference), result.getAlignedSequenceString(0));
    assertEquals("-CCGTAGT-", result.getAlignedSequenceString(1));
    assertEquals(referenceName, result.getTaxonId(0));
    assertEquals(queryName, result.getTaxonId(1));
}
 
开发者ID:cmccoy,项目名称:startreerenaissance,代码行数:20,代码来源:SAMBEASTUtilsTestCase.java

示例2: toSAMRecord

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
@Override
public final SAMRecord toSAMRecord() {
	SAMRecord record = firstMate.toSAMRecord();
	
	record.setAttribute(PairedEndWriter.readStartFlag, Integer.valueOf(firstMate.getSAMStart()));
	record.setAttribute(PairedEndWriter.readCigarFlag, firstMate.getCigarString());
	record.setAttribute(PairedEndWriter.mateSequenceFlag, secondMate.getReadSequence());
	record.setAttribute(PairedEndWriter.mateCigarFlag, secondMate.getCigarString());
	
	record.setMateAlignmentStart(secondMate.getSAMStart());
	// add by @zhuxp
       record.setAlignmentStart(this.getAlignmentStart()+1);
    
	// end of add (test version)
       
       Annotation fragment = getReadAlignmentBlocks(null);
	record.setCigarString(fragment.getLengthOnReference() + "M");  // NOTE: losing information about indels in the SingleEndAlignments	
	record.setInferredInsertSize(fragment.getLengthOnReference());

	return record;
}
 
开发者ID:mgarber,项目名称:scriptureV2,代码行数:22,代码来源:AbstractPairedEndAlignment.java

示例3: createSAMRecord

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
/**
 * Converts a blat psl entry into a SAM record.
 *
 * @param entry
 * @param bases
 * @param hh
 * @param ns
 *
 * number of blat entries with the same score
 *
 * @param sd
 *
 * rank-dependent interpretation. For first rank, distance to next best
 * match. For other ranks distance from first match.
 *
 * @param bs
 *
 * number of matches in best score
 *
 * @param matchrankA
 *
 * rank of this blat entry in a sorted list of entries (low rank means
 * better alignment, modulo equal matching entries)
 *
 * @param matchrankB
 *
 * alternative rank (optimistic/pessimistic rank)
 *
 * @param readgroup
 *
 * @return
 */
private SAMRecord createSAMRecord(PslEntry entry, String bases, SAMFileHeader hh,
        int ns, int sd, int bs, int matchrankA, int matchrankB, String readgroup) {

    //System.out.println("in create pair");

    SAMRecord sr = new SAMRecord(hh);

    // set flags for a neutral read
    sr.setFlags(0);
    sr.setAlignmentStart(entry.Tstart + 1);
    sr.setMateAlignmentStart(entry.Tstart + 1);
    sr.setCigarString(entry.makeCigar());
    sr.setReferenceName(entry.Tname);
    sr.setReadName(entry.Qname);
    sr.setMappingQuality(Math.min(254, entry.match));
    if (entry.strand == '-') {
        sr.setReadNegativeStrandFlag(true);
        sr.setReadBases(SequenceComplementer.complement(bases.getBytes()));
    } else {
        sr.setReadNegativeStrandFlag(false);
        sr.setReadBases(bases.getBytes());
    }
    sr.setBaseQualityString(makeBaseQuality(bases.length()));
    sr.setAttribute("ns", ns);
    sr.setAttribute("sd", sd);
    sr.setAttribute("bs", bs);
    sr.setAttribute("ra", matchrankA);
    sr.setAttribute("rb", matchrankB);
    sr.setAttribute("RG", readgroup);

    return sr;
}
 
开发者ID:tkonopka,项目名称:GeneticThesaurus,代码行数:65,代码来源:ThesaurusBlat.java

示例4: getSAMRecord

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
public SAMRecord getSAMRecord(SAMFileHeader hh) {
    SAMRecord sr = new SAMRecord(hh);

    // set flags for a neutral read
    sr.setFlags(0);
    sr.setReadName(getReadname());
    sr.setBaseQualityString(makeBaseQuality(readsequence.length));
    sr.setAttribute("RG", "thesalign");
    sr.setNotPrimaryAlignmentFlag(!isPrimary());
    sr.setAlignmentStart(alignpos + 1);
    sr.setCigarString(readsequence.length + "M");
    sr.setReferenceName(chrom);
    sr.setMappingQuality(mappingquality);
    if (negativestrand) {
        sr.setReadNegativeStrandFlag(true);
        sr.setReadBases(SequenceComplementer.complement(readsequence));
    } else {
        sr.setReadNegativeStrandFlag(false);
        sr.setReadBases(readsequence);
    }

    // perhaps the read is unaligned (too many alignments to report)
    if (unmapped) {
        sr.setReadUnmappedFlag(unmapped);
    }

    return sr;
}
 
开发者ID:tkonopka,项目名称:GeneticThesaurus,代码行数:29,代码来源:ThesaurusAlign.java

示例5: TestObjectFactory

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
public TestObjectFactory() {
	samFileHeader = getInstance();

	samRecord1 = new SAMRecord(samFileHeader);
	samRecord2 = new SAMRecord(samFileHeader);
	samRecord3 = new SAMRecord(samFileHeader);

	for (SAMRecord samRecord : new SAMRecord[] { samRecord1, samRecord2, samRecord3 }) {
		samRecord.setReferenceIndex(0);
	}
	samRecord1.setMappingQuality(0);
	samRecord2.setMappingQuality(255);
	samRecord3.setMappingQuality(10);

	samRecord1.setFlags(1027);
	samRecord2.setFlags(513);
	samRecord3.setFlags(1026);

	samRecord1.setAlignmentStart(0);
	samRecord2.setAlignmentStart(500);
	samRecord3.setAlignmentStart(1500);
	
	samRecord1.setCigar(buildCigar(901));
	samRecord2.setCigar(buildCigar(1601));
	samRecord3.setCigar(buildCigar(1001));
	
	samRecord1.setBaseQualities(convertToByte(new int[]{5, 1, 4})); // avg 3
	samRecord2.setBaseQualities(convertToByte(new int[]{5, 0, 5})); // avg 3
	samRecord3.setBaseQualities(convertToByte(new int[]{1,20,2,3,4,5}));// avg 6
	
	samRecord1.setInferredInsertSize(3);
	samRecord2.setInferredInsertSize(-1);
	samRecord3.setInferredInsertSize(3);
	
	samRecords.add(samRecord1);
	samRecords.add(samRecord2);
	samRecords.add(samRecord3);
}
 
开发者ID:s-andrews,项目名称:BamQC,代码行数:39,代码来源:TestObjectFactory.java


注:本文中的net.sf.samtools.SAMRecord.setAlignmentStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。