private static final String ID_NOT_SPECIFIED = "ID_NOT_SPECIFIED";
+ private static final String NOTE = "Note";
+
protected static final String GFF_VERSION = "##gff-version";
private AlignmentI lastmatchedAl = null;
.getDisplayedFeatureCols();
Map<String, FeatureMatcherSetI> featureFilters = fr.getFeatureFilters();
+ // BH check this is out?
+// if (!includeNonPositional
+// && (visibleColours == null || visibleColours.isEmpty()))
+// {
+// // no point continuing.
+// return "No Features Visible";
+// }
+
/*
* write out feature colours (if we know them)
*/
* @param sequenceName
* @param sequenceFeature
*/
- protected void formatJalviewFeature(
+ protected String formatJalviewFeature(
StringBuilder out, String sequenceName,
SequenceFeature sequenceFeature)
{
out.append(sequenceFeature.score);
}
out.append(newline);
+
+ return out.toString();
}
/**
AlignViewportI av = getViewport();
if (av != null)
{
- if (av.getAlignment() != null)
+ AlignmentI a = av.getAlignment();
+ if (a != null)
{
- dataset = av.getAlignment().getDataset();
+ dataset = a.getDataset();
}
if (dataset == null)
{
// working in the applet context ?
- dataset = av.getAlignment();
+ dataset = a;
}
}
else
* Returns features output in GFF2 format
*
* @param sequences
- * the sequences whose features are to be
- * output
+ * the sequences whose features are to be output
* @param visible
- * a map whose keys are the type names of
- * visible features
+ * a map whose keys are the type names of visible features
* @param visibleFeatureGroups
* @param includeNonPositionalFeatures
* @param includeComplement
{
FeatureRenderer fr2 = null;
if (includeComplement)
- {
+ {
AlignViewportI comp = fr.getViewport().getCodingComplement();
fr2 = Desktop.getAlignFrameFor(comp).getFeatureRenderer();
}
{
features.addAll(seq.getFeatures().getPositionalFeatures(types));
}
+
for (SequenceFeature sf : features)
{
if (sf.isNonPositional() || fr.isVisible(sf))
private void formatGffFeature(StringBuilder out, SequenceI seq,
SequenceFeature sf)
{
- String source = sf.featureGroup;
- if (source == null)
- {
- source = sf.getDescription();
- }
-
- out.append(seq.getName());
- out.append(TAB);
- out.append(source);
- out.append(TAB);
- out.append(sf.type);
- out.append(TAB);
- out.append(sf.begin);
- out.append(TAB);
- out.append(sf.end);
- out.append(TAB);
- out.append(sf.score);
- out.append(TAB);
-
- int strand = sf.getStrand();
- out.append(strand == 1 ? "+" : (strand == -1 ? "-" : "."));
- out.append(TAB);
+ String source = sf.featureGroup;
+ if (source == null)
+ {
+ source = sf.getDescription();
+ }
- String phase = sf.getPhase();
- out.append(phase == null ? "." : phase);
+ out.append(seq.getName());
+ out.append(TAB);
+ out.append(source);
+ out.append(TAB);
+ out.append(sf.type);
+ out.append(TAB);
+ out.append(sf.begin);
+ out.append(TAB);
+ out.append(sf.end);
+ out.append(TAB);
+ out.append(sf.score);
+ out.append(TAB);
+
+ int strand = sf.getStrand();
+ out.append(strand == 1 ? "+" : (strand == -1 ? "-" : "."));
+ out.append(TAB);
+
+ String phase = sf.getPhase();
+ out.append(phase == null ? "." : phase);
if (sf.otherDetails != null && !sf.otherDetails.isEmpty())
- {
+ {
Map<String, Object> map = sf.otherDetails;
formatAttributes(out, map);
}
* format)
*
* @param alignedRegions
- * a list of "Align fromStart toStart fromCount"
+ * a list of "Align fromStart toStart fromCount"
* @param mapIsFromCdna
- * if true, 'from' is dna, else 'from' is protein
+ * if true, 'from' is dna, else 'from' is protein
* @param strand
- * either 1 (forward) or -1 (reverse)
+ * either 1 (forward) or -1 (reverse)
* @return
* @throws IOException
*/
return seq;
}
+ // BH! check that we did not lose something here.
+// /**
+// * Process the 'column 9' data of the GFF file. This is less formally defined,
+// * and its interpretation will vary depending on the tool that has generated
+// * it.
+// *
+// * @param attributes
+// * @param sf
+// */
+// protected void processGffColumnNine(String attributes, SequenceFeature sf)
+// {
+// sf.setAttributes(attributes);
+//
+// /*
+// * Parse attributes in column 9 and add them to the sequence feature's
+// * 'otherData' table; use Note as a best proxy for description
+// */
+// char nameValueSeparator = gffVersion == 3 ? '=' : ' ';
+// // TODO check we don't break GFF2 values which include commas here
+// Map<String, List<String>> nameValues = GffHelperBase
+// .parseNameValuePairs(attributes, ";", nameValueSeparator, ",");
+// for (Entry<String, List<String>> attr : nameValues.entrySet())
+// {
+// String values = StringUtils.listToDelimitedString(attr.getValue(),
+// "; ");
+// sf.setValue(attr.getKey(), values);
+// if (NOTE.equals(attr.getKey()))
+// {
+// sf.setDescription(values);
+// }
+// }
+// }
+
/**
* After encountering ##fasta in a GFF3 file, process the remainder of the
* file as FAST sequence data. Any placeholder sequences created during