X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fgff%2FGff3Helper.java;h=82e53132bbb15b4185850ec29eea293f3949942e;hb=ee1ce9d286ce8ec18238b74f1cbb19af63b66a7a;hp=d29645be9f1a5973b68f8de60de63dc7f0788299;hpb=3cccac4697c371b1964236e17b532fd3d180e1c4;p=jalview.git diff --git a/src/jalview/io/gff/Gff3Helper.java b/src/jalview/io/gff/Gff3Helper.java index d29645b..82e5313 100644 --- a/src/jalview/io/gff/Gff3Helper.java +++ b/src/jalview/io/gff/Gff3Helper.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.io.gff; import jalview.datamodel.AlignedCodonFrame; @@ -5,7 +25,6 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.MappingType; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; -import jalview.ext.ensembl.EnsemblSeqProxy; import jalview.util.MapList; import jalview.util.StringUtils; @@ -78,8 +97,8 @@ public class Gff3Helper extends GffHelperBase } else if (so.isA(soTerm, SequenceOntologyI.NUCLEOTIDE_MATCH)) { - sf = processNucleotideMatch(attributes, seq, gff, align, - newseqs, relaxedIdMatching); + sf = processNucleotideMatch(attributes, seq, gff, align, newseqs, + relaxedIdMatching); } else { @@ -93,7 +112,7 @@ public class Gff3Helper extends GffHelperBase */ sf = buildSequenceFeature(gff, null); } - + return sf; } @@ -120,8 +139,7 @@ public class Gff3Helper extends GffHelperBase protected SequenceFeature processNucleotideMatch( Map> attributes, SequenceI seq, String[] gffColumns, AlignmentI align, List newseqs, - boolean relaxedIdMatching) - throws IOException + boolean relaxedIdMatching) throws IOException { String strand = gffColumns[STRAND_COL]; @@ -167,8 +185,8 @@ public class Gff3Helper extends GffHelperBase * (new or existing) virtual sequence in the newseqs list */ String targetId = findTargetId(tokens[0], attributes); - SequenceI mappedSequence1 = findSequence(targetId, align, - newseqs, relaxedIdMatching); + SequenceI mappedSequence1 = findSequence(targetId, align, newseqs, + relaxedIdMatching); SequenceI mappedSequence = mappedSequence1; if (mappedSequence == null) { @@ -196,8 +214,7 @@ public class Gff3Helper extends GffHelperBase int fromStart = Integer.parseInt(gffColumns[START_COL]); int fromEnd = Integer.parseInt(gffColumns[END_COL]); MapList mapping = constructMappingFromAlign(fromStart, fromEnd, - toStart, toEnd, - MappingType.NucleotideToNucleotide); + toStart, toEnd, MappingType.NucleotideToNucleotide); if (mapping != null) { @@ -281,8 +298,8 @@ public class Gff3Helper extends GffHelperBase for (String target : targets) { - SequenceI mappedSequence1 = findSequence(findTargetId(target, set), align, - newseqs, relaxedIdMatching); + SequenceI mappedSequence1 = findSequence(findTargetId(target, set), + align, newseqs, relaxedIdMatching); SequenceI mappedSequence = mappedSequence1; if (mappedSequence == null) { @@ -380,19 +397,29 @@ public class Gff3Helper extends GffHelperBase /* * Ensembl returns dna variants as 'alleles' */ - desc = StringUtils.listToDelimitedString( - attributes.get("alleles"), ","); + desc = StringUtils.listToDelimitedString(attributes.get("alleles"), + ","); } /* * extract 'Name' for a transcript (to show gene name) * or an exon (so 'colour by label' shows exon boundaries) */ - if (EnsemblSeqProxy.isTranscript(type) - || so.isA(type, SequenceOntology.EXON)) + 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; } }