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


Java SAMRecord.setMateNegativeStrandFlag方法代码示例

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


在下文中一共展示了SAMRecord.setMateNegativeStrandFlag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:mgarber,项目名称:scriptureV2,代码行数:38,代码来源:SAMPairedEndFileReader.java

示例2: writeRemainder

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
private void writeRemainder(Map<String, AlignmentPair> tempCollection) {
	if(tempCollection.size() > 0) {
		logger.warn("WARNING Remainder: "+tempCollection.size()+" writing as single end reads");
	}
	for(String name: tempCollection.keySet()){
		Pair<Collection<SAMRecord>> pair=tempCollection.get(name);
		Collection<SAMRecord> records;
		
		if(pair.hasValue1() && pair.hasValue2()){
			//throw new IllegalStateException("There are samples in both pairs that are unaccounted for: "+name);
			//
			//logger.error("There are samples in both pairs that are unaccounted for: "+name);
			
			Collection<SAMRecord> fragmentRecords = tempCollection.get(name).makePairs();
			//write to output
			writeAll(fragmentRecords);
		}
		else{
			if(pair.hasValue1()){records=pair.getValue1();}
			else{records=pair.getValue2();}
			
			for(SAMRecord record: records) {
				// If mate is unpaired, fix SAMRecord settings accordingly
	            
				// Why were the following changes added?  This seems to break things. -Jesse
				//record.setReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX);
	            //record.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START);
				
	            record.setMateReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX);
	            record.setMateAlignmentStart(SAMRecord.NO_ALIGNMENT_START);
	            record.setMateNegativeStrandFlag(!record.getReadNegativeStrandFlag());
	            record.setMateUnmappedFlag(true);
	            record.setAttribute(SAMTag.MQ.name(), null);
	            record.setInferredInsertSize(0);
			}
		}
	}
}
 
开发者ID:mgarber,项目名称:scriptureV2,代码行数:39,代码来源:PairedEndWriter.java

示例3: removeMate

import net.sf.samtools.SAMRecord; //导入方法依赖的package包/类
private void removeMate(SAMRecord first) {
first.setMateUnmappedFlag(true);
first.setMateAlignmentStart(0);
first.setMateNegativeStrandFlag(false);
first.setMateReferenceName("*");
  }
 
开发者ID:mgarber,项目名称:scriptureV2,代码行数:7,代码来源:FilterPairedReadsByMAQ.java


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