1 package jalview.ext.ensembl;
3 import jalview.datamodel.AlignmentI;
4 import jalview.datamodel.SequenceFeature;
6 import java.util.Arrays;
9 import com.stevesoft.pat.Regex;
11 public class EnsemblProtein extends EnsemblSeqProxy
13 // TODO modify to accept other species e.g. ENSMUSPnnn
14 private static final Regex ACCESSION_REGEX = new Regex(
15 "(ENSP|CCDS)[0-9.]{3,}$");
17 private static final List<String> CROSSREFS = Arrays.asList(new String[] {
18 "PDB", "Uniprot/SPTREMBL", "Uniprot/SWISSPROT" });
20 public EnsemblProtein()
26 public String getDbName()
28 return "ENSEMBL (Protein)";
32 protected EnsemblSeqType getSourceEnsemblType()
34 return EnsemblSeqType.PROTEIN;
38 * Returns false, as this fetcher does not retrieve DNA sequences.
41 public boolean isDnaCoding()
47 * Test query is to the protein translation of transcript ENST00000288602
50 public String getTestQuery()
52 return "ENSP00000288602";
56 * Overrides base class method to do nothing - genomic features are not
57 * applicable to the protein product sequence
60 protected void addFeaturesAndProduct(String accId, AlignmentI alignment)
65 protected EnsemblFeatureType[] getFeaturesToFetch()
67 // not applicable - can't fetch genomic features for a protein sequence
72 protected boolean identifiesSequence(SequenceFeature sf, String accId)
74 // not applicable - protein sequence is not a 'subset' of genomic sequence
79 protected List<String> getCrossReferenceDatabases()
85 public Regex getAccessionValidator()
87 return ACCESSION_REGEX;
91 * Returns an accession id for a query, including conversion of ENST* to
92 * ENSP*. This supports querying for the protein sequence for a transcript
93 * (ENST identifier) and returning the ENSP identifier.
96 public String getAccessionIdFromQuery(String query)
98 String accId = super.getAccessionIdFromQuery(query);
101 * ensure last character before (11) digits is P
102 * ENST00000288602 -> ENSP00000288602
103 * ENSMUST00000288602 -> ENSMUSP00000288602
105 if (accId != null && accId.length() >= 12)
107 char[] chars = accId.toCharArray();
108 chars[chars.length - 12] = 'P';
109 accId = new String(chars);