X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fgff%2FGff3Helper.java;h=ac4e1d834fd9941e331aecf4cb7fffcae010d06a;hb=refs%2Fheads%2Ffeature%2FJAL-3251biotypedMappings;hp=f517310d99f418e8cb0a594d3e4783db9d3ebcef;hpb=853624fb32058cccc544ae7d13af6ad4b0800b6c;p=jalview.git diff --git a/src/jalview/io/gff/Gff3Helper.java b/src/jalview/io/gff/Gff3Helper.java index f517310..ac4e1d8 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; @@ -19,6 +39,8 @@ import java.util.Map; */ public class Gff3Helper extends GffHelperBase { + public static final String ALLELES = "alleles"; + protected static final String TARGET = "Target"; protected static final String ID = "ID"; @@ -132,8 +154,8 @@ public class Gff3Helper extends GffHelperBase */ if ("-".equals(strand)) { - System.err - .println("Skipping mapping from reverse complement as not yet supported"); + System.err.println( + "Skipping mapping from reverse complement as not yet supported"); return null; } @@ -194,7 +216,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.GenomeToCdna); if (mapping != null) { @@ -224,7 +246,8 @@ public class Gff3Helper extends GffHelperBase * @return */ @SuppressWarnings("unused") - protected String findTargetId(String target, Map> set) + protected String findTargetId(String target, + Map> set) { return target; } @@ -255,8 +278,8 @@ public class Gff3Helper extends GffHelperBase * @throws IOException */ protected SequenceFeature processProteinMatch( - Map> set, SequenceI seq, - String[] gffColumns, AlignmentI align, List newseqs, + Map> set, SequenceI seq, String[] gffColumns, + AlignmentI align, List newseqs, boolean relaxedIdMatching) { // This is currently tailored to InterProScan GFF output: @@ -290,10 +313,9 @@ public class Gff3Helper extends GffHelperBase * give the mapped sequence a copy of the sequence feature, with * start/end range adjusted */ - SequenceFeature sf2 = new SequenceFeature(sf); - sf2.setBegin(1); int sequenceFeatureLength = 1 + sf.getEnd() - sf.getBegin(); - sf2.setEnd(sequenceFeatureLength); + SequenceFeature sf2 = new SequenceFeature(sf, 1, + sequenceFeatureLength, sf.getFeatureGroup(), sf.getScore()); mappedSequence.addSequenceFeature(sf2); /* @@ -301,8 +323,8 @@ public class Gff3Helper extends GffHelperBase * renamed with its qualified accession id; renaming has to wait until * all sequence reference resolution is complete */ - String accessionId = StringUtils.listToDelimitedString( - set.get(NAME), ","); + String accessionId = StringUtils + .listToDelimitedString(set.get(NAME), ","); if (accessionId.length() > 0) { String database = sf.getType(); // TODO InterProScan only?? @@ -342,9 +364,11 @@ public class Gff3Helper extends GffHelperBase */ @Override protected SequenceFeature buildSequenceFeature(String[] gff, + int typeColumn, String group, Map> attributes) { - SequenceFeature sf = super.buildSequenceFeature(gff, attributes); + SequenceFeature sf = super.buildSequenceFeature(gff, typeColumn, group, + attributes); String desc = getDescription(sf, attributes); if (desc != null) { @@ -377,7 +401,7 @@ public class Gff3Helper extends GffHelperBase /* * Ensembl returns dna variants as 'alleles' */ - desc = StringUtils.listToDelimitedString(attributes.get("alleles"), + desc = StringUtils.listToDelimitedString(attributes.get(ALLELES), ","); }