*/
package jalview.analysis;
+import static jalview.io.gff.GffConstants.CLINICAL_SIGNIFICANCE;
+
import jalview.datamodel.AlignedCodon;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
private static final String SEQUENCE_VARIANT = "sequence_variant:";
private static final String ID = "ID";
- private static final String CLINICAL_SIGNIFICANCE = "clinical_significance";
/**
* A data model to hold the 'normal' base value at a position, and an optional
if (trans != null && !trans.equals(residue))
{
String desc = residue + "->" + trans;
- // set score to 0f so 'graduated colour' option is offered!
+ // set score to 0f so 'graduated colour' option is offered! JAL-2060
SequenceFeature sf = new SequenceFeature(
SequenceOntologyI.SEQUENCE_VARIANT, desc, peptidePos,
peptidePos, 0f, null);
+ StringBuilder attributes = new StringBuilder(32);
String id = (String) var.variant.getValue(ID);
if (id != null)
{
id = id.substring(SEQUENCE_VARIANT.length());
}
sf.setValue(ID, id);
+ attributes.append(ID).append("=").append(id);
// TODO handle other species variants
StringBuilder link = new StringBuilder(32);
try
if (clinSig != null)
{
sf.setValue(CLINICAL_SIGNIFICANCE, clinSig);
+ attributes.append(";").append(CLINICAL_SIGNIFICANCE).append("=")
+ .append(clinSig);
}
peptide.addSequenceFeature(sf);
+ if (attributes.length() > 0)
+ {
+ sf.setAttributes(attributes.toString());
+ }
return true;
}
return false;
// private key for Phase designed not to conflict with real GFF data
private static final String PHASE = "!Phase";
+ /*
+ * ATTRIBUTES is reserved for the GFF 'column 9' data, formatted as
+ * name1=value1;name2=value2,value3;...etc
+ */
private static final String ATTRIBUTES = "ATTRIBUTES";
public int begin;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.io.gff.GffConstants;
import jalview.util.DBRefUtils;
import jalview.util.UrlLink;
{
sb.append("; (").append(status).append(")");
}
- String clinSig = (String) feature.getValue("clinical_significance");
+ String clinSig = (String) feature
+ .getValue(GffConstants.CLINICAL_SIGNIFICANCE);
if (clinSig != null)
{
sb.append("; ").append(clinSig);
--- /dev/null
+package jalview.io.gff;
+
+/**
+ * A class to hold constants shared by creators and consumers of GFF or feature
+ * data
+ */
+public class GffConstants
+{
+ // SequenceOntology terms are to be found in SequenceOntologyI
+
+ /*
+ * clinical_significance may be an attribute of
+ * sequence_variant data from Ensembl
+ */
+ public static final String CLINICAL_SIGNIFICANCE = "clinical_significance";
+
+ /*
+ * not instantiable
+ */
+ private GffConstants()
+ {
+ }
+}
assertEquals("K->E", sf.getDescription());
assertEquals("var1.125A>G", sf.getValue("ID"));
assertNull(sf.getValue("clinical_significance"));
+ assertEquals("ID=var1.125A>G", sf.getAttributes());
assertEquals(1, sf.links.size());
// link to variation is urlencoded
assertEquals(
assertEquals("K->Q", sf.getDescription());
assertEquals("var2", sf.getValue("ID"));
assertEquals("Dodgy", sf.getValue("clinical_significance"));
+ assertEquals("ID=var2;clinical_significance=Dodgy", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
"K->Q var2|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var2",
assertEquals("K->N", sf.getDescription());
assertEquals("var4", sf.getValue("ID"));
assertEquals("Benign", sf.getValue("clinical_significance"));
+ assertEquals("ID=var4;clinical_significance=Benign", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
"K->N var4|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var4",
assertEquals("P->H", sf.getDescription());
assertEquals("var6", sf.getValue("ID"));
assertEquals("Good", sf.getValue("clinical_significance"));
+ assertEquals("ID=var6;clinical_significance=Good", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
"P->H var6|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var6",
assertEquals("P->R", sf.getDescription());
assertEquals("var6", sf.getValue("ID"));
assertEquals("Good", sf.getValue("clinical_significance"));
+ assertEquals("ID=var6;clinical_significance=Good", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
"P->R var6|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var6",