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


Java ProteinSequence.setAccession方法代码示例

本文整理汇总了Java中org.biojava.nbio.core.sequence.ProteinSequence.setAccession方法的典型用法代码示例。如果您正苦于以下问题:Java ProteinSequence.setAccession方法的具体用法?Java ProteinSequence.setAccession怎么用?Java ProteinSequence.setAccession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.biojava.nbio.core.sequence.ProteinSequence的用法示例。


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

示例1: swAlignment

import org.biojava.nbio.core.sequence.ProteinSequence; //导入方法依赖的package包/类
private void  swAlignment() throws CompoundNotFoundException {

        ProteinSequence s1 = new ProteinSequence(query);
        s1.setAccession(new AccessionID("Query"));

        ProteinSequence s2 = new ProteinSequence(subject);
        s2.setAccession(new AccessionID("Subject"));

        SubstitutionMatrix<AminoAcidCompound> matrix
                = SimpleSubstitutionMatrix.getBlosum62();


        alignment =  Alignments.getPairwiseAlignment(s1, s2,
                        Alignments.PairwiseSequenceAlignerType.LOCAL,
                        new SimpleGapPenalty(), matrix);

        FractionalSimilarityScorer<ProteinSequence, AminoAcidCompound> scorer =
                new FractionalSimilarityScorer<>(alignment);
        score = scorer.getScore();
    }
 
开发者ID:CameronTolooee,项目名称:Mendel,代码行数:21,代码来源:SmithWaterman.java

示例2: getProteinSequences

