2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ext.ensembl;
23 import jalview.datamodel.SequenceFeature;
26 * A client to fetch genomic sequence from Ensembl
28 * TODO: not currently used - delete?
33 public class EnsemblGenome extends EnsemblSeqProxy
36 * fetch transcript features on genomic sequence (to identify the transcript
37 * regions) and cds, exon and variation features (to retain)
39 private static final EnsemblFeatureType[] FEATURES_TO_FETCH = {
40 EnsemblFeatureType.transcript, EnsemblFeatureType.exon,
41 EnsemblFeatureType.cds, EnsemblFeatureType.variation };
44 * Default constructor (to use rest.ensembl.org)
46 public EnsemblGenome()
52 * Constructor given the target domain to fetch data from
56 public EnsemblGenome(String d)
62 public String getDbName()
64 return "ENSEMBL (Genomic)";
68 protected EnsemblSeqType getSourceEnsemblType()
70 return EnsemblSeqType.GENOMIC;
74 protected EnsemblFeatureType[] getFeaturesToFetch()
76 return FEATURES_TO_FETCH;
80 * Answers true unless the feature type is 'transcript' (or a sub-type of
81 * transcript in the Sequence Ontology), or has a parent other than the given
82 * accession id. Transcript features are only retrieved in order to identify
83 * the transcript sequence range, and are redundant information on the
84 * transcript sequence itself.
87 protected boolean retainFeature(SequenceFeature sf, String accessionId)
89 if (isTranscript(sf.getType()))
93 return featureMayBelong(sf, accessionId);
97 * Answers true if the sequence feature type is 'transcript' (or a subtype of
98 * transcript in the Sequence Ontology), and the ID of the feature is the
99 * transcript we are retrieving
102 protected boolean identifiesSequence(SequenceFeature sf, String accId)
104 if (isTranscript(sf.getType()))
106 String id = (String) sf.getValue("ID");
107 if (("transcript:" + accId).equals(id))