1 package jalview.ext.ensembl;
3 import jalview.analysis.AlignmentUtils;
4 import jalview.datamodel.Alignment;
5 import jalview.datamodel.AlignmentI;
6 import jalview.datamodel.DBRefEntry;
7 import jalview.datamodel.DBRefSource;
8 import jalview.datamodel.Mapping;
9 import jalview.datamodel.SequenceFeature;
10 import jalview.datamodel.SequenceI;
11 import jalview.exceptions.JalviewException;
12 import jalview.io.FastaFile;
13 import jalview.io.FileParse;
14 import jalview.io.gff.SequenceOntologyFactory;
15 import jalview.io.gff.SequenceOntologyI;
16 import jalview.schemes.ResidueProperties;
17 import jalview.util.DBRefUtils;
18 import jalview.util.MapList;
19 import jalview.util.MappingUtils;
20 import jalview.util.StringUtils;
22 import java.io.IOException;
23 import java.net.MalformedURLException;
25 import java.util.ArrayList;
26 import java.util.Arrays;
27 import java.util.Collections;
28 import java.util.Comparator;
29 import java.util.LinkedHashMap;
30 import java.util.List;
31 import java.util.Map.Entry;
34 * Base class for Ensembl sequence fetchers
38 public abstract class EnsemblSeqProxy extends EnsemblRestClient
40 private static final List<String> CROSS_REFERENCES = Arrays
41 .asList(new String[] { "CCDS" });
43 protected static final String CONSEQUENCE_TYPE = "consequence_type";
45 protected static final String PARENT = "Parent";
47 protected static final String ID = "ID";
50 * this needs special handling, as it isA sequence_variant in the
51 * Sequence Ontology, but behaves in Ensembl as if it isA transcript
53 protected static final String NMD_VARIANT = "NMD_transcript_variant";
55 protected static final String NAME = "Name";
57 public enum EnsemblSeqType
60 * type=genomic for the full dna including introns
65 * type=cdna for transcribed dna including UTRs
70 * type=cds for coding dna excluding UTRs
75 * type=protein for the peptide product sequence
80 * the value of the 'type' parameter to fetch this version of
85 EnsemblSeqType(String t)
90 public String getType()
98 * A comparator to sort ranges into ascending start position order
100 private class RangeSorter implements Comparator<int[]>
104 RangeSorter(boolean forward)
110 public int compare(int[] o1, int[] o2)
112 return (forwards ? 1 : -1) * Integer.compare(o1[0], o2[0]);
120 public EnsemblSeqProxy()
125 * Makes the sequence queries to Ensembl's REST service and returns an
126 * alignment consisting of the returned sequences.
129 public AlignmentI getSequenceRecords(String query) throws Exception
131 // TODO use a String... query vararg instead?
133 // danger: accession separator used as a regex here, a string elsewhere
134 // in this case it is ok (it is just a space), but (e.g.) '\' would not be
135 List<String> allIds = Arrays.asList(query
136 .split(getAccessionSeparator()));
137 AlignmentI alignment = null;
141 * execute queries, if necessary in batches of the
142 * maximum allowed number of ids
144 int maxQueryCount = getMaximumQueryCount();
145 for (int v = 0, vSize = allIds.size(); v < vSize; v += maxQueryCount)
147 int p = Math.min(vSize, v + maxQueryCount);
148 List<String> ids = allIds.subList(v, p);
151 alignment = fetchSequences(ids, alignment);
152 } catch (Throwable r)
155 String msg = "Aborting ID retrieval after " + v
156 + " chunks. Unexpected problem (" + r.getLocalizedMessage()
158 System.err.println(msg);
160 // if (alignment != null)
162 // break; // return what we got
166 // throw new JalviewException(msg, r);
172 * fetch and transfer genomic sequence features,
173 * fetch protein product and add as cross-reference
175 for (String accId : allIds)
177 addFeaturesAndProduct(accId, alignment);
180 for (SequenceI seq : alignment.getSequences())
182 getCrossReferences(seq);
189 * Fetches Ensembl features using the /overlap REST endpoint, and adds them to
190 * the sequence in the alignment. Also fetches the protein product, maps it
191 * from the CDS features of the sequence, and saves it as a cross-reference of
197 protected void addFeaturesAndProduct(String accId, AlignmentI alignment)
199 if (alignment == null)
207 * get 'dummy' genomic sequence with exon, cds and variation features
209 SequenceI genomicSequence = null;
210 EnsemblOverlap gffFetcher = new EnsemblOverlap();
211 EnsemblFeatureType[] features = getFeaturesToFetch();
212 AlignmentI geneFeatures = gffFetcher.getSequenceRecords(accId,
214 if (geneFeatures.getHeight() > 0)
216 genomicSequence = geneFeatures.getSequenceAt(0);
218 if (genomicSequence != null)
221 * transfer features to the query sequence
223 SequenceI querySeq = alignment.findName(accId);
224 if (transferFeatures(accId, genomicSequence, querySeq))
228 * fetch and map protein product, and add it as a cross-reference
229 * of the retrieved sequence
231 addProteinProduct(querySeq);
234 } catch (IOException e)
236 System.err.println("Error transferring Ensembl features: "
242 * Returns those sequence feature types to fetch from Ensembl. We may want
243 * features either because they are of interest to the user, or as means to
244 * identify the locations of the sequence on the genomic sequence (CDS
245 * features identify CDS, exon features identify cDNA etc).
249 protected abstract EnsemblFeatureType[] getFeaturesToFetch();
252 * Fetches and maps the protein product, and adds it as a cross-reference of
253 * the retrieved sequence
255 protected void addProteinProduct(SequenceI querySeq)
257 String accId = querySeq.getName();
260 AlignmentI protein = new EnsemblProtein().getSequenceRecords(accId);
261 if (protein == null || protein.getHeight() == 0)
263 System.out.println("Failed to retrieve protein for " + accId);
266 SequenceI proteinSeq = protein.getSequenceAt(0);
269 * need dataset sequences (to be the subject of mappings)
271 proteinSeq.createDatasetSequence();
272 querySeq.createDatasetSequence();
274 MapList mapList = mapCdsToProtein(querySeq, proteinSeq);
277 Mapping map = new Mapping(proteinSeq.getDatasetSequence(), mapList);
278 DBRefEntry dbr = new DBRefEntry(getDbSource(), getDbVersion(),
280 querySeq.getDatasetSequence().addDBRef(dbr);
283 * compute peptide variants from dna variants and add as
284 * sequence features on the protein sequence ta-da
286 computeProteinFeatures(querySeq, proteinSeq, mapList);
288 } catch (Exception e)
291 .println(String.format("Error retrieving protein for %s: %s",
292 accId, e.getMessage()));
297 * Get Uniprot and PDB xrefs from Ensembl, and attach them to the protein
302 protected void getCrossReferences(SequenceI seq)
304 while (seq.getDatasetSequence() != null)
306 seq = seq.getDatasetSequence();
309 EnsemblXref xrefFetcher = new EnsemblXref();
310 List<DBRefEntry> xrefs = xrefFetcher.getCrossReferences(seq.getName(),
311 getCrossReferenceDatabases());
312 for (DBRefEntry xref : xrefs)
316 * Save any Uniprot xref to be the reference for SIFTS mapping
318 if (DBRefSource.UNIPROT.equals(xref.getSource()))
320 seq.setSourceDBRef(xref);
326 * Returns a list of database names to be used when fetching cross-references.
330 protected List<String> getCrossReferenceDatabases()
332 return CROSS_REFERENCES;
336 * Returns a mapping from dna to protein by inspecting sequence features of
337 * type "CDS" on the dna.
343 protected MapList mapCdsToProtein(SequenceI dnaSeq, SequenceI proteinSeq)
345 List<int[]> ranges = new ArrayList<int[]>(50);
347 int mappedDnaLength = getCdsRanges(dnaSeq, ranges);
349 int proteinLength = proteinSeq.getLength();
350 List<int[]> proteinRange = new ArrayList<int[]>();
351 int proteinStart = 1;
354 * incomplete start codon may mean X at start of peptide
355 * we ignore both for mapping purposes
357 if (proteinSeq.getCharAt(0) == 'X')
362 proteinRange.add(new int[] { proteinStart, proteinLength });
365 * dna length should map to protein (or protein plus stop codon)
367 int codesForResidues = mappedDnaLength / 3;
368 if (codesForResidues == proteinLength
369 || codesForResidues == (proteinLength + 1))
371 return new MapList(ranges, proteinRange, 3, 1);
377 * Adds CDS ranges to the ranges list, and returns the total length mapped
380 * No need to worry about reverse strand dna, here since the retrieved
381 * sequence is as transcribed (reverse complement for reverse strand), i.e in
382 * the same sense as the peptide.
388 protected int getCdsRanges(SequenceI dnaSeq, List<int[]> ranges)
390 SequenceFeature[] sfs = dnaSeq.getSequenceFeatures();
395 int mappedDnaLength = 0;
396 for (SequenceFeature sf : sfs)
399 * process a CDS feature (or a sub-type of CDS)
401 if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
402 SequenceOntologyI.CDS))
406 phase = Integer.parseInt(sf.getPhase());
407 } catch (NumberFormatException e)
412 * phase > 0 on first codon means 5' incomplete - skip to the start
413 * of the next codon; example ENST00000496384
415 int begin = sf.getBegin();
416 int end = sf.getEnd();
417 if (ranges.isEmpty() && phase > 0)
422 continue; // shouldn't happen?
425 ranges.add(new int[] { begin, end });
426 mappedDnaLength += Math.abs(end - begin) + 1;
429 return mappedDnaLength;
433 * Fetches sequences for the list of accession ids and adds them to the
434 * alignment. Returns the extended (or created) alignment.
439 * @throws JalviewException
440 * @throws IOException
442 protected AlignmentI fetchSequences(List<String> ids, AlignmentI alignment)
443 throws JalviewException, IOException
445 if (!isEnsemblAvailable())
448 throw new JalviewException("ENSEMBL Rest API not available.");
450 FileParse fp = getSequenceReader(ids);
451 FastaFile fr = new FastaFile(fp);
452 if (fr.hasWarningMessage())
454 System.out.println(String.format(
455 "Warning when retrieving %d ids %s\n%s", ids.size(),
456 ids.toString(), fr.getWarningMessage()));
458 else if (fr.getSeqs().size() != ids.size())
460 System.out.println(String.format(
461 "Only retrieved %d sequences for %d query strings", fr
462 .getSeqs().size(), ids.size()));
465 if (fr.getSeqs().size() == 1 && fr.getSeqs().get(0).getLength() == 0)
468 * POST request has returned an empty FASTA file e.g. for invalid id
470 throw new IOException("No data returned for " + ids);
473 if (fr.getSeqs().size() > 0)
475 AlignmentI seqal = new Alignment(
476 fr.getSeqsAsArray());
477 for (SequenceI sq:seqal.getSequences())
479 if (sq.getDescription() == null)
481 sq.setDescription(getDbName());
483 String name = sq.getName();
484 if (ids.contains(name)
485 || ids.contains(name.replace("ENSP", "ENST")))
487 DBRefUtils.parseToDbRef(sq, DBRefSource.ENSEMBL, "0", name);
490 if (alignment == null)
496 alignment.append(seqal);
503 * Returns the URL for the REST call
506 * @throws MalformedURLException
509 protected URL getUrl(List<String> ids) throws MalformedURLException
512 * a single id is included in the URL path
513 * multiple ids go in the POST body instead
515 StringBuffer urlstring = new StringBuffer(128);
516 urlstring.append(SEQUENCE_ID_URL);
519 urlstring.append("/").append(ids.get(0));
521 // @see https://github.com/Ensembl/ensembl-rest/wiki/Output-formats
522 urlstring.append("?type=").append(getSourceEnsemblType().getType());
523 urlstring.append(("&Accept=text/x-fasta"));
525 URL url = new URL(urlstring.toString());
530 * A sequence/id POST request currently allows up to 50 queries
532 * @see http://rest.ensembl.org/documentation/info/sequence_id_post
535 public int getMaximumQueryCount()
541 protected boolean useGetRequest()
547 protected String getRequestMimeType(boolean multipleIds)
549 return multipleIds ? "application/json" : "text/x-fasta";
553 protected String getResponseMimeType()
555 return "text/x-fasta";
560 * @return the configured sequence return type for this source
562 protected abstract EnsemblSeqType getSourceEnsemblType();
565 * Returns a list of [start, end] genomic ranges corresponding to the sequence
568 * The correspondence between the frames of reference is made by locating
569 * those features on the genomic sequence which identify the retrieved
570 * sequence. Specifically
572 * <li>genomic sequence is identified by "transcript" features with
573 * ID=transcript:transcriptId</li>
574 * <li>cdna sequence is identified by "exon" features with
575 * Parent=transcript:transcriptId</li>
576 * <li>cds sequence is identified by "CDS" features with
577 * Parent=transcript:transcriptId</li>
580 * The returned ranges are sorted to run forwards (for positive strand) or
581 * backwards (for negative strand). Aborts and returns null if both positive
582 * and negative strand are found (this should not normally happen).
584 * @param sourceSequence
587 * the start position of the sequence we are mapping to
590 protected MapList getGenomicRangesFromFeatures(SequenceI sourceSequence,
591 String accId, int start)
593 SequenceFeature[] sfs = sourceSequence.getSequenceFeatures();
600 * generously initial size for number of cds regions
601 * (worst case titin Q8WZ42 has c. 313 exons)
603 List<int[]> regions = new ArrayList<int[]>(100);
604 int mappedLength = 0;
605 int direction = 1; // forward
606 boolean directionSet = false;
608 for (SequenceFeature sf : sfs)
611 * accept the target feature type or a specialisation of it
612 * (e.g. coding_exon for exon)
614 if (identifiesSequence(sf, accId))
616 int strand = sf.getStrand();
617 strand = strand == 0 ? 1 : strand; // treat unknown as forward
619 if (directionSet && strand != direction)
621 // abort - mix of forward and backward
622 System.err.println("Error: forward and backward strand for "
630 * add to CDS ranges, semi-sorted forwards/backwards
634 regions.add(0, new int[] { sf.getEnd(), sf.getBegin() });
638 regions.add(new int[] { sf.getBegin(), sf.getEnd() });
640 mappedLength += Math.abs(sf.getEnd() - sf.getBegin() + 1);
645 * 'gene' sequence is contiguous so we can stop as soon as its
646 * identifying feature has been found
653 if (regions.isEmpty())
655 System.out.println("Failed to identify target sequence for " + accId
656 + " from genomic features");
661 * a final sort is needed since Ensembl returns CDS sorted within source
662 * (havana / ensembl_havana)
664 Collections.sort(regions, new RangeSorter(direction == 1));
666 List<int[]> to = Arrays.asList(new int[] { start,
667 start + mappedLength - 1 });
669 return new MapList(regions, to, 1, 1);
673 * Answers true if the sequence being retrieved may occupy discontiguous
674 * regions on the genomic sequence.
676 protected boolean isSpliceable()
682 * Returns true if the sequence feature marks positions of the genomic
683 * sequence feature which are within the sequence being retrieved. For
684 * example, an 'exon' feature whose parent is the target transcript marks the
685 * cdna positions of the transcript.
691 protected abstract boolean identifiesSequence(SequenceFeature sf,
695 * Transfers the sequence feature to the target sequence, locating its start
696 * and end range based on the mapping. Features which do not overlap the
697 * target sequence are ignored.
700 * @param targetSequence
702 * mapping from the sequence feature's coordinates to the target
705 protected void transferFeature(SequenceFeature sf,
706 SequenceI targetSequence, MapList mapping)
708 int start = sf.getBegin();
709 int end = sf.getEnd();
710 int[] mappedRange = mapping.locateInTo(start, end);
712 if (mappedRange != null)
714 SequenceFeature copy = new SequenceFeature(sf);
715 copy.setBegin(Math.min(mappedRange[0], mappedRange[1]));
716 copy.setEnd(Math.max(mappedRange[0], mappedRange[1]));
717 targetSequence.addSequenceFeature(copy);
720 * for sequence_variant, make an additional feature with consequence
722 if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
723 SequenceOntologyI.SEQUENCE_VARIANT))
725 String consequence = (String) sf.getValue(CONSEQUENCE_TYPE);
726 if (consequence != null)
728 SequenceFeature sf2 = new SequenceFeature("consequence",
729 consequence, copy.getBegin(), copy.getEnd(), 0f,
731 targetSequence.addSequenceFeature(sf2);
738 * Transfers features from sourceSequence to targetSequence
741 * @param sourceSequence
742 * @param targetSequence
743 * @return true if any features were transferred, else false
745 protected boolean transferFeatures(String accessionId,
746 SequenceI sourceSequence, SequenceI targetSequence)
748 if (sourceSequence == null || targetSequence == null)
753 SequenceFeature[] sfs = sourceSequence.getSequenceFeatures();
754 MapList mapping = getGenomicRangesFromFeatures(sourceSequence, accessionId,
755 targetSequence.getStart());
761 return transferFeatures(sfs, targetSequence, mapping, accessionId);
765 * Transfer features to the target sequence. The start/end positions are
766 * converted using the mapping. Features which do not overlap are ignored.
767 * Features whose parent is not the specified identifier are also ignored.
770 * @param targetSequence
775 protected boolean transferFeatures(SequenceFeature[] features,
776 SequenceI targetSequence, MapList mapping, String parentId)
778 final boolean forwardStrand = mapping.isFromForwardStrand();
781 * sort features by start position (descending if reverse strand)
782 * before transferring (in forwards order) to the target sequence
784 Arrays.sort(features, new Comparator<SequenceFeature>()
787 public int compare(SequenceFeature o1, SequenceFeature o2)
789 int c = Integer.compare(o1.getBegin(), o2.getBegin());
790 return forwardStrand ? c : -c;
794 boolean transferred = false;
795 for (SequenceFeature sf : features)
797 if (retainFeature(sf, parentId))
799 transferFeature(sf, targetSequence, mapping);
807 * Answers true if the feature type is one we want to keep for the sequence.
808 * Some features are only retrieved in order to identify the sequence range,
809 * and may then be discarded as redundant information (e.g. "CDS" feature for
812 @SuppressWarnings("unused")
813 protected boolean retainFeature(SequenceFeature sf, String accessionId)
815 return true; // override as required
819 * Answers true if the feature has a Parent which refers to the given
820 * accession id, or if the feature has no parent. Answers false if the
821 * feature's Parent is for a different accession id.
827 protected boolean featureMayBelong(SequenceFeature sf, String identifier)
829 String parent = (String) sf.getValue(PARENT);
830 // using contains to allow for prefix "gene:", "transcript:" etc
831 if (parent != null && !parent.contains(identifier))
833 // this genomic feature belongs to a different transcript
840 public String getDescription()
842 return "Ensembl " + getSourceEnsemblType().getType()
843 + " sequence with variant features";
847 * Returns a (possibly empty) list of features on the sequence which have the
848 * specified sequence ontology type (or a sub-type of it), and the given
849 * identifier as parent
856 protected List<SequenceFeature> findFeatures(SequenceI sequence,
857 String type, String parentId)
859 List<SequenceFeature> result = new ArrayList<SequenceFeature>();
861 SequenceFeature[] sfs = sequence.getSequenceFeatures();
863 SequenceOntologyI so = SequenceOntologyFactory.getInstance();
864 for (SequenceFeature sf :sfs) {
865 if (so.isA(sf.getType(), type))
867 String parent = (String) sf.getValue(PARENT);
868 if (parent.equals(parentId))
879 * Maps exon features from dna to protein, and computes variants in peptide
880 * product generated by variants in dna, and adds them as sequence_variant
881 * features on the protein sequence. Returns the number of variant features
886 * @param dnaToProtein
888 static int computeProteinFeatures(SequenceI dnaSeq,
889 SequenceI peptide, MapList dnaToProtein)
891 while (dnaSeq.getDatasetSequence() != null)
893 dnaSeq = dnaSeq.getDatasetSequence();
895 while (peptide.getDatasetSequence() != null)
897 peptide = peptide.getDatasetSequence();
900 AlignmentUtils.transferFeatures(dnaSeq, peptide, dnaToProtein,
901 SequenceOntologyI.EXON);
903 LinkedHashMap<Integer, String[][]> variants = buildDnaVariantsMap(
904 dnaSeq, dnaToProtein);
907 * scan codon variations, compute peptide variants and add to peptide sequence
910 for (Entry<Integer, String[][]> variant : variants.entrySet())
912 int peptidePos = variant.getKey();
913 String[][] codonVariants = variant.getValue();
914 String residue = String.valueOf(peptide.getCharAt(peptidePos - 1)); // 0-based
915 List<String> peptideVariants = computePeptideVariants(codonVariants,
917 if (!peptideVariants.isEmpty())
919 String desc = StringUtils.listToDelimitedString(peptideVariants,
921 SequenceFeature sf = new SequenceFeature(
922 SequenceOntologyI.SEQUENCE_VARIANT, desc, peptidePos,
923 peptidePos, 0f, null);
924 peptide.addSequenceFeature(sf);
932 * Builds a map whose key is position in the protein sequence, and value is an
933 * array of all variants for the coding codon positions
936 * @param dnaToProtein
939 static LinkedHashMap<Integer, String[][]> buildDnaVariantsMap(
940 SequenceI dnaSeq, MapList dnaToProtein)
943 * map from peptide position to all variant features of the codon for it
944 * LinkedHashMap ensures we add the peptide features in sequence order
946 LinkedHashMap<Integer, String[][]> variants = new LinkedHashMap<Integer, String[][]>();
947 SequenceOntologyI so = SequenceOntologyFactory.getInstance();
949 SequenceFeature[] dnaFeatures = dnaSeq.getSequenceFeatures();
950 if (dnaFeatures == null)
955 int dnaStart = dnaSeq.getStart();
956 int[] lastCodon = null;
957 int lastPeptidePostion = 0;
960 * build a map of codon variations for peptides
962 for (SequenceFeature sf : dnaFeatures)
964 int dnaCol = sf.getBegin();
965 if (dnaCol != sf.getEnd())
967 // not handling multi-locus variant features
970 if (so.isA(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT))
972 int[] mapsTo = dnaToProtein.locateInTo(dnaCol, dnaCol);
975 // feature doesn't lie within coding region
978 int peptidePosition = mapsTo[0];
979 String[][] codonVariants = variants.get(peptidePosition);
980 if (codonVariants == null)
982 codonVariants = new String[3][];
983 variants.put(peptidePosition, codonVariants);
987 * extract dna variants to a string array
989 String alls = (String) sf.getValue("alleles");
994 String[] alleles = alls.split(",");
997 * get this peptides codon positions e.g. [3, 4, 5] or [4, 7, 10]
999 int[] codon = peptidePosition == lastPeptidePostion ? lastCodon
1000 : MappingUtils.flattenRanges(dnaToProtein.locateInFrom(
1001 peptidePosition, peptidePosition));
1002 lastPeptidePostion = peptidePosition;
1006 * save nucleotide (and this variant) for each codon position
1008 for (int codonPos = 0; codonPos < 3; codonPos++)
1010 String nucleotide = String.valueOf(dnaSeq
1011 .getCharAt(codon[codonPos] - dnaStart));
1012 if (codon[codonPos] == dnaCol)
1015 * record current dna base and its alleles
1017 String[] dnaVariants = new String[alleles.length + 1];
1018 dnaVariants[0] = nucleotide;
1019 System.arraycopy(alleles, 0, dnaVariants, 1, alleles.length);
1020 codonVariants[codonPos] = dnaVariants;
1022 else if (codonVariants[codonPos] == null)
1025 * record current dna base only
1026 * (at least until we find any variation and overwrite it)
1028 codonVariants[codonPos] = new String[] { nucleotide };
1037 * Returns a sorted, non-redundant list of all peptide translations generated
1038 * by the given dna variants, excluding the current residue value
1040 * @param codonVariants
1041 * an array of base values (acgtACGT) for codon positions 1, 2, 3
1043 * the current residue translation
1046 static List<String> computePeptideVariants(
1047 String[][] codonVariants, String residue)
1049 List<String> result = new ArrayList<String>();
1050 for (String base1 : codonVariants[0])
1052 for (String base2 : codonVariants[1])
1054 for (String base3 : codonVariants[2])
1056 String codon = base1 + base2 + base3;
1057 // TODO: report frameshift/insertion/deletion
1058 // and multiple-base variants?!
1059 String peptide = codon.contains("-") ? "-" : ResidueProperties
1060 .codonTranslate(codon);
1061 if (peptide != null && !result.contains(peptide)
1062 && !peptide.equalsIgnoreCase(residue))
1064 result.add(peptide);
1071 * sort alphabetically with STOP at the end
1073 Collections.sort(result, new Comparator<String>()
1077 public int compare(String o1, String o2)
1079 if ("STOP".equals(o1))
1083 else if ("STOP".equals(o2))
1089 return o1.compareTo(o2);
1097 * Answers true if the feature type is either 'NMD_transcript_variant' or
1098 * 'transcript' or one of its sub-types in the Sequence Ontology. This is
1099 * needed because NMD_transcript_variant behaves like 'transcript' in Ensembl
1100 * although strictly speaking it is not (it is a sub-type of
1101 * sequence_variant).
1103 * @param featureType
1106 public static boolean isTranscript(String featureType)
1108 return NMD_VARIANT.equals(featureType)
1109 || SequenceOntologyFactory.getInstance().isA(featureType,
1110 SequenceOntologyI.TRANSCRIPT);