X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fgff%2FGff3Helper.java;h=031900d3c199d75b4f70e29b43abb07049ff7965;hb=55ea0e81c495953933370df9bb747120649e5274;hp=55a0f9a7aee5714e7d36fda691d7f613ef9d5286;hpb=92cccf420dbe7501fae76b9941fd701151bdf5ab;p=jalview.git diff --git a/src/jalview/io/gff/Gff3Helper.java b/src/jalview/io/gff/Gff3Helper.java index 55a0f9a..031900d 100644 --- a/src/jalview/io/gff/Gff3Helper.java +++ b/src/jalview/io/gff/Gff3Helper.java @@ -69,12 +69,13 @@ public class Gff3Helper extends GffHelperBase String atts = gff[ATTRIBUTES_COL]; Map> attributes = parseNameValuePairs(atts); - if (SequenceOntology.getInstance().isProteinMatch(soTerm)) + SequenceOntologyI so = SequenceOntologyFactory.getInstance(); + if (so.isA(soTerm, SequenceOntologyI.PROTEIN_MATCH)) { - sf = processProteinMatch(attributes, seq, gff, align, - newseqs, relaxedIdMatching); + sf = processProteinMatch(attributes, seq, gff, align, newseqs, + relaxedIdMatching); } - else if (SequenceOntology.getInstance().isNucleotideMatch(soTerm)) + else if (so.isA(soTerm, SequenceOntologyI.NUCLEOTIDE_MATCH)) { sf = processNucleotideMatch(attributes, seq, gff, align, newseqs, relaxedIdMatching); @@ -371,18 +372,36 @@ public class Gff3Helper extends GffHelperBase desc = target.split(" ")[0]; } - if (SequenceOntology.getInstance().isSequenceVariant(sf.getType())) + SequenceOntologyI so = SequenceOntologyFactory.getInstance(); + String type = sf.getType(); + if (so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT)) { /* - * Ensembl returns alleles and consequence_type (amongst other details) + * Ensembl returns dna variants as 'alleles' */ - String alleles = StringUtils.listToDelimitedString( + desc = StringUtils.listToDelimitedString( attributes.get("alleles"), ","); - String consequence = StringUtils.listToDelimitedString( - attributes.get("consequence_type"), ","); - desc = String.format("alleles %s; consequence %s", alleles, - consequence); } + + /* + * extract 'Name' for a transcript (to show gene name) + * or an exon (so 'colour by label' shows exon boundaries) + */ + if (SequenceOntologyI.NMD_TRANSCRIPT_VARIANT.equals(type) + || so.isA(type, SequenceOntologyI.TRANSCRIPT) + || so.isA(type, SequenceOntologyI.EXON)) + { + desc = StringUtils.listToDelimitedString(attributes.get("Name"), ","); + } + + /* + * if the above fails, try ID + */ + if (desc == null) + { + desc = (String) sf.getValue(ID); + } + return desc; } }