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;
24 import jalview.datamodel.SequenceI;
25 import jalview.io.gff.SequenceOntologyI;
27 import java.util.ArrayList;
28 import java.util.List;
31 * A client to fetch genomic sequence from Ensembl
33 * TODO: not currently used - delete?
38 public class EnsemblGenome extends EnsemblSeqProxy
41 * fetch transcript features on genomic sequence (to identify the transcript
42 * regions) and cds, exon and variation features (to retain)
44 private static final EnsemblFeatureType[] FEATURES_TO_FETCH = {
45 EnsemblFeatureType.transcript, EnsemblFeatureType.exon,
46 EnsemblFeatureType.cds, EnsemblFeatureType.variation };
49 * Default constructor (to use rest.ensembl.org)
51 public EnsemblGenome()
57 * Constructor given the target domain to fetch data from
61 public EnsemblGenome(String d)
67 public String getDbName()
69 return "ENSEMBL (Genomic)";
73 protected EnsemblSeqType getSourceEnsemblType()
75 return EnsemblSeqType.GENOMIC;
79 protected EnsemblFeatureType[] getFeaturesToFetch()
81 return FEATURES_TO_FETCH;
85 * Answers true unless the feature type is 'transcript' (or a sub-type of
86 * transcript in the Sequence Ontology), or has a parent other than the given
87 * accession id. Transcript features are only retrieved in order to identify
88 * the transcript sequence range, and are redundant information on the
89 * transcript sequence itself.
92 protected boolean retainFeature(SequenceFeature sf, String accessionId)
94 if (isTranscript(sf.getType()))
98 return featureMayBelong(sf, accessionId);
102 * Answers a list of sequence features (if any) whose type is 'transcript' (or
103 * a subtype of transcript in the Sequence Ontology), and whose ID is the
104 * accession we are retrieving.
106 * Note we also include features of type "NMD_transcript_variant", although
107 * not strictly 'transcript' in the SO, as they used in Ensembl as if they
111 protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
114 List<SequenceFeature> result = new ArrayList<>();
115 List<SequenceFeature> sfs = seq.getFeatures().getFeaturesByOntology(
116 SequenceOntologyI.TRANSCRIPT,
117 SequenceOntologyI.NMD_TRANSCRIPT_VARIANT);
118 for (SequenceFeature sf : sfs)
120 String id = (String) sf.getValue(JSON_ID);
121 if (accId.equals(id))