本文整理汇总了Java中net.sf.samtools.SAMRecord.setMateReferenceName方法的典型用法代码示例。如果您正苦于以下问题:Java SAMRecord.setMateReferenceName方法的具体用法?Java SAMRecord.setMateReferenceName怎么用?Java SAMRecord.setMateReferenceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.samtools.SAMRecord
的用法示例。
在下文中一共展示了SAMRecord.setMateReferenceName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToPairedEndFragment
import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
public static SAMRecord convertToPairedEndFragment(SAMRecord rec) {
int insertSize = Math.abs(rec.getInferredInsertSize());
//TODO: possible to remove (insertSize > 0) clause? What does an insert size of 0 mean?
if (rec.getReadPairedFlag() && rec.getProperPairFlag() && !rec.getReadUnmappedFlag()
&& (insertSize <= MAX_INSERT) && (rec.getAlignmentStart() < rec.getMateAlignmentStart())
&& rec.getReferenceName() != "chrM") // current paired end representation doesn't do well with circular chromosomes
{
//We need to get the full fragment contained by read.getStart to pair.getEnd
int readEnd=rec.getAlignmentEnd();
int mateStart=rec.getMateAlignmentStart();
//int extension = insertSize - rec.getReadLength();
int extension=(mateStart-readEnd)+rec.getReadLength();
if (extension <= MAX_INSERT) {
String newRead = rec.getReadString() + StringUtils.repeat("N", extension);
rec.setReadString(newRead);
String newQual = StringUtils.repeat("A", newRead.length());
if(!rec.getBaseQualityString().equals("*")) newQual = rec.getBaseQualityString() + StringUtils.repeat("A", extension);
rec.setBaseQualityString(newQual);
String newCigar=newRead.length()+"M";
rec.setCigarString(newCigar);
// Change attributes to represent single read
rec.setMateReferenceName("*");
rec.setMateAlignmentStart(0);
rec.setFirstOfPairFlag(false);
rec.setMateNegativeStrandFlag(false);
rec.setMateUnmappedFlag(false);
rec.setProperPairFlag(false);
rec.setReadPairedFlag(false);
rec.setSecondOfPairFlag(false);
}
} else {
rec = null;
}
return rec;
}
示例2: removeMate
import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
private void removeMate(SAMRecord first) {
first.setMateUnmappedFlag(true);
first.setMateAlignmentStart(0);
first.setMateNegativeStrandFlag(false);
first.setMateReferenceName("*");
}