*/
private int changeCount;
+ private GeneLoci geneLoci;
+
/**
* Creates a new Sequence object.
*
}
/**
- * DOCUMENT ME!
+ * Sets the sequence description, and also parses out any special formats of
+ * interest
*
* @param desc
- * DOCUMENT ME!
*/
@Override
public void setDescription(String desc)
{
this.description = desc;
+ parseDescription();
}
/**
- * DOCUMENT ME!
+ * Parses and saves fields of an Ensembl-style description e.g.
+ * chromosome:GRCh38:17:45051610:45109016:1
+ */
+ protected void parseDescription()
+ {
+ if (description == null)
+ {
+ return;
+ }
+ String[] tokens = description.split(":");
+ if (tokens.length == 6 && "chromosome".equals(tokens[0])) {
+ String ref = tokens[1];
+ String chrom = tokens[2];
+ try {
+ int chStart = Integer.parseInt(tokens[3]);
+ int chEnd = Integer.parseInt(tokens[4]);
+ boolean forwardStrand = "1".equals(tokens[5]);
+ String species = ""; // dunno yet!
+ int[] from = new int[] { start, end };
+ int[] to = new int[] { forwardStrand ? chStart : chEnd,
+ forwardStrand ? chEnd : chStart };
+ MapList map = new MapList(from, to, 1, 1);
+ GeneLoci gl = new GeneLoci(species, ref, chrom, map);
+ setGeneLoci(gl);
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Bad integers in description " + description);
+ }
+ }
+ }
+
+ public void setGeneLoci(GeneLoci gl)
+ {
+ geneLoci = gl;
+ }
+
+ /**
+ * Returns the gene loci mapping for the sequence (may be null)
*
- * @return DOCUMENT ME!
+ * @return
+ */
+ @Override
+ public GeneLoci getGeneLoci()
+ {
+ return geneLoci;
+ }
+
+ /**
+ * Answers the description
+ *
+ * @return
*/
@Override
public String getDescription()