public UniprotProtein( String id, String primaryAc, Organism organism, String description ) { setId( id ); setOrganism( organism ); setPrimaryAc( primaryAc ); this.description = description; }
public UniprotProteinTranscriptImpl(String primaryAc, Organism organism, String sequence){ this.id = primaryAc; setPrimaryAc(primaryAc); setOrganism(organism); setSequence(sequence); }
public UniprotXref( String ac, String db ) { setAccession( ac ); setDatabase( db ); }
public UniprotFeatureChain retrieveUniprotFeatureChain( UniprotProtein uniProtEntry, String ac) { if (uniProtEntry != null && ac != null){ for (UniprotFeatureChain fc : uniProtEntry.getFeatureChains()){ String acFixed = ac; // if not of type primaryAc-PRO_xxxxx, it is not a feature chain. we have to build the feature chain ac if (ac.indexOf("-") == -1){ acFixed = uniProtEntry.getPrimaryAc() + "-" + ac; } if (acFixed.equals(fc.getPrimaryAc())){ return fc; } } } return null; } }
/** * {@inheritDoc} */ @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append( "UniprotFeatureChain" ); sb.append( "{ id='" ).append( getPrimaryAc() ).append( '\'' ); sb.append( ", sequence='" ).append( getSequence() ).append( '\'' ); sb.append( ", organism=" ).append( getOrganism() ); sb.append( ", description=" ).append( description ); sb.append( ", start=" ).append( getStart() ); sb.append( ", end=" ).append( getEnd() ); sb.append( '}' ); return sb.toString(); } }
/** * {@inheritDoc} */ @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } UniprotProteinTranscript that = ( UniprotProteinTranscript ) o; if ( !primaryAc.equals( that.getPrimaryAc() ) ) { return false; } if ( !organism.equals( that.getOrganism() ) ) { return false; } return true; }
/** * {@inheritDoc} */ @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append( "SpliceVariant" ); sb.append( "{primaryAC='" ).append( getPrimaryAc() ).append( '\'' ); sb.append( ",secondaryAcs=" ).append( secondaryAcs ); sb.append( ",sequence='" ).append( getSequence() ).append( '\'' ); sb.append( ", start=" ).append( getStart() ); sb.append( ", end=" ).append( getEnd() ); sb.append( ", note='" ).append( note ).append( '\'' ); sb.append( '}' ); return sb.toString(); } }
public UniprotSpliceVariant retrieveUniprotSpliceVariant( UniprotProtein uniProtEntry, String ac) { if (uniProtEntry != null && ac != null){ for (UniprotSpliceVariant sv : uniProtEntry.getSpliceVariants()){ if (ac.equals(sv.getPrimaryAc())){ return sv; } else if (sv.getSecondaryAcs().contains(ac)){ return sv; } } } return null; }
protected void processSpliceVariants( UniProtEntry uniProtEntry, UniprotProtein protein ) { Map<String,String> seqMap = new HashMap<String,String>(); List<UniprotSpliceVariant> spliceVariants = findSpliceVariants(uniProtEntry, protein.getOrganism(), seqMap); // add the splice variant to the original protein protein.getSpliceVariants().addAll( spliceVariants ); }
@Override public ProteinUpdateError createMatchSeveralUniprotEntriesError(String proteinAc, String uniprotAc, String taxId, UpdateError errorLabel, Collection<UniprotProtein> identitiesSameOrganism, Collection<UniprotProtein> identitiesDifferentOrganism) { MatchSeveralUniprotEntries error = new MatchSeveralUniprotEntries(null, proteinAc, uniprotAc, taxId, errorLabel); for (UniprotProtein p : identitiesSameOrganism){ error.getUniprotIdentities().add(p.getPrimaryAc()); } for (UniprotProtein p : identitiesDifferentOrganism){ error.getUniprotFromDifferentOrganisms().add(p.getPrimaryAc()); } return error; }
/** * Extract the ensembl gene accession from this uniprotProtein * @param protein : the protein * @return the ensembl gene accession (if any) of this protein, null otherwise */ public static String extractENSEMBLGeneAccessionFrom(UniprotProtein protein){ if (protein != null){ String ensemblGene = extractENSEMBLGeneAccessionFrom(protein.getCrossReferences()); return ensemblGene; } return null; }
/** * Extract the ensembl gene accession (if any) among the list of uniprot cross references * @param crossReferences : the Uniprot cross references * @return the ensembl gene accession (if any) among the list of uniprot cross references, null otherwise */ protected static String extractENSEMBLGeneAccessionFrom(Collection<UniprotXref> crossReferences){ for (UniprotXref xRef : crossReferences){ if (xRef.getDatabase() != null){ if (DatabaseType.ENSEMBL.toString().equalsIgnoreCase(xRef.getDatabase())){ String accession = xRef.getAccession(); if (ensemblGenePattern.matcher(accession).matches()){ return accession; } return xRef.getAccession(); } } } return null; }
/** * {@inheritDoc} */ @Override public int hashCode() { int result; result = id.hashCode(); result = 29 * result + organism.hashCode(); return result; }
public Organism( int taxid ) { setTaxid( taxid ); }
/** * {@inheritDoc} */ @Override public int hashCode() { int result; result = super.hashCode(); result = 31 * result + ( secondaryAcs != null ? secondaryAcs.hashCode() : 0 ); return result; }
/** * {@inheritDoc} */ @Override public boolean equals( Object o ) { boolean isEqual = super.equals(o); if (isEqual){ UniprotSpliceVariant that = ( UniprotSpliceVariant ) o; if ( secondaryAcs != null ? !secondaryAcs.equals( that.secondaryAcs ) : that.secondaryAcs != null ) { return false; } } return isEqual; }
/** * Returns sequence of the splice variant. * * @return sequence of the splice variant. */ @Override public String getSequence() { if ( super.getSequence() == null || super.getSequence().trim().length() == 0 ) { throw new IllegalArgumentException( "A splice variant must have a sequence." ); } return super.getSequence(); }
/** * {@inheritDoc} */ @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } final UniprotProtein that = (UniprotProtein) o; if ( !id.equals( that.id ) ) { return false; } if ( !organism.equals( that.organism ) ) { return false; } return true; }
/** * Get the uniprot cross references of the uniprot entry matching this accession and extract the ensembl gene accession if any * @param uniprotAccession : the uniprot accession * @return the ensembl gene accession (if any) of this protein, null otherwise * @throws StrategyException */ public static String extractENSEMBLGeneAccessionFrom(String uniprotAccession) throws StrategyException{ UniprotProtein entry = getUniprotProteinFor(uniprotAccession); if (entry != null){ String ensemblGene = extractENSEMBLGeneAccessionFrom(entry.getCrossReferences()); return ensemblGene; } else { throw new StrategyException("We couldn't find an Uniprot entry which matches this accession number " + uniprotAccession); } }
/** * {@inheritDoc} */ @Override public int hashCode() { int result; result = primaryAc.hashCode(); result = 31 * result + organism.hashCode(); return result; } }