本文整理汇总了Java中net.sf.samtools.SAMFileReader.setValidationStringency方法的典型用法代码示例。如果您正苦于以下问题:Java SAMFileReader.setValidationStringency方法的具体用法?Java SAMFileReader.setValidationStringency怎么用?Java SAMFileReader.setValidationStringency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.samtools.SAMFileReader
的用法示例。
在下文中一共展示了SAMFileReader.setValidationStringency方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sourceReads
import net.sf.samtools.SAMFileReader; //导入方法依赖的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();
}
示例2: SAMStats
import net.sf.samtools.SAMFileReader; //导入方法依赖的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();
}
示例3: BamRegionsMap
import net.sf.samtools.SAMFileReader; //导入方法依赖的package包/类
public BamRegionsMap(File bamfile, GenomeInfo ginfo, String validate, int minmapqual) throws IOException {
this.ginfo = ginfo;
this.minmapqual = minmapqual;
if (bamfile != null) {
bamreader = new SAMFileReader(bamfile);
if (validate.equals("STRICT")) {
bamreader.setValidationStringency(SAMFileReader.ValidationStringency.STRICT);
} else if (validate.equals("LENIENT")) {
bamreader.setValidationStringency(SAMFileReader.ValidationStringency.LENIENT);
} else {
bamreader.setValidationStringency(SAMFileReader.ValidationStringency.SILENT);
}
bamiterator = bamreader.iterator();
if (bamiterator.hasNext()) {
record = bamiterator.next();
curchr = record.getReferenceName();
}
} else {
bamreader = null;
bamiterator = null;
}
regions = new HashMap<Integer, ArrayList<SAMRecord>>(128);
}
示例4: run
import net.sf.samtools.SAMFileReader; //导入方法依赖的package包/类
@Override
public void run() {
theslog.log(true, "Pass one: " + bamfile.getAbsolutePath());
// set up input/output objects using SAM library
SAMFileReader inputSam = new SAMFileReader(bamfile);
inputSam.setValidationStringency(SAMFileReader.ValidationStringency.SILENT);
for (final SAMRecord record : inputSam) {
if (record.getReadUnmappedFlag()) {
// if read is unaligned, output coordinates into a bed file
processOneUnalignedRecord(record);
} else {
// if aligned, then make thesaurus entries
int mapqual = record.getMappingQuality();
// only consider reads with a minimum mapping quality
// (this here is not a "real" mapping quality, but a proxy for number of mismatches)
if (mapqual >= minmapqual) {
// check that read is aligned
processOneRecord(record);
}
}
}
// and close the input file stream
inputSam.close();
}
示例5: read_Reads
import net.sf.samtools.SAMFileReader; //导入方法依赖的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;
}
示例6: sourceReads
import net.sf.samtools.SAMFileReader; //导入方法依赖的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();
}
示例7: countReads
import net.sf.samtools.SAMFileReader; //导入方法依赖的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();
}