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


Java FreqMatrixImport类代码示例

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


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

示例1: main

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
public static void main(String[] args) throws NumberFormatException, IOException{		
	ArgParser ap = new ArgParser(args);	
	String filename = ap.getKeyValue("motfile");
	FreqMatrixImport motifImport = new FreqMatrixImport();
	List<WeightMatrix> motifsets = new ArrayList<WeightMatrix>();
	motifsets.addAll(motifImport.readTransfacMatricesAsFreqMatrices(filename));
	
	int mlength=6;
	SimpleMotifAligner aligner = new SimpleMotifAligner(mlength);
	// Do pair wise-alignment
	for (int i=0; i < motifsets.size(); i++){
		for (int j=i+1; j< motifsets.size(); j++){
			Pair<Integer,Double> forAlignment = aligner.align(motifsets.get(i),motifsets.get(j));
			Pair<Integer,Double> revAlignment = aligner.align(motifsets.get(i),WeightMatrix.reverseComplement(motifsets.get(j)));
			System.out.println(motifsets.get(i).getName()+"\t"+motifsets.get(j).getName()+"\tforward: offset= "+forAlignment.car()+"\tmaxscore= "+forAlignment.cdr()/mlength);
			System.out.println(motifsets.get(i).getName()+"\t"+motifsets.get(j).getName()+"\treverse: offset= "+revAlignment.car()+"\tmaxscore= "+revAlignment.cdr()/mlength);
		}
	}
}
 
开发者ID:seqcode,项目名称:chexmix,代码行数:20,代码来源:SimpleMotifAligner.java

