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


Java ValidationStringency类代码示例

本文整理汇总了Java中net.sf.samtools.SAMFileReader.ValidationStringency的典型用法代码示例。如果您正苦于以下问题:Java ValidationStringency类的具体用法?Java ValidationStringency怎么用?Java ValidationStringency使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sourceReads

import net.sf.samtools.SAMFileReader.ValidationStringency; //导入依赖的package包/类
/**
 * Get the reads from the appropriate source (implementation-specific).
 * Loads data to the fivePrimesList and hitsCountList
 */
public void sourceReads() {
	this.initialize();
	SAMFileReader reader = new SAMFileReader(file);
	reader.setValidationStringency(ValidationStringency.SILENT);
	CloseableIterator<SAMRecord> iter = reader.iterator();
	Collection<SAMRecord> byRead = new ArrayList<SAMRecord>();
	String lastread = null;
	while (iter.hasNext()) {
	    SAMRecord record = iter.next();
	    
	    if (record.getReadUnmappedFlag()) {continue; }
	    if (lastread == null || !lastread.equals(record.getReadName())) {
	    	processRead(byRead);
	    	byRead.clear();
	    }
	    lastread = record.getReadName();
	    byRead.add(record);
		    
	}
	processRead(byRead);
	iter.close();
	reader.close();
   }
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:28,代码来源:SAMFileHitLoader.java

示例2: SAMStats

import net.sf.samtools.SAMFileReader.ValidationStringency; //导入依赖的package包/类
public SAMStats(boolean bowtie1, boolean bowtie2){
this.bowtie1 = bowtie1;
this.bowtie2 = bowtie2;
histo = new RealValuedHistogram(0, 1000, 100);
SAMFileReader reader = new SAMFileReader(System.in);
reader.setValidationStringency(ValidationStringency.SILENT);
      CloseableIterator<SAMRecord> iter = reader.iterator();
      while (iter.hasNext()) {
          SAMRecord record = iter.next();
          if(readLen==-1)
          	readLen = record.getReadLength();
          if(bowtie1)
          	processBT1SAMRecord(record);
          else if(bowtie2)
          	processBT2SAMRecord(record);
          else
          	processSAMRecord(record);
      }
      iter.close();
      reader.close();        
  }
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:22,代码来源:SAMStats.java

示例3: read_Reads

import net.sf.samtools.SAMFileReader.ValidationStringency; //导入依赖的package包/类
/**
 * Reads the read alignments
 * reference ID format is
 *   [genome|nogenome]:[library]:[referenceID]
 * e.g.
 *   genome:miRNA:hsa-mir-486-1:MI0002470:Homo:sapiens:miR-486:stem-loop
 * 
 * @param path_readAlignments
 * @throws IOException 
 */

public boolean read_Reads(SAMFileReader inputSam) throws IOException{
	inputSam.setValidationStringency(ValidationStringency.SILENT);
	//inputSam.setValidationStringency(ValidationStringency.LENIENT);

	// TODO: put this if/else back when we're done testing
	//if(inputSam.getFileHeader().getSortOrder().equals(SAMFileHeader.SortOrder.queryname)){
	SAMRecord thisRecord;
	HashMap<SAMRecord, String> thisRead = new HashMap<SAMRecord, String>(); 
	SAMRecordIterator it = inputSam.iterator();
	String lastReadID = null;
	while(it.hasNext()){
		//count++;
		thisRecord = it.next();

		//System.out.println(thisRecord.getReferenceName());
		if(!thisRecord.getReadName().equals(lastReadID)  &&  lastReadID != null){
			// new, non first
			assignRead(thisRead);
			thisRead = new HashMap<SAMRecord, String>();
		}

		// put the SAM record into the map with the library type as the value
		//thisRead.put(thisRecord, thisRecord.getReferenceName().split(":")[1]);

		if(_forceLibrary != null)
			thisRead.put(thisRecord, _forceLibrary);
		else
			thisRead.put(thisRecord, thisRecord.getReferenceName().split(":")[0]);
		lastReadID = thisRecord.getReadName();

	}
	// assign the final read!
	if(thisRead.size() > 0)
		assignRead(thisRead);

	/*}else{
	Thunder.printLineErr("ERROR: Input SAM file must be sorted by readID");
	inputSam.close();
	return false;
	}*/

	inputSam.close();
	return true;
}
 
