public AlignmentI getSequenceRecords(String query) throws IOException
{
// TODO: use a vararg String... for getSequenceRecords instead?
- List<String> queries = new ArrayList<String>();
+ List<String> queries = new ArrayList<>();
queries.add(query);
FileParse fp = getSequenceReader(queries);
if (fp == null || !fp.isValid())
urlstring.append("?content-type=text/x-gff3");
/*
+ * specify object_type=gene in case is shared by transcript and/or protein;
+ * currently only fetching features for gene sequences;
+ * refactor in future if needed to fetch for transcripts
+ */
+ urlstring.append("&").append(OBJECT_TYPE).append("=")
+ .append(OBJECT_TYPE_GENE);
+
+ /*
* specify features to retrieve
* @see http://rest.ensembl.org/documentation/info/overlap_id
- * could make the list a configurable entry in jalview.properties
+ * could make the list a configurable entry in .jalview_properties
*/
for (EnsemblFeatureType feature : featuresWanted)
{
for (SequenceFeature sf : sfs)
{
String parent = (String) sf.getValue(PARENT);
- if (parentIdentifier.equals(parent))
+ if (parentIdentifier.equalsIgnoreCase(parent))
{
transcriptFeatures.add(sf);
}
{
// NB features as gff use 'ID'; rest services return as 'id'
String id = (String) sf.getValue("ID");
- if ((GENE_PREFIX + accId).equals(id))
+ if ((GENE_PREFIX + accId).equalsIgnoreCase(id))
{
return true;
}
if (isTranscript(type))
{
String parent = (String) sf.getValue(PARENT);
- if (!(GENE_PREFIX + accessionId).equals(parent))
+ if (!(GENE_PREFIX + accessionId).equalsIgnoreCase(parent))
{
return false;
}
try
{
/*
- * get 'dummy' genomic sequence with exon, cds and variation features
+ * get 'dummy' genomic sequence with gene, transcript,
+ * exon, cds and variation features
*/
SequenceI genomicSequence = null;
EnsemblFeatures gffFetcher = new EnsemblFeatures(getDomain());
/*
* transfer features to the query sequence
*/
- SequenceI querySeq = alignment.findName(accId);
+ SequenceI querySeq = alignment.findName(accId, true);
if (transferFeatures(accId, genomicSequence, querySeq))
{
{
String parent = (String) sf.getValue(PARENT);
// using contains to allow for prefix "gene:", "transcript:" etc
- if (parent != null && !parent.contains(identifier))
+ if (parent != null
+ && !parent.toUpperCase().contains(identifier.toUpperCase()))
{
// this genomic feature belongs to a different transcript
return false;
for (SequenceFeature sf : sfs)
{
String parent = (String) sf.getValue(PARENT);
- if (parent != null && parent.equals(parentId))
+ if (parent != null && parent.equalsIgnoreCase(parentId))
{
result.add(sf);
}
sf.setValue("Parent", "transcript:" + accId);
assertTrue(testee.retainFeature(sf, accId));
+ // test is not case-sensitive
+ assertTrue(testee.retainFeature(sf, accId.toLowerCase()));
+
// feature with wrong parent is not retained
sf.setValue("Parent", "transcript:XYZ");
assertFalse(testee.retainFeature(sf, accId));
// NMD_transcript_variant treated like transcript in Ensembl
SequenceFeature sf3 = new SequenceFeature("NMD_transcript_variant", "",
22000, 22500, 0f, null);
- sf3.setValue("Parent", "gene:" + geneId);
+ // id matching should not be case-sensitive
+ sf3.setValue("Parent", "gene:" + geneId.toLowerCase());
sf3.setValue("transcript_id", "transcript3");
genomic.addSequenceFeature(sf3);
sf.setValue("ID", "gene:" + accId);
assertTrue(testee.identifiesSequence(sf, accId));
+ // test is not case-sensitive
+ assertTrue(testee.identifiesSequence(sf, accId.toLowerCase()));
+
// transcript not valid:
sf = new SequenceFeature("transcript", "", 1, 2, 0f, null);
sf.setValue("ID", "gene:" + accId);