3 import jalview.api.AlignViewportI;
4 import jalview.datamodel.AlignedCodonFrame;
5 import jalview.datamodel.Alignment;
6 import jalview.datamodel.AlignmentI;
7 import jalview.datamodel.SequenceI;
9 import java.io.IOException;
10 import java.util.List;
13 * A GFF3 File parsing wrapper for the tangled mess that is FeaturesFile.
15 * This class implements the methods relied on by FileLoader/FormatAdapter in
16 * order to allow them to load alignments directly from GFF2 and GFF3 files that
17 * contain sequence data and alignment information.
21 * 1. GFF3 files commonly include mappings between DNA, RNA and Protein - so
22 * this class needs a dataset AlignmentI context to create alignment codon
25 * 2. A single GFF3 file can generate many distinct alignments. Support will be
26 * needed to allow several AlignmentI instances to be generated from a single
33 public class Gff3File extends FeaturesFile
48 public Gff3File(FileParse source) throws IOException
58 public Gff3File(String inFile, String type) throws IOException
64 * @param parseImmediately
68 public Gff3File(boolean parseImmediately, FileParse source)
71 super(parseImmediately, source);
75 * @param parseImmediately
80 public Gff3File(boolean parseImmediately, String inFile, String type)
83 super(parseImmediately, inFile, type);
89 * @see jalview.io.FeaturesFile#print()
94 // TODO GFF3 writer with sensible defaults for writing alignment data
96 // return super.printGFFFormat(seqs, visible);
97 return ("Not yet implemented.");
102 List<AlignmentI> alignments;
106 AlignViewportI av = getViewport();
109 if (av.getAlignment() != null)
111 dataset = av.getAlignment().getDataset();
115 // working in the applet context ?
116 dataset = av.getAlignment();
121 dataset = new Alignment(new SequenceI[]
125 boolean parseResult = parse(dataset, null, null, false, true);
128 // pass error up somehow
132 // update viewport with the dataset data ?
136 setSeqs(dataset.getSequencesArray());
142 public void addProperties(AlignmentI al)
144 super.addProperties(al);
145 if (dataset.getCodonFrames() != null)
147 AlignmentI ds = (al.getDataset() == null) ? al : al.getDataset();
148 for (AlignedCodonFrame codons : dataset.getCodonFrames())
150 ds.addCodonFrame(codons);