开发者ID:gersteinlab,项目名称:exceRpt,代码行数:56,代码来源:ProcessEndogenousAlignments.java

示例4: sourceReads

import net.sf.samtools.SAMFileReader.ValidationStringency; //导入依赖的package包/类
/**
 * Get the reads from the appropriate source (implementation-specific).
 * Loads data to the fivePrimesList and hitsCountList
 */
public void sourceReads() {
	this.initialize();
	SAMFileReader reader = new SAMFileReader(file);
	reader.setValidationStringency(ValidationStringency.SILENT);
	CloseableIterator<SAMRecord> iter = reader.iterator();
	while (iter.hasNext()) {
	    SAMRecord record = iter.next();
	    
	    if (record.getReadUnmappedFlag()) {continue; }
	    float weight = 1/(float)record.getIntegerAttribute("NH");
	    
	    Read currRead = new Read();
        
	    List<AlignmentBlock> blocks = record.getAlignmentBlocks();
	    for(int a=0; a<blocks.size(); a++){ //Iterate over alignment blocks
	    	AlignmentBlock currBlock = blocks.get(a);
	    	int aStart = currBlock.getReferenceStart();
	    	int aEnd = aStart + currBlock.getLength()-1;
	    	int aLen = currBlock.getLength();
	    	boolean nearbyBlocks=true;
	    	while(nearbyBlocks && a<blocks.size()-1){
	    		if(blocks.get(a+1).getReferenceStart() - currBlock.getReferenceStart() < record.getReadLength()){
	    			aEnd = blocks.get(a+1).getReferenceStart() + blocks.get(a+1).getLength()-1;
	    			aLen += blocks.get(a+1).getLength();
	    			a++;
	    		}else{
	    			nearbyBlocks=false;
	    		}
	    	}
	    	
	    	ReadHit currHit = new ReadHit(
	    			record.getReferenceName().replaceFirst("^chr", ""),
	    			aStart, aEnd,
	    			record.getReadNegativeStrandFlag() ? '-' : '+',
	    			weight);
	   
	    	currRead.addHit(currHit);
		}	
	    addHits(currRead);
	}
	iter.close();
	reader.close();
   }
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:48,代码来源:TophatFileHitLoader.java

示例5: countReads

import net.sf.samtools.SAMFileReader.ValidationStringency; //导入依赖的package包/类
protected void countReads() {
readLength=-1;
totalHits=0;
totalWeight=0;

SAMFileReader reader = new SAMFileReader(inFile);
reader.setValidationStringency(ValidationStringency.SILENT);
CloseableIterator<SAMRecord> iter = reader.iterator();
while (iter.hasNext()) {
    currID++;
    SAMRecord record = iter.next();
    
    if (record.getReadUnmappedFlag()) {continue; }
    float weight = 1/(float)record.getIntegerAttribute("NH");
    if(readLength ==-1)
    	readLength = record.getReadLength();
    
    Read currRead = new Read((int)totalWeight);
       
    List<AlignmentBlock> blocks = record.getAlignmentBlocks();
    for(int a=0; a<blocks.size(); a++){ //Iterate over alignment blocks
    	AlignmentBlock currBlock = blocks.get(a);
    	int aStart = currBlock.getReferenceStart();
    	int aEnd = aStart + currBlock.getLength()-1;
    	int aLen = currBlock.getLength();
    	boolean nearbyBlocks=true;
    	while(nearbyBlocks && a<blocks.size()-1){
    		if(blocks.get(a+1).getReferenceStart() - currBlock.getReferenceStart() < record.getReadLength()){
    			aEnd = blocks.get(a+1).getReferenceStart() + blocks.get(a+1).getLength()-1;
    			aLen += blocks.get(a+1).getLength();
    			a++;
    		}else{
    			nearbyBlocks=false;
    		}
    	}
    	
    	ReadHit currHit = new ReadHit(gen,
			  currID,
			  record.getReferenceName().replaceFirst("^chr", ""), 
			  aStart, aEnd, 
			  record.getReadNegativeStrandFlag() ? '-' : '+',
			  weight);
   
    	currRead.addHit(currHit);
    	currID++;
	}	
    addHits(currRead);
    totalWeight++;
}
iter.close();
reader.close();
populateArrays();
  }
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:54,代码来源:TophatSAMReader.java


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