001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package org.biojava.nbio.genome.homology; 022 023import org.biojava.nbio.genome.query.BlastXMLQuery; 024 025import java.io.File; 026import java.util.ArrayList; 027import java.util.LinkedHashMap; 028 029/** 030 * 031 * @author Scooter Willis <willishf at gmail dot com> 032 */ 033public class BlastHomologyHits { 034 035 static public LinkedHashMap<String, ArrayList<String>> getMatches(File xmlBlastHits, double ecutoff) throws Exception { 036 LinkedHashMap<String, ArrayList<String>> homologyHits = new LinkedHashMap<String, ArrayList<String>>(); 037 BlastXMLQuery blastXMLQuery = new BlastXMLQuery(xmlBlastHits.getAbsolutePath()); 038 LinkedHashMap<String, ArrayList<String>> hits = blastXMLQuery.getHitsQueryDef(ecutoff); 039 for (String accessionid : hits.keySet()) { 040 String[] data = accessionid.split(" "); // deal with notes/comments in blast results 041 String id = data[0]; 042 ArrayList<String> uniprotProteinHits = hits.get(accessionid); 043 homologyHits.put(id, uniprotProteinHits); 044 045 } 046 return homologyHits; 047 } 048}