本文整理汇总了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]));
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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));
}
}
}
示例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));
}
}
示例7: getBinningParameters
import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public BinningParameters getBinningParameters() {
return params;
}
示例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");
}
}
示例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);
}
}
示例10: CGScorer
import org.seqcode.viz.metaprofile.BinningParameters; //导入依赖的package包/类
public CGScorer(BinningParameters p, SequenceGenerator sq) {
params=p;
seqgen=sq;
}