*/
List<String> getGeneIds(String accessions)
{
- List<String> geneIds = new ArrayList<String>();
+ List<String> geneIds = new ArrayList<>();
for (String acc : accessions.split(getAccessionSeparator()))
{
+ String geneId = null;
+
/*
* First try lookup as an Ensembl (gene or transcript) identifier
+ * unless query is of the form species:symbol e.g. human:braf
*/
- String geneId = new EnsemblLookup(getDomain()).getGeneId(acc);
- if (geneId != null)
+ if (acc.indexOf(":") == -1)
{
- if (!geneIds.contains(geneId))
+ geneId = new EnsemblLookup(getDomain()).getGeneId(acc);
+ if (geneId != null)
{
- geneIds.add(geneId);
+ if (!geneIds.contains(geneId))
+ {
+ geneIds.add(geneId);
+ }
}
}
- else
+ if (geneId == null)
{
/*
- * if given a gene or other external name, lookup and fetch
- * the corresponding gene for all model organisms
+ * if given a gene or other external name, lookup and fetch the gene
+ * for the species (if specified in the query), else for all model organisms
*/
List<String> ids = new EnsemblSymbol(getDomain(), getDbSource(),
getDbVersion()).getGeneIds(acc);
int transcriptLength = 0;
final char[] geneChars = gene.getSequence();
int offset = gene.getStart(); // to convert to 0-based positions
- List<int[]> mappedFrom = new ArrayList<int[]>();
+ List<int[]> mappedFrom = new ArrayList<>();
for (SequenceFeature sf : splices)
{
* transfer features to the new sequence; we use EnsemblCdna to do this,
* to filter out unwanted features types (see method retainFeature)
*/
- List<int[]> mapTo = new ArrayList<int[]>();
+ List<int[]> mapTo = new ArrayList<>();
mapTo.add(new int[] { 1, transcriptLength });
MapList mapping = new MapList(mappedFrom, mapTo, 1, 1);
EnsemblCdna cdna = new EnsemblCdna(getDomain());
protected List<SequenceFeature> getTranscriptFeatures(String accId,
SequenceI geneSequence)
{
- List<SequenceFeature> transcriptFeatures = new ArrayList<SequenceFeature>();
+ List<SequenceFeature> transcriptFeatures = new ArrayList<>();
String parentIdentifier = GENE_PREFIX + accId;