import org.biojava.nbio.core.sequence.ProteinSequence; //导入方法依赖的package包/类
public LinkedHashMap<String, ProteinSequence> getProteinSequences() throws Exception {
	LinkedHashMap<String, ProteinSequence> proteinSequenceList = new LinkedHashMap<String, ProteinSequence>();
	ArrayList<Element> elementList = XMLHelper.selectElements(geneidDoc.getDocumentElement(), "prediction/gene/protein");
	logger.info("{} hits", elementList.size());

	for (Element proteinElement : elementList) {
		Element geneElement = (Element) proteinElement.getParentNode();
		String sequence = proteinElement.getTextContent().replaceAll("\\W","");
		ProteinSequence proteinSequence = new ProteinSequence(sequence);
		String idGene = geneElement.getAttribute("idGene");
		proteinSequence.setAccession(new AccessionID(idGene));
		proteinSequenceList.put(idGene, proteinSequence);
	}

	return proteinSequenceList;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:17,代码来源:GeneIDXMLReader.java

示例3: toProteinMSA

import org.biojava.nbio.core.sequence.ProteinSequence; //导入方法依赖的package包/类
/**
 * Convert a MultipleAlignment into a MultipleSequenceAlignment of AminoAcid
 * residues. This method is only valid for protein structure alignments.
 *
 * @param msta
 *            Multiple Structure Alignment
 * @return MultipleSequenceAlignment of protein sequences
 * @throws CompoundNotFoundException
 */
public static MultipleSequenceAlignment<ProteinSequence, AminoAcidCompound> toProteinMSA(
		MultipleAlignment msta) throws CompoundNotFoundException {

	// Check that the alignment is of protein structures
	Group g = msta.getAtomArrays().get(0)[0].getGroup();
	if (!(g instanceof AminoAcid)) {
		throw new IllegalArgumentException(
				"Cannot convert to multiple sequence alignment: "
						+ "the structures aligned are not proteins");
	}

	MultipleSequenceAlignment<ProteinSequence, AminoAcidCompound> msa = new MultipleSequenceAlignment<ProteinSequence, AminoAcidCompound>();

	Map<String, Integer> uniqueID = new HashMap<String, Integer>();
	List<String> seqs = getSequenceAlignment(msta);
	for (int i = 0; i < msta.size(); i++) {
		// Make sure the identifiers are unique (required by AccessionID)
		String id = msta.getStructureIdentifier(i).toString();
		if (uniqueID.containsKey(id)) {
			uniqueID.put(id, uniqueID.get(id) + 1);
			id += "_" + uniqueID.get(id);
		} else
			uniqueID.put(id, 1);

		AccessionID acc = new AccessionID(id);
		ProteinSequence pseq = new ProteinSequence(seqs.get(i));
		pseq.setAccession(acc);
		msa.addAlignedSequence(pseq);
	}
	return msa;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:41,代码来源:MultipleAlignmentTools.java

示例4: setup

import org.biojava.nbio.core.sequence.ProteinSequence; //导入方法依赖的package包/类
@Before
public void setup() throws CompoundNotFoundException {
	query = new ProteinSequence("ARND");
	target = new ProteinSequence("RDG");
	query.setAccession(new AccessionID("Query"));
	target.setAccession(new AccessionID("Target"));
	global = new SimpleProfile<ProteinSequence, AminoAcidCompound>(query, target, Arrays.asList(new Step[] {
			Step.COMPOUND, Step.COMPOUND, Step.COMPOUND, Step.COMPOUND, Step.GAP}), 0, 0, Arrays.asList(
			new Step[] {Step.GAP, Step.COMPOUND, Step.GAP, Step.COMPOUND, Step.COMPOUND}), 0, 0);
	local = new SimpleProfile<ProteinSequence, AminoAcidCompound>(query, target, Arrays.asList(new Step[] {
			Step.COMPOUND, Step.COMPOUND, Step.COMPOUND}), 1, 0, Arrays.asList(new Step[] { Step.COMPOUND,
			Step.GAP, Step.COMPOUND}), 0, 1);
	single = new SimpleProfile<ProteinSequence, AminoAcidCompound>(query);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:15,代码来源:SimpleProfileTest.java

示例5: process

import org.biojava.nbio.core.sequence.ProteinSequence; //导入方法依赖的package包/类
/**
 * Convert a Uniprot sequence file to a fasta file. Allows you to download all sequence data for a species
 * and convert to fasta to be used in a blast database
 * @param uniprotDatFileName
 * @param fastaFileName
 * @throws Exception
 */

public void process( String uniprotDatFileName,String fastaFileName ) throws Exception{

		FileReader fr = new FileReader(uniprotDatFileName);
		BufferedReader br = new BufferedReader(fr);
		String line = br.readLine();
		String id = "";
		StringBuffer sequence = new StringBuffer();
		ArrayList<ProteinSequence> seqCodingRegionsList = new ArrayList<ProteinSequence>();
		int count = 0;
		HashMap<String,String> uniqueGenes = new HashMap<String,String>();
		HashMap<String,String> uniqueSpecies = new HashMap<String,String>();
		while(line != null){
			if(line.startsWith("ID")){
				String[] data = line.split(" ");
				id = data[3];
			}else if(line.startsWith("SQ")){
				line = br.readLine();
				while(!line.startsWith("//")){

					for(int i = 0; i < line.length(); i++){
						char aa = line.charAt(i);
						if((aa >= 'A' && aa <= 'Z') || (aa >= 'a' && aa <= 'z' )){
							sequence.append(aa);
						}
					}
					line = br.readLine();
				}

			 //   System.out.println(">" + id);
			 //   System.out.println(sequence.toString());

				ProteinSequence seq = new ProteinSequence(sequence.toString() );
				seq.setAccession(new AccessionID(id));

				seqCodingRegionsList.add(seq);
				sequence = new StringBuffer();
				count++;
				if(count % 100 == 0)
					logger.info("Count: ", count);
				String[] parts = id.split("_");
				uniqueGenes.put(parts[0], "");
				uniqueSpecies.put(parts[1],"");
			}
			line = br.readLine();
		}
   //     System.out.println("Unique Genes=" + uniqueGenes.size());
   //     System.out.println("Unique Species=" + uniqueSpecies.size());
   //     System.out.println("Total sequences=" + seqCodingRegionsList.size());
		FastaWriterHelper.writeProteinSequence(new File(fastaFileName), seqCodingRegionsList);

		br.close();
		fr.close();

  //      System.out.println(uniqueGenes.keySet());
  //      System.out.println("====================");
  //      System.out.println(uniqueSpecies.keySet());


}
 
开发者ID:biojava,项目名称:biojava,代码行数:68,代码来源:UniprotToFasta.java


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