示例2: loadMotifsFromFile

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
public void loadMotifsFromFile(String filename){
	FreqMatrixImport motifImport = new FreqMatrixImport();
	motifImport.setBackground(motifBack);
	for(WeightMatrix wm : motifImport.readTransfacMatrices(filename)){
		motifs.put(wm.name, wm);
	}
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:8,代码来源:FigureOptions.java

示例3: loadMotifsFromFile

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
public void loadMotifsFromFile(String filename) throws NumberFormatException, IOException {
	FreqMatrixImport motifImport = new FreqMatrixImport();
	List<WeightMatrix> tmp = new ArrayList<WeightMatrix>();
	tmp.addAll(motifImport.readTransfacMatricesAsFreqMatrices(filename));
	for(String motname : rownames){
		for(WeightMatrix wm : tmp){
			if(wm.getName().equals(motname)){
				motifs.add(wm);
				break;
			}
		}
	}
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:14,代码来源:HeatMapMaker.java

示例4: loadMotifsFromFile

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
public void loadMotifsFromFile(String filename, MarkovBackgroundModel b) {
	FreqMatrixImport motifImport = new FreqMatrixImport();
	motifImport.setBackground(b);
	motifs.addAll(motifImport.readTransfacMatrices(filename));
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:6,代码来源:PrintMotifLogos.java

示例5: main

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
@SuppressWarnings("static-access")
public static void main(String[] args) throws IOException, ParseException{
	GenomeConfig gc = new GenomeConfig(args);
	ArgParser ap = new ArgParser(args);
	SimulateData sd = new SimulateData(gc);
	
	// Set motifs
	String motifFilename = ap.getKeyValue("motiffile");
	if(!ap.hasKey("motiffile")){
		System.err.println("Please provide motifs that need to be inserted!!");
		System.exit(0);
	}
	
	String backFile =ap.getKeyValue("back");
	if(!ap.hasKey("back")){
		System.err.println("Please provide a background model file!!");
		System.exit(0);
	}
	
	MarkovBackgroundModel back = BackgroundModelIO.parseMarkovBackgroundModel(backFile, gc.getGenome());
	
	FreqMatrixImport motifImport = new FreqMatrixImport();
	List<WeightMatrix> mots = new ArrayList<WeightMatrix>();
	mots.addAll(motifImport.readTransfacMatricesAsFreqMatrices(motifFilename));
	Map<String,WeightMatrix> motsWithLabs = new HashMap<String,WeightMatrix>();
	
	if(ap.hasKey("sampleOverlap"))
		sd.setRandomSampleOverlap(true);
	if(ap.hasKey("sampleInsrtrate"))
		sd.setRandomSampleInsrtRate(true);
	
	double insertRate = Args.parseDouble(args, "insrtRate", 0.7);
	sd.setInsrtRate(insertRate);
	int numType2 = Args.parseInteger(args, "numType2", 3);
	sd.setNumCategories(numType2);
	int numExamples = Args.parseInteger(args, "N", 3000);
	sd.setNum_type2_expls(numExamples);
	int numSims = Args.parseInteger(args, "numSims", 100);
	sd.setNumSims(numSims);
	int w = Args.parseInteger(args, "win", 150);
	sd.setWin(w);
	
	// Now set motif labels
	if(numType2 == 2){
		motsWithLabs.put("X", mots.get(0)); // Ebox
		motsWithLabs.put("Y", mots.get(1)); //Ebf2
		motsWithLabs.put("A", mots.get(3)); //Oct4
		motsWithLabs.put("B", mots.get(4)); //Onecut2
		
	}else if(numType2 == 3){
		motsWithLabs.put("X", mots.get(0)); // Ebox
		motsWithLabs.put("Y", mots.get(1)); //Ebf2
		motsWithLabs.put("A", mots.get(3)); //Oct4
		motsWithLabs.put("B", mots.get(4)); //Onecut2
		motsWithLabs.put("C", mots.get(5)); // GATA
	}
	
	sd.setMotifs(motsWithLabs);
	sd.setBack(back);
	sd.execute();
	
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:63,代码来源:SimulateData.java

示例6: loadMotifsFromFile

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
public void loadMotifsFromFile(String filename) throws NumberFormatException, IOException {
	FreqMatrixImport motifImport = new FreqMatrixImport();
	motifs.addAll(motifImport.readTransfacMatricesAsFreqMatrices(filename));
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:5,代码来源:SeqUnwinderSandbox.java

示例7: main

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
/***
 * Main method only for testing
 * @param args
 * @throws IOException 
 */
public static void main(String[] args) throws IOException{
	SeqUnwinderConfig scon = new SeqUnwinderConfig(args);
	ArgParser ap = new ArgParser(args);
	List<WeightMatrix> mots = new ArrayList<WeightMatrix>();
	if(ap.hasKey("motifs")){
		mots.addAll(FreqMatrixImport.readTransfacMatricesAsFreqMatrices(ap.getKeyValue("motifs")));
	}
	
	List<String> modnames = new ArrayList<String>();
	HashMap<String,double[]> kmerweights = new HashMap<String,double[]>();
	
	if(ap.hasKey("kmerWeights")){
		BufferedReader br = new BufferedReader(new FileReader(ap.getKeyValue("kmerWeights")));
		String line = null;
		
		while((line=br.readLine())!=null){
			line.trim();
			String[] pieces = line.split("\t");
			if(pieces[0].contains("Kmer")){ // header
				for(int s=1; s<pieces.length; s++){
					modnames.add(pieces[s]);
					kmerweights.put(pieces[s], new double[scon.getNumK()]);
				}
			}else{
				int ind = scon.getKmerBaseInd(pieces[0]) + RegionFileUtilities.seq2int(pieces[0]);
				for(int i = 1; i < pieces.length; i++ ){
					kmerweights.get(modnames.get(i-1))[ind] = Double.parseDouble(pieces[i]);
				}
			}
		}
		
		br.close();
	}
	
	scon.setDiscrimMotifs(mots);
	scon.setModelNames(modnames);
	scon.setWeights(kmerweights);
	
	ScoreMotif scorer = new ScoreMotif(scon);
	scorer.execute();
	HashMap<String,double[]> scores = scon.getDiscrimMotsScore();
	StringBuilder sb = new StringBuilder();
	sb.append("MotifName");sb.append("\t");
	for(String mname: modnames){
		sb.append(mname);sb.append("\t");
	}
	sb.deleteCharAt(sb.length()-1);sb.append("\n");
	for(WeightMatrix mot : mots){
		double[] scrs = scores.get(mot.getName());
		sb.append(mot.getName());sb.append("\t");
		for(int d=0; d<scrs.length; d++){
			sb.append(scrs[d]);sb.append("\t");
		}
		sb.deleteCharAt(sb.length()-1);sb.append("\n");
	}
		
	System.out.println(sb.toString());
}
 
开发者ID:seqcode,项目名称:sequnwinder,代码行数:64,代码来源:ScoreMotif.java

示例8: loadMotifsFromFile

import org.seqcode.motifs.FreqMatrixImport; //导入依赖的package包/类
public void loadMotifsFromFile(String filename) throws NumberFormatException, IOException {
	motifs.addAll(FreqMatrixImport.readTransfacMatricesAsFreqMatrices(filename));

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


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