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


Java AlignmentReaderFactory类代码示例

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


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

示例1: writeAlignmentFilePicard

import org.broad.igv.sam.reader.AlignmentReaderFactory; //导入依赖的package包/类
/**
 * Use Picard to write alignment subset, as read from a file
 * @param inlocator
 * @param outPath
 * @param sequence
 * @param start
 * @param end
 * @return
 */
public static int writeAlignmentFilePicard(ResourceLocator inlocator, String outPath,
                                            String sequence, int start, int end) throws IOException{

    checkExportableAlignmentFile(inlocator.getTypeString());

    AlignmentReader reader = AlignmentReaderFactory.getReader(inlocator);
    CloseableIterator<PicardAlignment> iter = reader.query(sequence, start, end, false);
    final SAMFileHeader fileHeader = reader.getFileHeader();

    SAMWriter writer = new SAMWriter(fileHeader);
    int count = writer.writeToFile(new File(outPath), iter, true);
    iter.close();

    return count;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:25,代码来源:SAMWriter.java

示例2: AlignmentDataManager

import org.broad.igv.sam.reader.AlignmentReaderFactory; //导入依赖的package包/类
public AlignmentDataManager(ResourceLocator locator, Genome genome) throws IOException {
    this.locator = locator;
    reader = new AlignmentTileLoader(AlignmentReaderFactory.getReader(locator));
    peStats = new HashMap();
    initLoadOptions();
    initChrMap(genome);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:8,代码来源:AlignmentDataManager.java

示例3: main

import org.broad.igv.sam.reader.AlignmentReaderFactory; //导入依赖的package包/类
public static void main(String[] args) throws IOException {

        AlignmentReader reader = AlignmentReaderFactory.getReader(args[0], false);
        CloseableIterator<Alignment> iter = reader.iterator();
        PairedEndStats stats = compute(iter, .1, 99.9);
        iter.close();
        reader.close();

        System.out.println(args[0] + "\t" + stats.averageInsertSize + "\t" + stats.medianInsertSize +
                "\t" + stats.stddevInsertSize + "\t" + stats.madInsertSize);
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:12,代码来源:PairedEndStats.java

示例4: convert

import org.broad.igv.sam.reader.AlignmentReaderFactory; //导入依赖的package包/类
public static void convert(File inputBam, File outputBed, boolean properPairs) throws IOException {

        AlignmentReader reader = null;
        CloseableIterator<Alignment> iter = null;
        PrintWriter bedWriter = null;

        int maxInsertSize = 0;

        try {
            bedWriter = new PrintWriter(new BufferedWriter(new FileWriter(outputBed)));
            reader = AlignmentReaderFactory.getReader(inputBam.getAbsolutePath(), false);
            iter = reader.iterator();

            while (iter.hasNext()) {
                Alignment a = iter.next();
                if(passFilter(a, properPairs)) {
                    int start = a.getAlignmentStart();
                    final int insertSize = Math.abs(a.getInferredInsertSize());
                    int end = properPairs ? (start + insertSize) : a.getAlignmentEnd();
                    String name = a.getReadName();
                    String strand = properPairs ? "." : (a.isNegativeStrand() ? "-" : "+");
                    bedWriter.print(a.getChr() + "\t" + start + "\t" + end + "\t" + name + "\t" + strand);
                    if(properPairs) {
                        bedWriter.println("\t" + insertSize);
                    }
                    else {
                        bedWriter.println();
                    }

                    maxInsertSize = insertSize > maxInsertSize ? insertSize : maxInsertSize;
                }

            }
        } finally {
            if(bedWriter != null) bedWriter.close();
            if(iter != null) iter.close();
            if(reader != null) reader.close();
        }
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:40,代码来源:BamToBed.java

示例5: GenericAlignmentDataModel

import org.broad.igv.sam.reader.AlignmentReaderFactory; //导入依赖的package包/类
public GenericAlignmentDataModel(String filename, String lengthFile, boolean upweightSplices, double minMappingQuality, boolean removeDuplicatesFlag, boolean weighReadCounts, String strand, boolean loadPairsAsFragments) throws IOException{
	this.minMappingQuality = minMappingQuality;
	this.alignmentFileName = filename;
	this.pairsAsFragments = loadPairsAsFragments;
	
	if (pairsAsFragments) {
		this.reader = new SAMPairedEndFileReader(new File(filename));
	} else {
		this.reader = AlignmentReaderFactory.getReader(new ResourceLocator(filename), false);
	}
	
	if(lengthFile != null && !lengthFile.isEmpty()) {
		this.chromosomeSizes=BEDFileParser.loadChrSizes(lengthFile);
	} else {
		this.chromosomeSizes = new TreeMap<String, Integer>();
		SAMSequenceDictionary dictionary = reader.getHeader().getSequenceDictionary();
		if(dictionary != null && !dictionary.getSequences().isEmpty() ) {
			List<SAMSequenceRecord> refSequences = dictionary.getSequences();
			for(SAMSequenceRecord record : refSequences) {
				chromosomeSizes.put(record.getSequenceName(), record.getSequenceLength());
			}
		} else {
			throw new IllegalArgumentException("The size file describing reference sequence length was empty and the alignment header did not contain a data dictionary");
		}
	}
	
	//this.firstReads=firstReads();
	this.cachingScoringTrees=initializeCachingTree();
	this.chunkAlignmentTree=new IntervalTree<Alignment>();
	this.chunkEnd=0;
	this.chunkStart=0;
	this.chunkChr="";
	this.currentAlignment=null;
	this.startedIteration=false;
	spliceWeightFactor=setSpliceWeight(upweightSplices);
	this.alignmentFileName = filename;
	
	Globals.setHeadless(true);
	
	
	setRemoveDuplicatesFlag(removeDuplicatesFlag);
	
	// NOTE: Minimum mapping quality will be set to zero if weighReadCounts is set to true
	setWeighReadCountsFlag(weighReadCounts);
	
	if (strand != null) {
		if("+".equals(strand)){
			this.setPositiveStranded();
		}
		else{
			this.setNegativeStranded();
		}
	}
}
 
开发者ID:mgarber,项目名称:scriptureV2,代码行数:55,代码来源:GenericAlignmentDataModel.java

示例6: BAMPairIterator

import org.broad.igv.sam.reader.AlignmentReaderFactory; //导入依赖的package包/类
public BAMPairIterator(String path) throws IOException {

        this.reader = AlignmentReaderFactory.getReader(path, false);

        this.iterator = reader.iterator();
        advance();
    }
 
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:8,代码来源:BAMPairIterator.java


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