private void generateChecksums(Protein p) throws BridgeFailedException { // CHECKSUMS if(p.getSequence() != null){ //TODO add an MI term if one is created p.getChecksums().add(ChecksumUtils.createChecksum("crc64", Crc64Generator.computeCrc64For(p.getSequence()))); if(p.getOrganism() != null){ try { String rogidValue = rogidGenerator.computeRogidFrom( p.getSequence(), Integer.toString(p.getOrganism().getTaxId())); p.setRogid(rogidValue); } catch (SeguidException e) { throw new BridgeFailedException( "Error was encountered whilst generating RogID in protein fetcher.",e); } } } }
if( interactor.getInteractorType() != null && RuleUtils.isProtein( ontologyManager, interactor )) { XrefUtils.searchAllXrefsHavingDatabaseAndQualifier(interactor.getIdentifiers(), Arrays.asList(Xref.UNIPROTKB_MI, Xref.REFSEQ_MI), Arrays.asList(Xref.UNIPROTKB, Xref.REFSEQ), Arrays.asList(Xref.IDENTITY_MI), Arrays.asList(Xref.IDENTITY)); if (interactor.getSequence() != null){ MiContext context = RuleUtils.buildContext(interactor, "interactor"); messages=Collections.singletonList(new ValidatorMessage("Proteins should have a Xref to UniProtKB or RefSeq with a ref type 'identity' ",
public void map(Protein p) throws BridgeFailedException { String newID = null; if(p.getSequence() != null) { newID = localRemap.get(p.getSequence()); if(newID != null){ p.setUniprotkb(newID); if( listener != null ) listener.onSuccessfulMapping(p, Collections.<String>emptyList()); } return; } if(! p.getXrefs().isEmpty()) { newID = localRemap.get(p.getXrefs().iterator().next().getId()); if(newID != null){ p.setUniprotkb(newID); if( listener != null ) listener.onSuccessfulMapping(p, Collections.<String>emptyList()); } return; } if( listener != null ) listener.onFailedMapping(p, Collections.<String>emptyList()); }
p.setFullName(fullName); p.setUniprotkb(firstAc.getValue()); p.getIdentifiers().add(XrefUtils.createUniprotSecondary(id.getValue())); p.setOrganism(UniprotUtils.createOrganismFromEntry(entry)); break; case DESCRIBED: p.setSequence(entry.getSplicedSequence(isoform.getName().getValue())); break; case DISPLAYED: p.setSequence(entry.getSplicedSequence(isoform.getName().getValue())); break; case EXTERNAL: if(g.hasGeneName()) p.getAliases().add(AliasUtils.createGeneName(g.getGeneName().getValue())); p.getAliases().add( AliasUtils.createGeneNameSynonym(gns.getValue())); p.getAliases().add( AliasUtils.createOrfName(orf.getValue())); p.getAliases().add( AliasUtils.createLocusName(oln.getValue())); p.getAliases().add( AliasUtils.createIsoformSynonym( syn.getValue() )); p.getXrefs().add(XrefUtils.createXrefWithQualifier(Xref.UNIPROTKB , Xref.UNIPROTKB_MI, entry.getPrimaryUniProtAccession().getValue() , Xref.ISOFORM_PARENT, Xref.ISOFORM_PARENT_MI));
proteinToMap.setUniprotkb(identifierResult.getFinalUniprotId()); if(listener != null){ listener.onSuccessfulMapping(proteinToMap ,report ); IdentificationResults sequenceMapping = identifyProtein(proteinToMap.getSequence(), context); if (sequenceMapping == null || ! sequenceMapping.hasUniqueUniprotId()){ report.push("Sequence mapping FAILED: No mapping found for sequence."); proteinToMap.setUniprotkb(sequenceMapping.getFinalUniprotId()); if(listener != null){ listener.onSuccessfulMapping(proteinToMap ,report );
private void mapAllIdentifiersFor(Protein prot, IdentificationContext context) throws BridgeFailedException { //Populate the list for(Xref xref : prot.getIdentifiers()){ IdentificationResults result = identifyProtein(xref, context); identifierMappingResults.put(xref, result); if (result != null){ for (Object obj : result.getListOfActions()){ report.push(obj.toString()); } } } }
public static Protein createProteinRogid(String name, String rogid){ Protein protein = new DefaultProtein(name); protein.setRogid(rogid); return protein; }
/** * Maps the provided protein to a uniprot identifier. * @param proteinToMap the protein to be Mapped */ public void map(Protein proteinToMap) throws BridgeFailedException { if(proteinToMap == null){ throw new IllegalArgumentException("Cannot remap a null protein"); } clear(); IdentificationContext context = new IdentificationContext(); if( proteinToMap.getOrganism() != null ) context.setOrganism(new BioSource(proteinToMap.getOrganism().getCommonName() != null ? proteinToMap.getOrganism().getCommonName() : "not specified", Integer.toString(proteinToMap.getOrganism().getTaxId()))); if(priorityIdentifiers == prioritySequence) mapWithBothPriorities(proteinToMap, context); else if(priorityIdentifiers) mapWithPriorityToIdentifiers(proteinToMap, context); else if(prioritySequence) mapWithPriorityToSequence(proteinToMap, context); }
id = chainFeature.getFeatureId().getValue(); p = new DefaultProtein(id.toLowerCase()); p.setFullName(chainFeature.getFeatureDescription().getValue()); break; case PEPTIDE: id = peptideFeature.getFeatureId().getValue(); p = new DefaultProtein(id.toLowerCase()); p.setFullName(peptideFeature.getFeatureDescription().getValue()); break; case PROPEP: id = proPepFeature.getFeatureId().getValue(); p = new DefaultProtein(id.toLowerCase()); p.setFullName(proPepFeature.getFeatureDescription().getValue()); break; default: p.setUniprotkb(primaryAc); p.setSequence(entry.getSequence().subSequence(begin,end).getValue()); p.setOrganism(UniprotUtils.createOrganismFromEntry(entry)); if(g.hasGeneName()) p.getAliases().add(AliasUtils.createGeneName(g.getGeneName().getValue())); p.getAliases().add( AliasUtils.createGeneNameSynonym(gns.getValue())); p.getAliases().add( AliasUtils.createOrfName(orf.getValue()));
throws BridgeFailedException { report.push("Priority to sequence."); IdentificationResults sequenceMapping = identifyProtein(proteinToMap.getSequence(), context); if (sequenceMapping == null || ! sequenceMapping.hasUniqueUniprotId()){ report.push("Sequence mapping FAILED: No mapping found for sequence."); proteinToMap.setUniprotkb(sequenceMapping.getFinalUniprotId()); if(listener != null){ listener.onSuccessfulMapping(proteinToMap ,report ); proteinToMap.setUniprotkb(identifierResult.getFinalUniprotId()); if(listener != null){ listener.onSuccessfulMapping(proteinToMap ,report );
private IdentificationResults mapFirstValidIdentifierFor(Protein prot, IdentificationContext context) throws BridgeFailedException { //Populate the list for(Xref xref : prot.getIdentifiers()){ IdentificationResults result = identifyProtein(xref, context); if (result != null){ for (Object obj : result.getListOfActions()){ report.push(obj.toString()); } if (result.getFinalUniprotId() != null){ return result; } } } return null; }
p.setFullName(fullName); p.setUniprotkb(entity.getPrimaryUniProtAccession().getValue()); && ! entity.getSecondaryUniProtAccessions().isEmpty()) { for(SecondaryUniProtAccession ac : entity.getSecondaryUniProtAccessions()){ p.getIdentifiers().add( XrefUtils.createUniprotSecondary(ac.getValue())); p.getAliases().add(AliasUtils.createGeneName(g.getGeneName().getValue())); && !g.getGeneNameSynonyms().isEmpty()){ for(GeneNameSynonym gns : g.getGeneNameSynonyms()){ p.getAliases().add(AliasUtils.createGeneNameSynonym(gns.getValue())); && !g.getORFNames().isEmpty()){ for(ORFName orf : g.getORFNames()){ p.getAliases().add(AliasUtils.createOrfName(orf.getValue())); && !g.getOrderedLocusNames().isEmpty()){ for(OrderedLocusName oln : g.getOrderedLocusNames()){ p.getAliases().add(AliasUtils.createLocusName(oln.getValue())); Collection<Xref> dbxrefStandardised = createXrefsFrom(dbxref); if(dbxrefStandardised != null && !dbxrefStandardised.isEmpty()){ p.getXrefs().addAll(dbxrefStandardised); p.setSequence(entity.getSequence().getValue());
IdentificationResults sequenceMapping = identifyProtein(proteinToMap.getSequence(), context); if (sequenceMapping == null || ! sequenceMapping.hasUniqueUniprotId()){ report.push("Sequence mapping FAILED: No mapping found for sequence."); proteinToMap.setUniprotkb(sequenceMapping.getFinalUniprotId()); proteinToMap.setUniprotkb(identifierResult.getFinalUniprotId()); proteinToMap.setUniprotkb(sequenceMapping.getFinalUniprotId()); if(listener != null){ listener.onSuccessfulMapping(proteinToMap ,report ); proteinToMap.setUniprotkb(identifierResult.getFinalUniprotId()); if(listener != null){ listener.onSuccessfulMapping(proteinToMap ,report );