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


Java BinningParameters类代码示例

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


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

示例1: printProfile

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public void printProfile(){
	
	BinningParameters params = new BinningParameters(winSize, nbins);
	double[] cumalativeProfile = new double[params.getNumBins()];
	CGScorer scorer = new CGScorer(params,seqgen);
	for(Region r : regions){
		CGScoreProfile profile = scorer.execute(r);
		double[] CGs = profile.getCGpercProfile();
		for(int i=0; i<CGs.length; i++){
			cumalativeProfile[i] = cumalativeProfile[i]+CGs[i];
		}
				
	}
	
	for(int i=0; i<cumalativeProfile.length; i++){
		cumalativeProfile[i] = cumalativeProfile[i]/regions.size();
		System.out.println(Integer.toString(i)+"\t"+Double.toString(cumalativeProfile[i]));
	}	
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:20,代码来源:CGstatAnalysisSandbox.java

示例2: Stranded5PrimeProfiler

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public Stranded5PrimeProfiler(GenomeConfig genConfig, BinningParameters ps, ExperimentCondition cond, char strand, int fivePrimeShift, char base, int baseRelPosition) {
	genome = genConfig.getGenome();
	condition = cond;
	params = ps;
	this.strand = strand;
	this.base = base;
	this.baseRelPosition = baseRelPosition;
	this.fivePrimeShift=fivePrimeShift;
	
	if(base != '.'){
		seqgen = genConfig.getSequenceGenerator();
	}
}
 
开发者ID:seqcode,项目名称:chexmix,代码行数:14,代码来源:Stranded5PrimeProfiler.java

示例3: MetaNonFrameMultiSet

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public MetaNonFrameMultiSet(List<String> setNames, Genome g, BinningParameters bps, PointProfiler pp, boolean normalizedMeta) {
	peakScale = new PaintableScale(0.0, 1.0);
	
	genome = g;
	params = bps;
	for(int i=0; i<setNames.size(); i++){
		MetaProfileHandler handler = new MetaProfileHandler(setNames.get(i), params, pp, normalizedMeta);
		handlers.add(handler);
		profiles.add(handler.getProfile());
	}
	utils = new MetaUtils(genome);
	
	panel = new MultiProfilePanel(profiles, peakScale);
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:15,代码来源:MetaNonFrameMultiSet.java

示例4: MetaNonFrame

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public MetaNonFrame(Genome g, BinningParameters bps, PointProfiler pp, boolean normalizedMeta, boolean svg) {
	peakScale = new PaintableScale(0.0, 1.0);
	lineScale = new PaintableScale(0.0, 1.0);
	
	genome = g;
	params = bps;
	handler = new MetaProfileHandler("MetaProfile", params, pp, normalizedMeta);
	profile = handler.getProfile();
	linePanel = new ProfileLinePanel(params, lineScale);
	profile.addProfileListener(linePanel);
	utils = new MetaUtils(genome);
	saveSVG = svg;
	panel = new ProfilePanel(profile, peakScale);
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:15,代码来源:MetaNonFrame.java

示例5: printCGhills

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public void printCGhills(String modName){
	System.out.println("#Hill\t"+"HillSeq\t"+modName+"_MotifScore\t"+"fractionCG");
	//First get the k-mer for the given list of motifs
	HashSet<String> motifKmers = new HashSet<String>();
	for(WeightMatrix mot : motifs){
		motifKmers.addAll(WeightMatrix.getConsensusKmerList(mot, Kmin, Kmax));
	}
	
	for(Region hillreg : hills){
		String hillSeq = seqgen.execute(hillreg).toUpperCase();
		double score=0.0;
		for(int k=Kmin; k<=Kmax; k++){
			for(int j=0; j<hillSeq.length()-k+1; j++){
				String currk = hillSeq.substring(j, j+k);
				String revcurrk = SequenceUtils.reverseComplement(currk);
				if(motifKmers.contains(currk) || motifKmers.contains(revcurrk)){
					int  currKInt = RegionFileUtilities.seq2int(currk);
					int  revCurrKInt = RegionFileUtilities.seq2int(revcurrk);
					int kmer = currKInt<revCurrKInt ? currKInt : revCurrKInt;
					int baseInd = this.getKmerBaseInd(currk);
					score = score+kmerweights.get(modName)[baseInd+kmer];
				}
			}
		}
		//Now if th motif score is less check for CGs
		if(score < motifScoreThresh){
			BinningParameters params = new BinningParameters(hillreg.getWidth(), hillreg.getWidth());
			CGScorer scorer = new CGScorer(params,seqgen);
			int MaxCG = (int)hillreg.getWidth()/2;
			CGScoreProfile profile = scorer.execute(hillreg);
			int total = profile.getCGcount();
			double perc = total/(double)MaxCG;
			if(perc > CGPercCutoff)
				System.out.println(hillreg.toString()+"\t"+hillSeq+"\t"+Double.toString(score)+"\t"+Double.toString(perc));
		}
		
	}

}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:40,代码来源:HillsAnalysisSandbox.java

示例6: printTotals

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public void printTotals(){
	BinningParameters params = new BinningParameters(winSize, nbins);
	CGScorer scorer = new CGScorer(params,seqgen);
	int MaxCG = (int)winSize/2;
	for(Region r : regions){
		CGScoreProfile profile = scorer.execute(r);
		int total = profile.getCGcount();
		double perc = total/(double)MaxCG;
		System.out.println(r.getMidpoint().getLocationString()+"\t"+Double.toString(perc));
	}
	
	
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:14,代码来源:CGstatAnalysisSandbox.java

示例7: getBinningParameters

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public BinningParameters getBinningParameters() {
	return params;
}
 
开发者ID:seqcode,项目名称:chexmix,代码行数:4,代码来源:Stranded5PrimeProfiler.java

示例8: printMotifProfiles

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public void printMotifProfiles(int winLen, int bins){
	BinningParameters params = new BinningParameters(winLen, bins);
	for(int x=0; x<peaks.size(); x++){
		Point a = peaks.get(x);
		double[] array = new double[params.getNumBins()];
		for(int i = 0; i < array.length; i++) { array[i] = 0; }
		
		int window = params.getWindowSize();
		int left = window/2;
		int right = window-left-1;
		
		int start = Math.max(1, a.getLocation()-left);
		int end = Math.min(a.getLocation()+right, a.getGenome().getChromLength(a.getChrom()));
		Region query = new Region(gen, a.getChrom(), start, end);
		boolean strand = (a instanceof StrandedPoint) ? 
				((StrandedPoint)a).getStrand() == '+' : true;
		
		String seq = seqgen.execute(query);
		WeightMatrixScoreProfile profiler = scorer.execute(seq);
		for(int i=query.getStart(); i<query.getEnd(); i+=params.getBinSize()){
			double maxScore=Double.MIN_VALUE;
			int maxPos=0;
			for(int j=i; j<i+params.getBinSize() && j<query.getEnd(); j++){
				int offset = j-query.getStart();
				
				if(profiler.getMaxScore(offset)>maxScore){
					maxScore= profiler.getMaxScore(offset); 
					maxPos=offset;					
				}
			}
			if(maxScore>=motifThres){
				int startbin, stopbin;

				startbin = params.findBin(maxPos);
				stopbin = params.findBin(maxPos+motif.length()-1);
				
				if(!strand) { 
					int tmp = (params.getNumBins()-stopbin)-1;
					stopbin = (params.getNumBins()-startbin)-1;
					startbin = tmp;
				}
				double percScore = maxScore / motif.getMaxScore();
				for(int k = startbin; k <= stopbin; k++) { 
					array[k] = Math.max(array[k],percScore);
				}
			}
		}
		//Print the vector
		System.out.print(a);
		for(int z=0; z<array.length; z++){
			System.out.print("\t"+array[z]);
		}System.out.print("\n");
	}
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:55,代码来源:MotifAnalysisSandbox.java

示例9: paintComponent

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
protected void paintComponent(Graphics g) {
	int w = getWidth(), h = getHeight();
	super.paintComponent(g);
	Graphics2D g2 = (Graphics2D)g;
	if(!transparent){
		g2.setColor(Color.white);
		g2.fillRect(0, 0, w, h);
	}
	profilePainter.setColor(peakColor);
	profilePainter.setStyle(style);
	profilePainter.paintItem(g, border, 0, w, h-border);
	
	int binPix = w / (profile.length()+1);
	
	//Paint labels & Y-axis stuff 
	FontMetrics metrics;
	g2.setFont(new Font("Arial", Font.PLAIN, fontSize));
	metrics = g2.getFontMetrics();
	g2.setColor(Color.black);
	if(profile.max()<10 && profile.max()>1)
		g2.drawString(String.format("%.2f", scale.getMax()), border/2, fontSize);
	else if(profile.max()>=1 || profile.max()==0)
		g2.drawString(String.format("%.0f", scale.getMax()), border/2, fontSize);
	else
		g2.drawString(String.format("%.2e", scale.getMax()), border/2, fontSize);
	if(profile.min()==0 || profile.min()<=-1)
		g2.drawString(String.format("%.0f", scale.getMin()), border/2, h-border-1);
	else
		g2.drawString(String.format("%.2e", scale.getMin()), border/2, h-border-1);
	String counter=String.format("%d datapoints", profile.getNumProfiles());
	g2.drawString(counter, w-border-metrics.stringWidth(counter), fontSize);
	//X-axis
	int xaxispos=h-border;
	if(profile.min()<0){
		double frac =scale.getMax()/(scale.getMax()-scale.getMin());
		xaxispos = (int)((double)((h-border-1))*frac);
		g2.drawString("0", border/2, xaxispos);
	}
	g2.setColor(Color.DARK_GRAY);
	g2.drawLine(border, h-border, (binPix*profile.length())+border, h-border);
	BinningParameters bps = profile.getBinningParameters();
	String minVal = String.format("%d", -1*(bps.getWindowSize()/2));
	String maxVal = String.format("%d", (bps.getWindowSize()/2));
	g2.drawString(maxVal, border+(binPix*profile.length())-metrics.stringWidth(maxVal), h);
	g2.drawString(minVal, border, h);
	
	//Title 
	
	//Draw marker line
	g2.setColor(Color.black);
	if(profile.isStranded()){
		g2.setStroke(new BasicStroke((float)lineWidth));	
		int [] a=new int [7];
		int [] b=new int [7];
		arrangeArrow(a, b, lineHeight, border+(binPix*(profile.length()/2)), border+(binPix*(profile.length()/2))+150, h-border);
           g2.drawPolyline(a, b, 7);
	}else{
           g2.fillRect(border+(binPix*(profile.length()/2))-lineWidth/2, h-lineHeight-(border/2), lineWidth, lineHeight);
	}
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:61,代码来源:ProfilePanel.java

示例10: CGScorer

import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public CGScorer(BinningParameters p, SequenceGenerator sq) {
	 params=p;
	 seqgen=sq;
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:5,代码来源:CGScorer.java


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