AlignmentI align, List<SequenceI> newseqs,
boolean relaxedIdMatching) throws IOException
{
- /*
- * (For now) we don't process mappings from reverse complement ; to do
- * this would require (a) creating a virtual sequence placeholder for
- * the reverse complement (b) resolving the sequence by its id from some
- * source (GFF ##FASTA or other) (c) creating the reverse complement
- * sequence (d) updating the mapping to be to the reverse complement
- */
- if ("-".equals(gff[STRAND_COL]))
- {
- System.err
- .println("Skipping mapping from reverse complement as not yet supported");
- return null;
- }
SequenceFeature sf = null;
if (gff.length == 9)
throws IOException
{
String strand = gffColumns[STRAND_COL];
- if ("-1".equals(strand))
+
+ /*
+ * (For now) we don't process mappings from reverse complement ; to do
+ * this would require (a) creating a virtual sequence placeholder for
+ * the reverse complement (b) resolving the sequence by its id from some
+ * source (GFF ##FASTA or other) (c) creating the reverse complement
+ * sequence (d) updating the mapping to be to the reverse complement
+ */
+ if ("-".equals(strand))
{
System.err
- .println("Currently ignoring mappings from reverse complement");
+ .println("Skipping mapping from reverse complement as not yet supported");
return null;
}
Map<String, List<String>> attributes)
{
SequenceFeature sf = super.buildSequenceFeature(gff, attributes);
+ String desc = getDescription(sf, attributes);
+ if (desc != null)
+ {
+ sf.setDescription(desc);
+ }
+ return sf;
+ }
+
+ /**
+ * Apply heuristic rules to try to get the most useful feature description
+ *
+ * @param sf
+ * @param attributes
+ * @return
+ */
+ protected String getDescription(SequenceFeature sf,
+ Map<String, List<String>> attributes)
+ {
+ String desc = null;
String target = (String) sf.getValue(TARGET);
if (target != null)
{
- sf.setDescription(target.split(" ")[0]);
+ desc = target.split(" ")[0];
}
- return sf;
+
+ if (SequenceOntology.getInstance().isSequenceVariant(sf.getType()))
+ {
+ /*
+ * Ensembl returns alleles and consequence_type (amongst other details)
+ */
+ String alleles = StringUtils.listToDelimitedString(
+ attributes.get("alleles"), ",");
+ String consequence = StringUtils.listToDelimitedString(
+ attributes.get("consequence_type"), ",");
+ desc = String.format("alleles %s; consequence %s", alleles,
+ consequence);
+ }
+ return desc;
}
}