public Object clone() throws CloneNotSupportedException { final Set<TMHMMLocation> clonedLocations = new HashSet<TMHMMLocation>(this.getLocations().size()); for (TMHMMLocation location : this.getLocations()) { clonedLocations.add((TMHMMLocation) location.clone()); } return new TMHMMMatch(this.getSignature(), clonedLocations); }
private Set<TMHMMProtein> createProteinsWithMatches(Map<String, Set<TMHMMMatch>> seqIdMatchMap) { Set<TMHMMProtein> result = new HashSet<TMHMMProtein>(); for (String id : seqIdMatchMap.keySet()) { //Create a new protein TMHMMProtein protein = new TMHMMProtein(id); //Add matches to protein Set<TMHMMMatch> matches = seqIdMatchMap.get(id); protein.addAllMatches(matches); //Add new protein to result map result.add(protein); // if (LOGGER.isDebugEnabled()) { for (TMHMMMatch match : matches) { for (TMHMMMatch.TMHMMLocation location : match.getLocations()) { LOGGER.debug(id + " " + location.getPrediction() + " " + location.getStart() + " " + location.getEnd() + " " + location.getScore()); } } } } return result; }
private Set<TMHMMProtein> createProteinsWithMatches(Map<String, Set<TMHMMMatch>> seqIdMatchMap) { Set<TMHMMProtein> result = new HashSet<TMHMMProtein>(); for (String id : seqIdMatchMap.keySet()) { //Create a new protein TMHMMProtein protein = new TMHMMProtein(id); //Add matches to protein Set<TMHMMMatch> matches = seqIdMatchMap.get(id); protein.addAllMatches(matches); //Add new protein to result map result.add(protein); // if (LOGGER.isDebugEnabled()) { for (TMHMMMatch match : matches) { for (TMHMMMatch.TMHMMLocation location : match.getLocations()) { LOGGER.debug(id + " " + location.getPrediction() + " " + location.getStart() + " " + location.getEnd() + " " + location.getScore()); } } } } return result; }
private Set<TMHMMProtein> createProteinsWithMatches(Map<String, Set<TMHMMMatch>> seqIdMatchMap) { Set<TMHMMProtein> result = new HashSet<TMHMMProtein>(); for (String id : seqIdMatchMap.keySet()) { //Create a new protein TMHMMProtein protein = new TMHMMProtein(id); //Add matches to protein Set<TMHMMMatch> matches = seqIdMatchMap.get(id); protein.addAllMatches(matches); //Add new protein to result map result.add(protein); // if (LOGGER.isDebugEnabled()) { for (TMHMMMatch match : matches) { for (TMHMMMatch.TMHMMLocation location : match.getLocations()) { LOGGER.debug(id + " " + location.getPrediction() + " " + location.getStart() + " " + location.getEnd() + " " + location.getScore()); } } } } return result; }
private Set<TMHMMProtein> createProteinsWithMatches(Map<String, Set<TMHMMMatch>> seqIdMatchMap) { Set<TMHMMProtein> result = new HashSet<TMHMMProtein>(); for (String id : seqIdMatchMap.keySet()) { //Create a new protein TMHMMProtein protein = new TMHMMProtein(id); //Add matches to protein Set<TMHMMMatch> matches = seqIdMatchMap.get(id); protein.addAllMatches(matches); //Add new protein to result map result.add(protein); // if (LOGGER.isDebugEnabled()) { for (TMHMMMatch match : matches) { for (TMHMMMatch.TMHMMLocation location : match.getLocations()) { LOGGER.debug(id + " " + location.getPrediction() + " " + location.getStart() + " " + location.getEnd() + " " + location.getScore()); } } } } return result; }
@Transactional public void persist(Set<TMHMMProtein> proteins) { //load TMHMM signatures from database and map them by accession Map<String, Signature> sigAccToDbSignatureMap = loadPersistedSignatures(); //load proteins from database and map them by protein identifier Map<String, Protein> proteinIdToProteinMap = getProteinIdToProteinMap(proteins); for (TMHMMProtein protein : proteins) { final Protein persistentProtein = proteinIdToProteinMap.get(protein.getProteinIdentifier()); if (persistentProtein == null) { throw new IllegalArgumentException("Attempting to store a TMHMM match for a protein with id " + protein.getProteinIdentifier() + ", however this does not exist in the database."); } for (TMHMMMatch match : protein.getMatches()) { final Signature signature = sigAccToDbSignatureMap.get(match.getSignature().getAccession()); TMHMMMatch newMatch = new TMHMMMatch(signature, signature.getAccession(), match.getLocations()); persistentProtein.addMatch(newMatch); entityManager.persist(newMatch); } } }