text:
//		xiNET cross-link viewer
//		Copyright 2013 Rappsilber Laboratory, University of Edinburgh
//
//		authors: Lutz Fischer, Colin Combe
//
//		Protein.js

"use strict";

Protein.STICKHEIGHT = 20; 		// height of stick in pixels
Protein.MAXSIZE = 100; 			// residue count of longest sequence
Protein.UNITS_PER_RESIDUE = 1; 	// this value is changed during init (calculated on basis of MAXSIZE)
Protein.LABELMAXLENGTH = 60; 	// maximal width reserved for protein-labels
Protein.labelY = -5; 			// label Y offset, better if calc'd half height of label once rendered
Protein.domainColours = d3.scale.ordinal().range(colorbrewer.Paired[5]);
Protein.transitionTime = 650;

function Protein(id, xinetController, acc, name) {
    this.id = id; // id may not be accession
    this.controller = xinetController;
    this.accession = acc;
    this.name = name;
    this.tooltip = this.name + ' [' + this.id + ']';// + this.accession;

    //links
    this.proteinLinks = d3.map();
    this.selfLink = null;
    // layout info
    this.x = 40;
    this.y = 40;
    this.rotation = 0;
    this.previousRotation = this.rotation;
    this.stickZoom = 1;
    this.form = 0;//null; // 0 = blob, 1 = stick
    this.isParked = false;
    this.isFlipped = false;
    this.isSelected = false;
    //annotation scheme
    this.customAnnotations = null;//TODO: tidy up, not needed have this.annotations instead
	//rotators
	//~ this.mouseoverControls = new MouseoverControls(this, this.controller);
	this.lowerRotator = new Rotator(this, 0, this.controller);
	this.upperRotator = new Rotator(this, 1, this.controller);

    /*
     * Lower group
     * svg group for elements that appear underneath links
     */
    this.lowerGroup = document.createElementNS(xiNET.svgns, "g");
    this.lowerGroup.setAttribute("class", "protein lowerGroup");

 	//make highlight
    this.highlight = document.createElementNS(xiNET.svgns, "rect");
    if (xiNET.highlightColour !== undefined) {
        this.highlight.setAttribute("stroke", xiNET.highlightColour.toRGB());
	}
    this.highlight.setAttribute("stroke-width", "5");
    this.highlight.setAttribute("fill", "none");
    this.lowerGroup.appendChild(this.highlight);

    //domains in rectangle form (shown underneath links)
    this.rectDomains = document.createElementNS(xiNET.svgns, "g");
    this.rectDomains.setAttribute("opacity", "0");
    this.lowerGroup.appendChild(this.rectDomains);

    this.peptides = document.createElementNS(xiNET.svgns, "g");
	this.lowerGroup.appendChild(this.peptides);

	/*
     * Upper group
     * svg group for elements that appear above links
     */

    this.upperGroup = document.createElementNS(xiNET.svgns, "g");
    this.upperGroup.setAttribute("class", "protein upperGroup");

    //svg groups for self links
    this.intraLinksHighlights = document.createElementNS(xiNET.svgns, "g");
    this.intraLinks = document.createElementNS(xiNET.svgns, "g");
    this.upperGroup.appendChild(this.intraLinksHighlights);
	this.upperGroup.appendChild(this.intraLinks);

    //create label - we will move this svg element around when protein form changes
    this.labelSVG = document.createElementNS(xiNET.svgns, "text");
    this.labelSVG.setAttribute("text-anchor", "end");
    this.labelSVG.setAttribute("fill", this.isDecoy()? "#FB8072":"black")
    this.labelSVG.setAttribute("x", 0);
    this.labelSVG.setAttribute("y", 10);
    this.labelSVG.setAttribute("class", "protein xlv_text proteinLabel");
    this.labelSVG.setAttribute('font-family', 'Arial');
    this.labelSVG.setAttribute('font-size', '16');
    //choose label text
    if (this.name) {
        this.labelText = this.name;
    }
    else if (this.accession != null & this.accession !== "") {
        this.labelText = this.accession;
    }
    else {
		this.labelText  = this.id;
	}
    if (this.labelText.length > 25) {
        this.labelText = this.labelText.substr(0, 16) + "...";
    }
	this.labelTextNode = document.createTextNode(this.labelText);
    this.labelSVG.appendChild(this.labelTextNode);
    d3.select(this.labelSVG).attr("transform",
		"translate( -" + (5) + " " + Protein.labelY + ") rotate(0) scale(1, 1)");
    this.upperGroup.appendChild(this.labelSVG);

   	//ticks (and animo acid letters)
    this.ticks = document.createElementNS(xiNET.svgns, "g");

	//make outline
    //http://stackoverflow.com/questions/17437408/how-do-i-change-a-circle-to-a-square-using-d3
	this.outline = document.createElementNS(xiNET.svgns, "rect");
    this.outline.setAttribute("stroke", "black");
    this.outline.setAttribute("stroke-width", "1");
    this.outline.setAttribute("fill", "#EEEEEE");
    this.upperGroup.appendChild(this.outline);
     this.upperGroup.appendChild(this.ticks);
   //domains as pie slices - shown on top of everything
	this.circDomains = document.createElementNS(xiNET.svgns, "g");
    //~ this.circDomains.setAttribute("class", "protein circDomains");
	this.circDomains.setAttribute("opacity", 1);
	this.upperGroup.appendChild(this.circDomains);

    this.scaleLabels = new Array();

    // events
    var self = this;
    //    this.upperGroup.setAttribute('pointer-events','all');
    this.upperGroup.onmousedown = function(evt) {
		self.mouseDown(evt);
    };
    this.upperGroup.onmouseover = function(evt) {
		self.mouseOver(evt);
    };
    this.upperGroup.onmouseout = function(evt) {
		self.mouseOut(evt);
    };
    this.upperGroup.ontouchstart = function(evt) {
		self.touchStart(evt);
    };
    this.isSelected = false;
	this.showHighlight(false);
};

//sequence = amino acids in UPPERCASE, digits or lowercase can be used for modification info
Protein.prototype.setSequence = function(sequence){
    //check for labeling modifications in sequence now, we're about to lose this info
    if (/\d/.test(sequence)) {//is there a digit in the sequence?
        this.labeling = '';// as in silac labelling
        if (sequence.indexOf('K4') !== -1)
            this.labeling += 'K4';
        if (sequence.indexOf('K6') !== -1)
            this.labeling += 'K6';
        if (sequence.indexOf('K8') !== -1)
            this.labeling += 'K8';
        if (sequence.indexOf('K10') !== -1)
            this.labeling += 'R4';
        if (sequence.indexOf('R6') !== -1)
            this.labeling += 'R6';
        if (sequence.indexOf('R8') !== -1)
            this.labeling += 'R8';
        if (sequence.indexOf('R10') !== -1)
            this.labeling += 'R10';
    }
    if (typeof this.labeling !== 'undefined') {
        this.labelSVG.innerHTML = '[' + this.labeling + '] ' + this.labelSVG.innerHTML;
    }
    //remove modification site info from sequence
    this.sequence = sequence.replace(/[^A-Z]/g, '');
    this.size = this.sequence.length;
    //~ console.log(">prot.setSeq " + this.name + "\t" + this.size);
}

//by the we get here all prot's have had their sequence set, so protein.MAXSIZE has correct value;
Protein.prototype.init = function() {
    //this.setForm(this.form);
    if (this.selfLink) this.selfLink.initSelfLinkSVG();
    this.setAllLineCoordinates();
    //~ console.log(">prot.init " + this.name + "\t" + this.size);
}

Protein.prototype.mouseDown = function(evt) {
           this.controller.preventDefaultsAndStopPropagation(evt);//see MouseEvents.js
        //if a force layout exists then stop it
        if (this.controller.force) {
            this.controller.force.stop();
        }
        this.controller.dragElement = this;
        //~ if (evt.ctrlKey === false) {
            this.controller.clearSelection();
            this.setSelected(true);
        //~ } else {
            //~ this.setSelected(!this.isSelected);
        //~ }
        //store start location
        var p = this.controller.getEventPoint(evt);
        this.controller.dragStart = this.controller.mouseToSVG(p.x, p.y);

        var message = "";
		//heading, including PDB link
		message += this.name + "   [" + this.id + "]
";
		if (this.accession) {
			message += "PDB
";
		}
		this.controller.message(message);
		var self = this;
		if (this.accession){
			xiNET_Storage.getUniProtTxt(this.accession, function (id, txt){
				self.controller.message(message + "
" + txt + "
");
			});
		}
        return false;
};

Protein.prototype.touchStart = function(evt) {
           this.controller.preventDefaultsAndStopPropagation(evt);//see MouseEvents.js
        //if a force layout exists then stop it
        if (this.controller.force !== undefined) {
            this.controller.force.stop();
        }
        this.controller.dragElement = this;
        this.controller.clearSelection();
        this.setSelected(true);
        //store start location
        var p = this.controller.getTouchEventPoint(evt);
        this.controller.dragStart = this.controller.mouseToSVG(p.x, p.y);

        var self = this;
        var message = "";
		//heading, including PDB link
		message += "
" + this.name + "   [" + this.id + "]

";
		if (typeof this.accession !== "undefined") {
			message += "PDB
";
		}
		this.controller.message(message);
		var self = this;
		xiNET_Storage.getUniProtTxt(this.accession, function (id, txt){
			self.controller.message(message + "
" + txt + "
");
		});

        return false;
};

Protein.prototype.mouseOver = function(evt) {
        this.controller.preventDefaultsAndStopPropagation(evt);
        this.showHighlight(true);
        this.controller.setTooltip(this.tooltip);
        return false;
};

Protein.prototype.mouseOut = function(evt) {
        this.controller.preventDefaultsAndStopPropagation(evt);
        this.showHighlight(false);
        this.controller.hideTooltip();
        return false;
};

Protein.prototype.getBlobRadius = function() {
	var rad = Math.sqrt(this.size / Math.PI);
	//console.log(rad);
    return rad;
};

Protein.prototype.isDecoy = function() {
	if (!this.name){
		return false;
	}
    else if (this.name.indexOf("DECOY_") === -1 && this.name !== "REV") {
		return false;
	} else {
		return true;
	}
};

//only output the info needed to reproduce the layout, used by save layout function
Protein.prototype.toJSON = function() {
    return {
        x: this.x,
        y: this.y,
        rot: this.rotation,
        form: this.form,
        stickZoom: this.stickZoom,
        parked: this.isParked,
        flipped: this.isFlipped
    };
};

Protein.prototype.addLink = function(link) {
    if (!this.proteinLinks.has(link.id)) {
        this.proteinLinks.set(link.id, link);
    }
    if (link.selfLink()) {
        this.selfLink = link;
        if (this.size) this.selfLink.initSelfLinkSVG();
    }
    if (link.toProtein === null) {
        this.linkerModifications = link;
    }
};

Protein.prototype.showHighlight = function(show) {
    if (show === true) {
        this.highlight.setAttribute("stroke", xiNET.highlightColour.toRGB());
        this.highlight.setAttribute("stroke-opacity", "1");
    } else {
		if (this.isSelected == false) {
                this.highlight.setAttribute("stroke-opacity", "0");
        }
        this.highlight.setAttribute("stroke", xiNET.selectedColour.toRGB());
    }
};

Protein.prototype.setSelected = function(select) {
    if (select && this.isSelected === false) {
        this.controller.selected.set(this.id, this);
        this.isSelected = true;
		this.highlight.setAttribute("stroke", xiNET.selectedColour.toRGB());
		this.highlight.setAttribute("stroke-opacity", "1");
    }
    else if (select === false && this.isSelected === true) {
        this.controller.selected.remove(this.id);
        this.isSelected = false;
		this.highlight.setAttribute("stroke-opacity", "0");
		this.highlight.setAttribute("stroke", xiNET.highlightColour.toRGB());
    }
};

Protein.prototype.setRotation = function(angle) {
    this.rotation = angle % 360;
    if (this.rotation < 0) {
        this.rotation += 360;
	}
    this.upperGroup.setAttribute("transform", "translate(" + this.x + " " + this.y + ")"
			+ " scale(" + (this.controller.z) + ") " + "rotate(" + this.rotation + ")");
    this.lowerGroup.setAttribute("transform", "translate(" + this.x + " " + this.y + ")"
			+ " scale(" + (this.controller.z) + ") " + "rotate(" + this.rotation + ")");

    var svg = this.controller.svgElement;
	var transformToContainingGroup = this.labelSVG.getAttribute("transform");
	var labelTransform = d3.transform(transformToContainingGroup);
	var sll = this.scaleLabels.length;
	if (this.rotation >= 90 && this.rotation < 270) {
			var k = svg.createSVGMatrix()
						.translate(Math.abs(labelTransform.translate[0]), -Protein.labelY)
						.rotate(180, 0, 0);
			this.labelSVG.transform.baseVal.initialize(svg.createSVGTransformFromMatrix(k));
			if (this.form ===1){
				for (var i = 0; i < sll; i++) {
					   this.scaleLabels[i].setAttribute("transform", "scale(-1,1)");
					}
					this.ticks.setAttribute("transform", "scale(1,-1)");
			}
	}
    else {
    		var k = svg.createSVGMatrix()
						.translate(-(Math.abs(labelTransform.translate[0])), Protein.labelY);
			this.labelSVG.transform.baseVal.initialize(svg.createSVGTransformFromMatrix(k));
			if (this.form ===1){
				for (var j = 0; j < sll; j++) {
					this.scaleLabels[j].setAttribute("transform", "scale(1,1)");
				}
				this.ticks.setAttribute("transform", "scale(1,1)");
			}
	}
};

// more accurately described as setting transform for top svg elements (sets scale also)
Protein.prototype.setPosition = function(x, y) {
    this.x = x;
    this.y = y;
    if (this.form === 1 && this.isParked === false){
		this.upperGroup.setAttribute("transform", "translate(" + this.x + " " + this.y + ")"
				+ " scale(" + (this.controller.z) + ") " + "rotate(" + this.rotation + ")");
		this.lowerGroup.setAttribute("transform", "translate(" + this.x + " " + this.y + ")"
				+ " scale(" + (this.controller.z) + ") " + "rotate(" + this.rotation + ")");
    }
    else {
		this.upperGroup.setAttribute("transform", "translate(" + this.x + " " + this.y + ")"
				+ " scale(" + (this.controller.z) + ") ");
		this.lowerGroup.setAttribute("transform", "translate(" + this.x + " " + this.y + ")"
				+ " scale(" + (this.controller.z) + ") ");
		if (this.selfLink != null) {
			if (typeof this.selfLink.fatLine !== 'undefined') {
				this.selfLink.fatLine.setAttribute("transform", "translate(" + this.x
						+ " " + this.y + ")" + " scale(" + (this.controller.z) + ")");
			}
				this.selfLink.line.setAttribute("transform", "translate(" + this.x
						+ " " + this.y + ")" + " scale(" + (this.controller.z) + ")");
				this.selfLink.highlightLine.setAttribute("transform", "translate(" + this.x
						+ " " + this.y + ")" + " scale(" + (this.controller.z) + ")");
		}
	}
};

Protein.rotOffset = 25 * 0.7; // see Rotator.js
Protein.minXDist = 30;
Protein.prototype.switchStickScale = function(svgP) {
    if (this.isParked) {
        this.toggleParked();
    }
    if (this.form === 0) {
        this.toStick();
    }
    else {
        var pixPerRes = Protein.UNITS_PER_RESIDUE * this.stickZoom; // / this.controller.z;
        if (pixPerRes > 8) {
            this.stickZoom = 0.5;//this looks like a hack
            this.setPosition(svgP.x, svgP.y);
        }
        else {
            this.stickZoom = this.stickZoom * 3;
            //move stick so same residue is under mouse
            var dx = this.x - (svgP.x);
            var dy = this.y - (svgP.y);
            if (this.rotation === 0 || this.rotation === 180) {
                dy = 0;
            }
            //            console.log(dx + ',' + dy);
            this.setPosition(this.x + (dx * 2), this.y + (dy * 2));
        }
    }
    // when setting the form of prot's,
    // remember following doesn't happen when you just call toStick();
    this.scale();
    this.setAllLineCoordinates();
};

Protein.prototype.scale = function() {
    var protLength = (this.size) * Protein.UNITS_PER_RESIDUE * this.stickZoom;
    if (this.form === 1) {
      	var labelTransform = d3.transform(this.labelSVG.getAttribute("transform"));
		var k = this.controller.svgElement.createSVGMatrix().rotate(labelTransform.rotate)
			.translate((-(((this.size / 2) * Protein.UNITS_PER_RESIDUE * this.stickZoom) + 10)), Protein.labelY);//.scale(z).translate(-c.x, -c.y);
		this.labelSVG.transform.baseVal.initialize(this.controller.svgElement.createSVGTransformFromMatrix(k));

		if (this.annotations){
			var ca = this.annotations.length;
			for (var a = 0; a < ca; a++){
				var anno = this.annotations[a];
				anno.pieSlice.setAttribute("d", this.getAnnotationRectPath(anno));
				anno.colouredRect.setAttribute("d", this.getAnnotationRectPath(anno));
			}
		}

		d3.select(this.peptides).attr("transform", "scale(" + (this.stickZoom) + ", 1)");

		d3.select(this.outline)
			.attr("width", protLength)
			.attr("x", this.getResXwithStickZoom(0.5));

		d3.select(this.highlight)
			.attr("width", protLength + 5)
			.attr("x", this.getResXwithStickZoom(0.5) - 2.5);

		//place rotators
		this.lowerRotator.svg.setAttribute("transform",
			"translate(" + (this.getResXwithStickZoom(0.5) - Protein.rotOffset) + " 0)");
        this.upperRotator.svg.setAttribute("transform",
			"translate(" + (this.getResXwithStickZoom(this.size  - 0 + 0.5) + Protein.rotOffset) + " 0)");

        //internal links
        if (this.selfLink != null) {
            var resLinks = this.selfLink.residueLinks.values();
            var iLinkCount = resLinks.length;
            for (var l = 0; l < iLinkCount; l++) {
				var residueLink = resLinks[l];
				if (residueLink.shown) {
					var path = this.getResidueLinkPath(residueLink);
					d3.select(residueLink.line).attr("d", path);
					d3.select(residueLink.highlightLine).attr("d", path);
				}
            }
        }

        //linker modified peptides
        if (this.linkerModifications != null) {
            var mods = this.linkerModifications.residueLinks.values();
            var iModCount = mods.length;
            for (var m = 0; m < iModCount; m++) {
				var mod = mods[m];
				if (mod.shown) {
				   var path = this.getResidueLinkPath(mod);
				   d3.select(mod.line).attr("d", path);
				   d3.select(mod.highlightLine).attr("d", path);
				}
            }
        }
        this.setScaleGroup();
        this.setRotation(this.rotation); // places ticks and rotators
    }
};

Protein.prototype.setScaleGroup = function() {
	//~ this.upperGroup.appendChild(this.ticks);
	this.controller.emptyElement(this.ticks);

    this.scaleLabels = new Array();
	var ScaleMajTick = 100;
	var ScaleTicksPerLabel = 2; // varies with scale?
	var pixPerRes = Protein.UNITS_PER_RESIDUE * this.stickZoom; // / this.controller.z;
	var tick = -1;
	var lastTickX = this.getResXwithStickZoom(this.size);

	for (var res = 1; res <= this.size; res++) {
		if (res === 1 ||
				((res % 100 === 0) && (200 * pixPerRes > Protein.minXDist)) ||
				((res % 10 === 0) && (20 * pixPerRes > Protein.minXDist))
				) {
			var tx = this.getResXwithStickZoom(res);
			if (pixPerRes >= 8 || res !== 1) {
				tickAt(this, tx);
			}
			tick = (tick + 1) % ScaleTicksPerLabel;
			// does this one get a label?
			if (tick === 0) {// && tx > 20) {
				if ((tx + Protein.minXDist) < lastTickX) {
					scaleLabelAt(this, res, tx);
				}
			}
		}
		if (pixPerRes >= 8 && this.sequence) {
			var seqLabelGroup = document.createElementNS(xiNET.svgns, "g");
			seqLabelGroup.setAttribute("transform", "translate(" + this.getResXwithStickZoom(res) + " " + 0 + ")");
			var seqLabel = document.createElementNS(xiNET.svgns, "text");
			seqLabel.setAttribute('font-family', "'Courier New', monospace");
			seqLabel.setAttribute('font-size', '10px');
			seqLabel.setAttribute("text-anchor", "middle");
			seqLabel.setAttribute("x", 0);//protein.getResXwithStickZoom(res));
			seqLabel.setAttribute("y", 3);
			seqLabel.appendChild(document.createTextNode(this.sequence[res - 1]));
			seqLabelGroup.appendChild(seqLabel);
			this.scaleLabels.push(seqLabel);
			this.ticks.appendChild(seqLabelGroup);
		}
	}
	scaleLabelAt(this, this.size, lastTickX);
	if (pixPerRes > 8) {
		tickAt(this, lastTickX);
	}

	function scaleLabelAt(self, text, tickX) {
		var scaleLabelGroup = document.createElementNS(xiNET.svgns, "g");
		scaleLabelGroup.setAttribute("transform", "translate(" + tickX + " " + 0 + ")");
		var scaleLabel = document.createElementNS(xiNET.svgns, "text");
		scaleLabel.setAttribute("class", "protein xlv_text proteinLabel");
		scaleLabel.setAttribute('font-family', "'Courier New', monospace");
		scaleLabel.setAttribute('font-size', '14');
		scaleLabel.setAttribute("text-anchor", "middle");
		scaleLabel.setAttribute("x", 0);
		scaleLabel.setAttribute("y", Protein.STICKHEIGHT + 4);
		scaleLabel.appendChild(document.createTextNode(text));
		scaleLabelGroup.appendChild(scaleLabel);
		self.scaleLabels.push(scaleLabel);
		self.ticks.appendChild(scaleLabelGroup);
	}

	function tickAt(self, tickX) {
		var tick = document.createElementNS(xiNET.svgns, "line");
		tick.setAttribute("x1", tickX);
		tick.setAttribute("y1", 5);
		tick.setAttribute("x2", tickX);
		tick.setAttribute("y2", 10);
		tick.setAttribute("stroke", "black");
		self.ticks.appendChild(tick);
	}
};

Protein.prototype.toggleFlipped = function() {
    this.isFlipped = !this.isFlipped;
    if (this.isFlipped) {
        this.intraLinks.setAttribute("transform", "scale (1 -1)");
        this.intraLinksHighlights.setAttribute("transform", "scale (1 -1)");
    }
    else {
        this.intraLinks.setAttribute("transform", "scale (1 1)");
        this.intraLinksHighlights.setAttribute("transform", "scale (1 1)");
    }
};

Protein.prototype.setParked = function(bool, svgP) {
   this.isParked = bool;
   if (this.busy !== true) {
		if (bool == false) {
			if (this.form === 0) {
				d3.select(this.outline).transition()
					.attr("stroke-opacity", 1).attr("fill-opacity", 1)
					.attr("fill", "#ffffff")
					.duration(Protein.transitionTime);
				this.checkLinks();
				d3.select(this.circDomains).transition().attr("opacity", 1)
					.attr("transform", "scale(1, 1)")
					.duration(Protein.transitionTime);
			}
			else {
				this.toStick();
			}
			this.scale();
			this.setAllLineCoordinates();
		}
		else if (bool == true) {
			this.isParked = true;
			var c = this.proteinLinks.values().length;
			for (var l = 0; l < c; l++) {
				var link = this.proteinLinks.values()[l];
				//out with the old (i.e. all links)
				link.hide();
				var resLinks = link.residueLinks.values();
				var resLinkCount = resLinks.length;
				for (var rl = 0; rl < resLinkCount; rl++) {
					var resLink = resLinks[rl];
						resLink.hide();
				}
			}

			if (this.form === 1){
				this.toCircle(svgP);
				var r = this.getBlobRadius();
				d3.select(this.outline).transition()
					.attr("stroke-opacity", 0).attr("fill-opacity", 1)
					.attr("fill", "#EEEEEE")
					.attr("x", -r).attr("y", -r)
					.attr("width", r * 2).attr("height", r * 2)
					.attr("rx", r).attr("ry", r)
					.duration(Protein.transitionTime);
				d3.select(this.rectDomains).transition().attr("opacity", 0)
					.attr("transform", "scale(1, 1)")
					.duration(Protein.transitionTime);
			}
			else {
				d3.select(this.outline).transition()
					.attr("stroke-opacity", 0)
					.attr("fill", "#EEEEEE")
					.duration(Protein.transitionTime);
				d3.select(this.circDomains).transition().attr("opacity", 0)
					.attr("transform", "scale(1, 1)")
					.duration(Protein.transitionTime);
			}
		}
	}
};

Protein.prototype.setForm = function(form, svgP) {
	//this.form = form; //cant have this here
    if (this.busy !== true) {
		if (this.isParked) {
			this.setParked(false);
		}
		else
		{
			if (form == 1) {
				this.toStick();
			}
			else {
				this.toCircle(svgP);
				var r = this.getBlobRadius();

				var self = this;
				d3.select(this.outline).transition()
					.attr("stroke-opacity", 1).attr("fill-opacity", 1)
					.attr("fill", "#ffffff")
					.attr("x", -r).attr("y", -r)
					.attr("width", r * 2).attr("height", r * 2)
					.attr("rx", r).attr("ry", r)
					.duration(Protein.transitionTime);

				d3.select(this.rectDomains).transition().attr("opacity", 0)
					.attr("transform", "scale(1, 1)")
					.duration(Protein.transitionTime);

				d3.select(this.circDomains).transition().attr("opacity", 1)
					.attr("transform", "scale(1, 1)")
					.duration(Protein.transitionTime);
			}
		}
	}
};

Protein.prototype.toCircle = function(svgP) {
	this.busy = true;
	this.removePeptides();
	if (this.upperGroup.contains(this.lowerRotator.svg)) this.upperGroup.removeChild(this.lowerRotator.svg);
	if (this.upperGroup.contains(this.upperRotator.svg))this.upperGroup.removeChild(this.upperRotator.svg);

    var protLength = this.size * Protein.UNITS_PER_RESIDUE * this.stickZoom;
	var r = this.getBlobRadius();

	var stickZoomInterpol = d3.interpolate(this.stickZoom, 0);
	var rotationInterpol = d3.interpolate((this.rotation > 180)? this.rotation - 360 : this.rotation, 0);
	//todo: should take current tranform of label as start
	var labelTransform = d3.transform(this.labelSVG.getAttribute("transform"));
	var labelStartPoint = labelTransform.translate[0];//-(((this.size / 2) * Protein.UNITS_PER_RESIDUE * this.stickZoom) + 10);
	var labelTranslateInterpol = d3.interpolate(labelStartPoint, -(r + 5));

	var xInterpol = null, yInterpol = null;
	if (typeof svgP !== 'undefined' && svgP !== null) {
		xInterpol = d3.interpolate(this.x, svgP.x);
		yInterpol = d3.interpolate(this.y, svgP.y);
	}

	var self = this;
	d3.select(this.ticks).transition().attr("opacity", 0).duration(Protein.transitionTime / 4)
				.each("end",
					function () {
						self.controller.emptyElement(this);//this === self.ticks
						//if (self.upperGroup.contains(self.ticks))self.upperGroup.removeChild(self.ticks);
					}
				);

	d3.select(this.highlight).transition()
		.attr("width", (r * 2) + 5).attr("height", (r * 2) + 5)
		.attr("x", -r - 2.5).attr("y", -r - 2.5)
		.attr("rx", r + 2.5).attr("ry", r + 2.5)
		.duration(Protein.transitionTime);

	if (this.selfLink != null) {
		var resLinks = this.selfLink.residueLinks.values();
		var resLinkCount = resLinks.length;
		for (var rl = 0; rl < resLinkCount; rl++) {
			var residueLink = resLinks[rl];
			if (residueLink.intra === true && residueLink.shown) {
						var selectLine = d3.select(residueLink.line);
						selectLine.attr("d",this.getResidueLinkPath(residueLink));
						selectLine.transition().attr("d",this.getAggregateSelfLinkPath())
							.duration(Protein.transitionTime);
						var highlightLine = d3.select(residueLink.highlightLine);
						highlightLine.attr("d",this.getResidueLinkPath(residueLink));
						highlightLine.transition().attr("d",this.getAggregateSelfLinkPath())
							.duration(Protein.transitionTime);
			}
		}
	}

	//linker modified peptides
	if (this.linkerModifications != null) {
		var mods = this.linkerModifications.residueLinks.values();
		var iModCount = mods.length;
		for (var m = 0; m < iModCount; m++) {
			var mod = mods[m];
			if (mod.shown) {
				var selectLine = d3.select(mod.line);
				selectLine.attr("fill", "none");
				selectLine.attr("d", "M 0,0 L 0,0");
			}
		}
	}

	var self = this;
	if (this.annotations) {
		var annots = this.annotations;
		var ca = annots.length;
		for (var a = 0; a < ca; a++) {
			var anno = annots[a];
			var pieSlice = anno.pieSlice;
			var rectDomain = anno.colouredRect;
			d3.select(pieSlice).transition().attr("d", this.getAnnotationPieSliceApproximatePath(anno))
				.duration(Protein.transitionTime).each("end",
					function () {
						for (var b = 0; b < ca; b++) {
							var annoB = self.annotations[b];
							if (this === annoB.pieSlice){
								d3.select(this).attr("d", self.getAnnotationPieSliceArcPath(annoB));
							}
						}
					}
				);
			d3.select(rectDomain).transition().attr("d", self.getAnnotationPieSliceApproximatePath(anno))
				.duration(Protein.transitionTime);
		}
	}

	var originalStickZoom = this.stickZoom;
	var originalRotation = this.rotation;
	var cubicInOut = d3.ease('cubic-in-out');
	d3.timer(function(elapsed) {
	  return update(elapsed / Protein.transitionTime);
	});

	function update(interp) {
		// if (self.isParked === false) { //that wont work
//can following be removed
			var labelTransform = d3.transform(self.labelSVG.getAttribute("transform"));
			var k = self.controller.svgElement.createSVGMatrix().rotate(labelTransform.rotate).translate(labelTranslateInterpol(cubicInOut(interp)), Protein.labelY);//.scale(z).translate(-c.x, -c.y);
			self.labelSVG.transform.baseVal.initialize(self.controller.svgElement.createSVGTransformFromMatrix(k));
		// }
		 if (xInterpol !== null){
			 self.setPosition(xInterpol(cubicInOut(interp)), yInterpol(cubicInOut(interp)));
		 }
		 //~ else {
			 //~ self.setPosition(self.getX(), self.getY());
		 //~ }

	   	var rot = rotationInterpol(cubicInOut(interp));
		self.stickZoom = stickZoomInterpol(cubicInOut(interp))
		self.setRotation(rot);
		self.setAllLineCoordinates();

		if (interp ===  1){ // finished - tidy up
			var links = self.proteinLinks.values();
			var c = links.length;
			for (var l = 0; l < c; l++) {
				var link = links[l];
				if (link.toProtein === null || (link.getFromProtein() === self && link.getToProtein().form === 0) ||
						(link.getToProtein() === self && link.getFromProtein().form === 0) ||
						(link.getToProtein() == link.getFromProtein()))
				{
					// swap links - out with the old
					var resLinks = link.residueLinks.values();
					var resLinkCount = resLinks.length;
					for (var rl = 0; rl < resLinkCount; rl++) {
						var resLink = resLinks[rl];
							resLink.hide();
					}
				}
			}
			//bring in new
			self.form = 0;
			//~ self.setPosition(self.x, self.y);
			self.checkLinks();
			self.stickZoom = originalStickZoom;
			self.rotation = originalRotation;
			self.busy = false;
			return true;
		} else if (interp > 1){
			return update(1);
		} else {
			return false;
		}
	}
};

Protein.prototype.getX = function() {return this.x;}

Protein.prototype.getY = function() {return this.y;}

Protein.prototype.toStick = function() {
	this.busy = true;
    this.form = 1;

    //place rotators
	this.upperGroup.appendChild(this.lowerRotator.svg);
	this.upperGroup.appendChild(this.upperRotator.svg);
	this.lowerRotator.svg.setAttribute("transform",
		"translate(" + (this.getResXwithStickZoom(0.5) - Protein.rotOffset) + " 0)");
	this.upperRotator.svg.setAttribute("transform",
		"translate(" + (this.getResXwithStickZoom(this.size - 0 + 0.5) + Protein.rotOffset) + " 0)");
   //remove prot-prot links - would it be better if checkLinks did this? - think not
	var c = this.proteinLinks.values().length;
	for (var l = 0; l < c; l++) {
		var link = this.proteinLinks.values()[l];
		//out with the old
		if (link.shown) {
			link.hide();
		}
	}

    var protLength = this.size * Protein.UNITS_PER_RESIDUE * this.stickZoom;
	var r = this.getBlobRadius();

 	var lengthInterpol = d3.interpolate((2 * r), protLength);
	var stickZoomInterpol = d3.interpolate(0, this.stickZoom);
	var rotationInterpol = d3.interpolate(0, (this.rotation > 180)? this.rotation - 360 : this.rotation);
	var labelTranslateInterpol = d3.interpolate(-(r + 5), -(((this.size / 2) * Protein.UNITS_PER_RESIDUE * this.stickZoom) + 10));

    var origStickZoom = this.stickZoom;
	this.stickZoom = 0;
    this.checkLinks();
	this.stickZoom = origStickZoom;

	d3.select(this.circDomains).transition().attr("opacity", 0)
		//~ .attr("transform", "scale(" + this.stickZoom + ", 1)")
		.duration(Protein.transitionTime);
	d3.select(this.rectDomains).transition().attr("opacity", 1)
		//~ .attr("transform", "scale(" + this.stickZoom + ", 1)")
		.duration(Protein.transitionTime);

	d3.select(this.outline).transition().attr("stroke-opacity", 1)
	.attr("fill-opacity",  0)
		.attr("fill", "#FFFFFF")
		.attr("height", Protein.STICKHEIGHT)
		.attr("y",  -Protein.STICKHEIGHT / 2)
		.attr("rx", 0).attr("ry", 0)
		.duration(Protein.transitionTime);

	d3.select(this.highlight).transition()
		.attr("width", protLength + 5).attr("height", Protein.STICKHEIGHT + 5)
		.attr("x", this.getResXwithStickZoom(0.5) - 2.5).attr("y", (-Protein.STICKHEIGHT / 2) - 2.5)
		.attr("rx", 0).attr("ry", 0)
		.duration(Protein.transitionTime);

	 if (this.selfLink != null) {
		var resLinks = this.selfLink.residueLinks.values();
		var resLinkCount = resLinks.length;
		for (var rl = 0; rl < resLinkCount; rl++) {
			var residueLink = resLinks[rl];
			if (residueLink.shown) {
				d3.select(residueLink.line).attr("d",this.getAggregateSelfLinkPath());
				d3.select(residueLink.line).transition().attr("d",this.getResidueLinkPath(residueLink))
					.duration(Protein.transitionTime);
				d3.select(residueLink.highlightLine).attr("d",this.getAggregateSelfLinkPath());
				d3.select(residueLink.highlightLine).transition().attr("d",this.getResidueLinkPath(residueLink))
					.duration(Protein.transitionTime);
			}
		}
	}

   //linker modified peptides
	if (this.linkerModifications != null) {
		var mods = this.linkerModifications.residueLinks.values();
		var iModCount = mods.length;
		for (var m = 0; m < iModCount; m++) {
			var mod = mods[m];
			if (mod.shown) {
				var path = this.getResidueLinkPath(mod);
				d3.select(mod.line).attr("d","M 0,0 L 0,0 L 0,0 L 0,0");
				d3.select(mod.line).transition().attr("d",path)
					.duration(Protein.transitionTime);
				d3.select(mod.highlightLine).attr("d","M 0,0 L 0,0");
				d3.select(mod.highlightLine).transition().attr("d",path)
					.duration(Protein.transitionTime);
			}
		}
	}

	if (this.annotations) {
		var bottom = Protein.STICKHEIGHT / 2, top = -Protein.STICKHEIGHT / 2;
		var annots = this.annotations;
		var ca = annots.length;
		for (var a = 0; a < ca; a++) {
			var anno = annots[a];
			var pieSlice = anno.pieSlice;
			var rectDomain = anno.colouredRect;
			pieSlice.setAttribute("d", this.getAnnotationPieSliceApproximatePath(anno));
			d3.select(pieSlice).transition().attr("d", this.getAnnotationRectPath(anno))
				.duration(Protein.transitionTime);
			d3.select(rectDomain).transition().attr("d", this.getAnnotationRectPath(anno))
				.duration(Protein.transitionTime);
		}
	}

	var self = this;
	var cubicInOut = d3.ease('cubic-in-out');
	d3.timer(function(elapsed) {
	  return update(elapsed / Protein.transitionTime);
	});

	//~ update(1);

	function update(interp) {
		var labelTransform = d3.transform(self.labelSVG.getAttribute("transform"));
		var k = self.controller.svgElement.createSVGMatrix().rotate(labelTransform.rotate).translate(labelTranslateInterpol(cubicInOut(interp)), Protein.labelY);//.scale(z).translate(-c.x, -c.y);
		self.labelSVG.transform.baseVal.initialize(self.controller.svgElement.createSVGTransformFromMatrix(k));

	   	var rot = rotationInterpol(cubicInOut(interp));
		self.setRotation(rot);

		var currentLength = lengthInterpol(cubicInOut(interp));
		d3.select(self.outline).attr("width", currentLength).attr("x", - (currentLength / 2) + (0.5 * Protein.UNITS_PER_RESIDUE * self.stickZoom));
		self.stickZoom = stickZoomInterpol(cubicInOut(interp))
		self.setAllLineCoordinates();

		if (interp ===  1){ // finished - tidy up
			self.busy = false;
			return true;
		} else if (interp > 1){
			return update(1);
		} else {
			return false;
		}
	}

	d3.select(this.ticks).attr("opacity", 0);
    this.setScaleGroup();
    d3.select(this.ticks).transition().attr("opacity", 1)
		.delay(Protein.transitionTime * 0.8).duration(Protein.transitionTime / 2);
};

Protein.prototype.getAggregateSelfLinkPath = function() {
	var intraR = this.getBlobRadius() + 7;
	var sectorSize = 45;
	var arcStart = Protein.trig(intraR, 25 + sectorSize);
	var arcEnd = Protein.trig(intraR, -25 + sectorSize);
	var cp1 = Protein.trig(intraR, 40 + sectorSize);
	var cp2 = Protein.trig(intraR, -40 + sectorSize);
	return 'M 0,0 '
		+ 'Q ' + cp1.x + ',' + -cp1.y + ' ' + arcStart.x + ',' + -arcStart.y
		+ ' A ' + intraR + ' ' + intraR + ' 0 0 1 ' + arcEnd.x + ',' + -arcEnd.y
		+ ' Q ' + cp2.x + ',' + -cp2.y + ' 0,0';
}

Protein.prototype.getResidueLinkPath = function(residueLink) {
	var x1 = this.getResXwithStickZoom(residueLink.fromResidue);
	var baseLine = 0;
	if (Protein.UNITS_PER_RESIDUE * this.stickZoom >= 8){
		baseLine = -5;
	}
	if (isNaN(parseFloat(residueLink.toResidue))){ //linker modified peptide
		if (residueLink.ambig === false){
			residueLink.line.setAttribute("fill", xiNET.defaultSelfLinkColour.toRGB());
		}
		var p1 = [x1, 26];
		var p3 = [x1, 18];
		var p2 = Protein.rotatePointAboutPoint(p1, p3, 60);
		baseLine = baseLine * -1;
		return "M " + x1 + "," + baseLine
			+ " L " + p1[0] + "," + p1[1]
			+ " L " +  p2[0] + "," + p2[1]
			+ " L " + p3[0] + "," + p3[1];
	}
	else {
		var x2 = this.getResXwithStickZoom(residueLink.toResidue);
		var height, cp1, cp2, arcStart, arcEnd, arcRadius;
		arcRadius = (Math.abs(x2 - x1)) / 2;
		var height = -((Protein.STICKHEIGHT / 2) + 3);
		if (arcRadius < 15){
			height = -28 + arcRadius;
		}

		var start = [x1, baseLine];
		var end = [x2, baseLine];

		var angle;
		if (residueLink.intraMolecular === true){

			var curveMidX = x1 + ((x2 - x1) / 2);
			arcStart = [ curveMidX, height - arcRadius];
			arcEnd =  [ curveMidX, height - arcRadius];
			cp1 = [ curveMidX, height - arcRadius];
			cp2 =  [ curveMidX, height - arcRadius];
			//flip
			//~ start[1] = start[1] * -1;
			//~ cp1[1] = cp1[1] * -1;
			//~ arcStart[1] = arcStart[1] * -1;
			//~ arcEnd[1] = arcEnd[1] * -1;
			//~ cp2[1] = cp2[1] * -1;
			//~ end[1] = end[1] * -1;
		}
		else if (residueLink.hd){
			var curveMidX = x1 + ((x2 - x1) / 2);
			arcStart = [curveMidX, height - arcRadius];
			arcEnd = [curveMidX, height - arcRadius];
			cp1 = Protein.rotatePointAboutPoint([x1, height - arcRadius], start, -20);
			cp2 = Protein.rotatePointAboutPoint([x2, height - arcRadius], end, 20);
		}
		else {
			cp1 = [x1, height];
			cp2 = [x2, baseLine];
			arcStart = [x1, height];
			arcEnd =  [x2, height];
		}

		return " M " + start[0] + "," + start[1]
			+ " Q "  + cp1[0] + ',' + cp1[1] + ' ' + arcStart[0] + "," + arcStart[1]
			+ " A " + arcRadius + "," + arcRadius + "  0 0 1 " + arcEnd[0]  + "," + arcEnd[1]
			+ " Q "+ cp2[0] + ',' + cp2[1] +  " "  + end[0] + "," + end[1];
	}
}

Protein.prototype.showPeptides = function(pepBounds) {
	if (this.form=== 1){
		var y = -Protein.STICKHEIGHT / 2;

        var count = pepBounds.length;
        var yIncrement = Protein.STICKHEIGHT / count;
        for (var i = 0; i < count; i++) {
            var pep = pepBounds[i];

            var annotColouredRect = document.createElementNS(xiNET.svgns, "rect");
            annotColouredRect.setAttribute("class", "protein");

            //make domain rect's
            var annoSize = pep[1];
            if (annoSize > 0){
				var annotX = ((pep[0] + 0.5) - (this.size/2)) * Protein.UNITS_PER_RESIDUE;//this.getResXUnzoomed(pep[0] + 0.5);
				var annoLength = annoSize * Protein.UNITS_PER_RESIDUE;
				annotColouredRect.setAttribute("x", annotX);
				annotColouredRect.setAttribute("y", y);
				annotColouredRect.setAttribute("width", annoLength);
				annotColouredRect.setAttribute("height", yIncrement);
				//style 'em
				annotColouredRect.setAttribute("fill", xiNET.highlightColour.toRGB());
				//annotColouredRect.setAttribute("fill-opacity", "0.7");
				this.peptides.appendChild(annotColouredRect);
			}

			if (pep[2]){//homodimer like
				//TODO: eliminate duplication
				annotColouredRect = document.createElementNS(xiNET.svgns, "rect");
				annotColouredRect.setAttribute("class", "protein");
				var annotX = ((pep[2] + 0.5) - (this.size/2)) * Protein.UNITS_PER_RESIDUE;//this.getResXUnzoomed(pep[0] + 0.5);
				var annoLength = (pep[3] - pep[2]) * Protein.UNITS_PER_RESIDUE;
				annotColouredRect.setAttribute("x", annotX);
				annotColouredRect.setAttribute("y", y);
				annotColouredRect.setAttribute("width", annoLength);
				annotColouredRect.setAttribute("height", yIncrement);

				//style 'em
				annotColouredRect.setAttribute("fill", xiNET.homodimerLinkColour.toRGB());
				annotColouredRect.setAttribute("fill-opacity", "0.5");

				this.peptides.appendChild(annotColouredRect);
			}
            y += yIncrement;
        }
   }
}

Protein.prototype.removePeptides = function() {
	this.controller.emptyElement(this.peptides);
}

Protein.prototype.getResXwithStickZoom = function(r) {
    return (r - (this.size/2)) * Protein.UNITS_PER_RESIDUE * this.stickZoom;
 };

Protein.rotatePointAboutPoint = function(p, o, theta) {
	theta = (theta / 360) * Math.PI * 2;
	var rx = Math.cos(theta) * (p[0]-o[0]) - Math.sin(theta) * (p[1]-o[1]) + o[0];
	var ry = Math.sin(theta) * (p[0]-o[0]) + Math.cos(theta) * (p[1]-o[1]) + o[1];
	return [rx, ry];
}

Protein.prototype.checkLinks = function() {
    var links = this.proteinLinks.values();
    var c = links.length;
    for (var l = 0; l < c; l++) {
        links[l].check();
    }
}

// update all lines (e.g after a move)
Protein.prototype.setAllLineCoordinates = function() {
    var links = this.proteinLinks.values();
    var c = links.length;
    for (var l = 0; l < c; l++) {
        var link = links[l];
        if (link.getToProtein() !== null &&
			link.getFromProtein().form === 0 && link.getToProtein().form === 0) {
             link.setLineCoordinates(this);
        }
        else {
            var resLinks = link.residueLinks.values();
            var resLinkCount = resLinks.length;
            for (var rl = 0; rl < resLinkCount; rl++) {
                var residueLink = resLinks[rl];
                residueLink.setLineCoordinates(this);
                var otherEnd = residueLink.proteinLink.getOtherEnd(this);
                if (otherEnd && otherEnd.form === 1	&& otherEnd.stickZoom * Protein.UNITS_PER_RESIDUE > 8){
					residueLink.setLineCoordinates(otherEnd);
				}
            }
        }
    }
};

Protein.prototype.countExternalLinks = function() {
    if (this.isParked) {
        return 0;
    }
    var countExternal = 0;
    var c = this.proteinLinks.keys().length;
    for (var l = 0; l < c; l++) {
        var link = this.proteinLinks.values()[l];
        if (!link.intra)
        {
            if (link.check() === true) {
                countExternal++;
            }
        }
    }
    return countExternal;
};

Protein.prototype.getSubgraph = function(subgraphs) {
   if (this.subgraph == null) { // don't check for undefined here
        var subgraph = {
            nodes: d3.map(),
            links: d3.map()
        };
        subgraph.nodes.set(this.id, this);
        if (this.isParked === false) {
            this.subgraph = this.addConnectedNodes(subgraph);
        }
        this.controller.subgraphs.push(subgraph);
    }
    return this.subgraph;
};

Protein.prototype.addConnectedNodes = function(subgraph) {
    var links = this.proteinLinks.values();
    var c = links.length;
    for (var l = 0; l < c; l++) {
		var link = links[l];
		//visible, non-self links only
        if (link.fromProtein !== link.toProtein && link.check() === true) {
            if (!subgraph.links.has(link.id)) {
                subgraph.links.set(link.id, link);
                var otherEnd;
                if (link.getFromProtein() === this) {
                    otherEnd = link.getToProtein();
                }
                else {
                    otherEnd = link.getFromProtein();
                }
                if (otherEnd !== null) {
					if (!subgraph.nodes.has(otherEnd.id)) {
						subgraph.nodes.set(otherEnd.id, otherEnd);
						otherEnd.subgraph = subgraph;
						otherEnd.addConnectedNodes(subgraph);
					}
				}
            }
        }
    }
    return subgraph;
};

Protein.prototype.setPositionalFeatures = function(posFeats) {
    //clear everything
    this.annotations = [];
    if (this.circDomains) this.controller.emptyElement(this.circDomains);
    if (this.rectDomains) this.controller.emptyElement(this.rectDomains);
    //create new annotations
    if (posFeats) {
        //draw longest regions first
        posFeats.sort(function(a, b) {
            return (b.end - b.start) - (a.end - a.start);
        });
        this.annotations = posFeats;
        for (var i = 0; i < posFeats.length; i++) {
            var anno = posFeats[i];
            anno.start = anno.start - 0;
            anno.end = anno.end - 0;
            anno.pieSlice = document.createElementNS(xiNET.svgns, "path");
            anno.colouredRect = document.createElementNS(xiNET.svgns, "path");
            if (this.form === 0) {
				anno.pieSlice.setAttribute("d", this.getAnnotationPieSliceArcPath(anno));
				anno.colouredRect.setAttribute("d", this.getAnnotationPieSliceApproximatePath(anno));
			} else {
				anno.pieSlice.setAttribute("d", this.getAnnotationRectPath(anno));
				anno.colouredRect.setAttribute("d", this.getAnnotationRectPath(anno));
			}

            var c;
            //temp
            if (anno.colour == null) { // check == here
                if (anno.name === 'alpha_helix') {
                    c = new RGBColor('#7EB6FF88');
                }
                else if (anno.name === 'beta_strand') {
                    c = new RGBColor('#9AFF9A88');
                }
                else if (anno.name === 'turn') {
                    c = new RGBColor('#FF00AA88');
                }
                else {
                    c = new RGBColor(Protein.domainColours(anno.name));
                }
                anno.colour = c;
            }
            else {
                c = anno.colour;
            }
            anno.pieSlice.setAttribute("fill", c.toRGB());
            anno.pieSlice.setAttribute("stroke", c.toRGB());
            anno.pieSlice.setAttribute("stroke-width", 1);
            anno.pieSlice.setAttribute("fill-opacity", "0.5");
            anno.colouredRect.setAttribute("fill", c.toRGB());
            anno.colouredRect.setAttribute("stroke", c.toRGB());
            anno.colouredRect.setAttribute("stroke-width", 1);
            anno.colouredRect.setAttribute("fill-opacity", "0.5");

            var text = anno.name + " [" + anno.start + " - " + anno.end + "]";
            anno.pieSlice.name = text;
            var xlv = this.controller;
            var self = this;
            anno.pieSlice.onmouseover = function(evt) {
                var el = (evt.target.correspondingUseElement) ? evt.target.correspondingUseElement : evt.target;
                xlv.preventDefaultsAndStopPropagation(evt);
                xlv.setTooltip(el.name, el.getAttribute('fill'));
                self.showHighlight(true);
            };
            anno.colouredRect.onmouseover = function(evt) {
                var el = (evt.target.correspondingUseElement) ? evt.target.correspondingUseElement : evt.target;
                xlv.preventDefaultsAndStopPropagation(evt);
                xlv.setTooltip(el.name, el.getAttribute('fill'));
                self.showHighlight(true);
            };
            this.circDomains.appendChild(anno.pieSlice);
            this.rectDomains.appendChild(anno.colouredRect);
        }
    }
};

//TODO: remove this, use rotateAboutPoint instead
Protein.trig = function(radius, angleDegrees) {
		//x = rx + radius * cos(theta) and y = ry + radius * sin(theta)
		var radians = (angleDegrees / 360) * Math.PI * 2;
		return {
			x: (radius * Math.cos(radians)),
			y: (radius * Math.sin(radians))
		};
};
Protein.stepsInArc = 5;

Protein.prototype.getAnnotationPieSliceArcPath = function(annotation) {
	var startAngle = ((annotation.start - 1) / this.size) * 360;
	var endAngle = ((annotation.end) / this.size) * 360;

	/*var radius = this.getBlobRadius() - 2;
	var arcStart = Protein.trig(radius, startAngle - 90);
	var arcEnd = Protein.trig(radius, endAngle - 90);
	var largeArch = 0;
    if ((endAngle - startAngle) > 180 || (endAngle == startAngle)) {
		largeArch = 1;
	}
	//hacky
	if (annotation.start == 1 && annotation.end == this.participant.size) {
        startAngle  = 0.5;
        endAngle = 359.5;
        sweepFlag = 1;
    }
	return "M0,0 L" + arcStart.x + "," + arcStart.y + " A" + radius + ","
		+ radius + " 0 " + largeArch + " 1 " + arcEnd.x + "," + arcEnd.y + " Z";
	*/

	var largeArcFlag = 0, sweepFlag = 1;
    if ((endAngle - startAngle) > 180) {
        largeArcFlag = 1;
        sweepFlag = 1;
    }
	//hacky
	if (annotation.start == 1 && annotation.end == this.size) {
        startAngle  = 0.5;
        endAngle = 359.5;
        sweepFlag = 1;
    }

    var radius = this.getBlobRadius() - 2;
    var arcStart = Protein.trig(radius, startAngle - 90);
    var arcEnd = Protein.trig(radius, endAngle - 90);
    return "M0,0 L" + arcStart.x + "," + arcStart.y + " A" + radius + ","
        + radius + " 0 " + largeArcFlag + " " + sweepFlag + " " + arcEnd.x + "," + arcEnd.y + " Z";
};

Protein.prototype.getAnnotationPieSliceApproximatePath = function(annotation) {
	//approximate pie slice
	var startAngle = ((annotation.start - 1) / this.size) * 360;
	var endAngle = ((annotation.end) / this.size) * 360;
	var pieRadius = this.getBlobRadius() - 2;
	var arcStart = Protein.trig(pieRadius, startAngle - 90);
	var arcEnd = Protein.trig(pieRadius, endAngle - 90);
	var approximatePiePath = "M 0,0";
	var stepsInArc = 5;
	for (var sia = 0; sia <= Protein.stepsInArc; sia++) {
		var angle = startAngle + ((endAngle - startAngle) * (sia / stepsInArc));
		var siaCoord = Protein.trig(pieRadius, angle - 90);
		approximatePiePath += " L " + siaCoord.x + "," + siaCoord.y;
	}
	approximatePiePath += " L " + 0 + "," + 0;
	approximatePiePath += "  Z";
	return approximatePiePath;
};

Protein.prototype.getAnnotationRectPath = function(annotation) {
	//domain as rectangular path
	var bottom = Protein.STICKHEIGHT / 2, top = -Protein.STICKHEIGHT / 2;
	var annotX = this.getResXwithStickZoom(annotation.start - 0.5);
	var annotSize = (1 + (annotation.end - annotation.start));
	var annotLength = annotSize * Protein.UNITS_PER_RESIDUE * this.stickZoom;
	var rectPath = "M " + annotX + "," + bottom;
	for (var sia = 0; sia <= Protein.stepsInArc; sia++) {
		var step = annotX + (annotLength * (sia / Protein.stepsInArc));
		rectPath += " L " + step + "," + top;
	}
	rectPath +=  " L " + (annotX  + annotLength)+ "," + bottom
		+ " Z";
	return rectPath;
};


The winners of the Toy Fair Best New Toy Awards were announced for the seventh year this morning at the annual Toy Fair, predicting some of the top new toys for 2015. Winners range from household names such as Hasbro with their Nerf Rebelle Arrow Revolution Bow and LEGO with their Disney Frozen: Elsa's Sparkling Ice Castle to impressive new tech toys such as the Quadcopter "Rayvore" from Revell or the I-Que Intelligent Robot from Vivid.
The twelve categories, which produced 36 winning toys, from 26 different toy companies – were unveiled this morning by the London Toy Fair organisers, the British Toy & Hobby Association. The Toy Fair Best New Toy Awards are voted for by a panel of independent toy retailers as the 2015 Toy Fair products with the most potential to make a mark on retail throughout the year and beyond.


text:
Whitford sentenced to eight years for death of 16-month-old
Dec 2, 2020 3:15 PM By: Janice Huser
Veronica Poitras sustained serious head and neck injuries prior to her death in August of 2017. File photo.
LAKELAND - After being found guilty of manslaughter in the death of 16-month-old Veronica Poitras in November of 2019, Sherman Whitford was sentenced to eight years in prison on Dec. 1.
As part of his sentencing, he was given four-and-a-half years credit for time served - resulting in three-and-a-half years left to serve.
Whitford went before a judge on Dec. 1 during a sentencing that occurred at the St. Paul Courthouse, and through video and online means. Whitford was seen in custody at the Edmonton Remand Centre via CCTV.
Life cut short
On Aug. 26, 2017, 16-month-old Veronica was brought to the Cold Lake hospital by her mother, where the toddler was found to have sustained serious neck and head injuries. She died two days later in an Edmonton hospital.
Her death was ruled a homicide on Sept. 8, 2017. Whitford, her mother's boyfriend at the time, was charged in October of 2017.
Sentencing delayed
An August 2020 court date was held this summer, and at that time the Crown and defence could not agree on a time in custody issue. That issue has since been resolved, with both sides agreeing to one-and-a-half times credit for the time spent in custody up until March 15, 2020, and two-and-a-half times enhanced credit for time spent in custody after March 16. The total credit would equal about 4.4 years, heard the court on Tuesday. That number was then rounded up to four-and-a-half years.
During the sentencing, it was noted that Whitford has spend most of his time in custody in segregation, for his own protection, and was currently in quarantine due to a number of cases of COVID-19 at the remand centre. It was also noted that Whitford's safety risk increased following him being found guilty of manslaughter, and there also exists a personal health risk due to the fact that Whitford is diabetic.
In its final submission, the Crown asked for eight to 12 years as a sentence, which is on the high end of what has been seen in similar cases.
The defence argued that the incident that resulted in the death of Veronica was "a spontaneous matter," according to defence lawyer Tim Dunlap. Whitford had no history of abuse toward children previous to the incident. He requested a shorter sentence, ranging from three-and-a-half to five-and-a-half years.
Court of Queen's Bench Justice Stephen Hillier asked Whitford if he would like to say anything to the court before the judge took time to deliberate.
Whitford did speak, and offered a brief apology.
"I'm sorry to everyone who has been hurt," said Whitford. He acknowledged that the ongoing court matters have been hard on everyone, and haven't allowed the opportunity for closure.
When Hillier returned to court, he spoke at length about his decision. He noted that it simply is not enough to say "we're sorry" and that there's an enduring responsibility for everyone to ensure the welfare of those who are vulnerable. He noted that there was a failed commitment to protect and nourish Veronica.
He noted that the death of Veronica has had an impact on the greater community, and not just those directly involved.
After using a number of other cases to compare, Hillier noted that abuse against children must have a proportionate sentence, and said the behaviour simply cannot be tolerated and must be denounced.
While the factors of a Gladue Report were acknowledged and are important, Hillier said they cannot be stacked to reduce the range of a proper sentence. Whitford is from the Whitefish (Goodfish) Lake First Nation #128.
Hillier reiterated that due to the force inflicted on the child, there was nothing to suggest this was an unfortunate accident.
Whitford is also subject to providing a mandatory DNA sample, and a mandatory weapons prohibition order.
More Beyond Local
Emaciated, injured cougar killed in Banff National Park
Oil and gas industry forecasts small spending rise after slashed budgets in 2020
Environmental group concerned about native grasslands in southern Alberta
About the Author: Janice Huser
Janice Huser has been with the St. Paul Journal since 2006. She is a graduate of the SAIT print media journalism program, is originally from St. Paul and has a passion for photography.

redpajama_set_name: RedPajamaCommonCrawl


Man Cave Couch - Sink Cupboard Unit. log decorating ideas. small armless sectional sofa. in home mini bar.
Published at Thursday, March 07th 2019, 17:38:50 PM by Aleda Lange. bamboo. Your furniture is an immense investment! It, in general, cost a lot. Rustic bedroom furniture provides the bedroom an easy, provincial appearance. The particular girls white bedroom furniture is made by different businesses to entice the girls and ladies from several age groups.
Published at Friday, March 22nd 2019, 05:47:14 AM. bamboo By Amhold Keller. A bedroom is believed to be the most reposeful place in the house. Bedrooms are a few of the coziest places in a home. Vintage-themed bedrooms, for instance, can be feminine yet ladylike due to its ageless appeal. A big and open spacious bedroom has to be something you have to have dreamed about all your life.
Published at Friday, March 22nd 2019, 05:47:14 AM. bamboo By Aurick Koch. When you purchase furniture from a buy now pay later catalog, you may use the buy and payment to increase your credit score or help clean up your credit score. Needless to say, the manner in which you arrange your furniture can signify the difference not only in a fantastic nights sleep, but additionally in the functionality and fashion of your room. Keep in mind, in regards to bedroom furniture, you need to make certain you avoid clutter. When it has to do with buying bedroom furniture, take a valuation of what you have and exactly what you want. Contemporary bedroom furniture adds a lovely appearance to bedrooms.
Published at Friday, March 22nd 2019, 05:47:14 AM. bamboo By Aleda Lange. There are a number of ways you can readily and quickly change your bedroom so as to make it feel more harmonious and soothing. Lastly, bear in mind this bedroom is for your children, yet don't loose sight of the simple fact this bedroom is still in your house! A white bedroom doesn't need to feel blah. A lot of people would rather buy a new bedroom set every couple of years for $1000 and have the newest trend in their home than to buy a good set for $8000 that has an identical appearance but will endure for many, many years.
Published at Friday, March 22nd 2019, 05:47:14 AM. bamboo By Alhsom Schröder. Generally, a vanity set includes a vanity table, a stool or bench, and a mirror, or more than 1 mirror for greater visibility. Vanity sets may also include a matching stool or bench along with the major bit of furniture, which can help keep the fashion of your furniture set cohesive. After you have decided that you're trying for the new bedroom vanity sets or the easy bedroom vanity, it is the right time to determine which style and material is most appropriate for you.
Published at Friday, March 22nd 2019, 05:47:13 AM. bamboo By Adolph Weber. Beds can be found in numerous sizes. The bed is basically the centerpiece of a bedroom and inarguably the main furniture inside the room. Consider how much storage space you obtain if you are purchasing a king size bed. You simply can't get a huge king size bed with an enormous headboard and make it the focus of the bedroom. Owning king size platform beds can supply the ideal visualization and look that you may want in a bedroom.
Published at Friday, March 22nd 2019, 05:47:12 AM. bamboo By Adeline Fischer. It is possible to pick bed with modern decor with golden material, that is likely to make the ideal luxury type of kingdom theme. Developing a loft bed may be a rewarding weekend project for the do-it-yourself folks, or merely a terrific space saving solution for people who prefer to obtain pre-built models. Loft beds for adults be an amazing space saving solution for those residing in smaller homes. They can be an excellent way to create a bedroom if you are living in a studio-style home without a distinct bedroom. Many loft beds include bed options larger than twin-sized, which means you don't need to rule out loft beds simply because you've got a considerable other. Total size loft beds are the simplest to find, even though there are some queen size loft beds.
Published at Friday, March 22nd 2019, 05:47:12 AM. bamboo By Aurik Dietrich. A vanity set generally contains a table, a mirror, and a stool or bench. Vanities are going to have distinctive glow for your bedroom. If you really need to go all out then you may come across antique vanities which were handcrafted and styled by means of an individual rather than grabbing something that came off of a manufacturing line. It's even feasible to discover antique style vanities that has to be assembled at home. Some contemporary vanities are parts of cabinets to be able to conserve space. The ideal modern vanity set with a little contemporary accent is beautiful case of contemporary living style.


text:
<?php

declare(strict_types=1);

namespace Inowas\Common\Soilmodel;

class HBottom
{
    private $heightInMillimeters;

    public static function fromMeters(float $height)
    {
        $self = new self();
        $self->heightInMillimeters = intval($height*1000);
        return $self;
    }

    public function toMeters(): float
    {
        return floatval($this->heightInMillimeters/1000);
    }
}

redpajama_set_name: RedPajamaGithub


The Pottery Avenue RED BACOPA Plate will be one your favorite and you will reach for this plate daily, and what a great way to brighten your day with a beautifully hand painted "BOLESLAWIECE" Polish Stoneware Plate.
The Pottery Avenue RED BACOPA Plate will be one your favorite and you will reach for this plate daily, and what a great way to brighten your day with a beautifully hand painted "BOLESLAWIECE" Polish Stoneware Plate. Polish Pottery is oven, microwave, freezer, dishwasher safe. Pattern are created by skilled artisans of Zaklady Ceramiczne Boleslawiec, the original Polish Stoneware factory known for having the top quality and exceeding the California Prop 65 test for food safety.
A national treasure, Boleslawiec ceramics have been manufactured for centuries. Developed from natural ceramic clay that can be found near Boleslawiec at the Bobr and Kwisa rivers. According to historical sources, the first stoneware was made in medieval times and in the early 16th century, local potters formed guilds to ensure perfection. Zaklady Ceramiczne "BOLESLAWIEC" was founded by one of the original men with the first pattern dating back to 1759. "RED BACOPA Lunch-Salad Plate" is a UNIKAT pattern based of the 300 year old pattern "EYE OF THE PEACOCK". Designed by top designer and imported by Pottery Avenue, the premier importer of Polish Pottery & Polish Stoneware.


text:
Another Eastern Samar town dispatches its RCSP teams to conflict-stricken barangays
BORONGAN CITY, July 14 - (PIA) – The local government unit of Maydolong has dispatched its Retooled Community Support Program (RCSP) also known as peace and development teams to the distant barangays Canloterio and Patag.
This is according to Mayor Godofredo Garado of Maydolong town in a phone interview, Monday.
The deployment of the team is in compliance with the Executive Order Number 70 or under the National Task Force–End Local Communist Armed Conflict (NTF-ELCAC).
Garado said the 78th (Warrior) Battalion under Lt. Col. Oliver C. Alvior with the officials of the LGU sent-off the team early this July.
The RCSP team will immerse in the community for some time to identify the development gaps and the needed government intervention in the hard-to-reach areas in the country.
In the development planning, the team from the LGU and the uniformed men, the locals especially the barangay leaders will be consulted and their opinions and comments considered for the government to genuinely address the development gaps, Garado said.
These areas are economically challenged being distant, said Garado.
"The main products of the barangays are root crops and coconuts," Garado said.
Brgy. Canloterio and Patag are located along the Suribao River, across the conflict-stricken barangays of the city of Borongan.
Said barangays are considered "rebel highways" (or aragian) and reportedly frequented by armed men believed to be rebels.
Alvior said that when the government becomes successful in cascading development to the barangays, the locals will have no more reason to entertain the communists.
The activity, said Alvior shows the "shared commitment of the stakeholders in addressing the long standing security, social and economic problems in the communities."
"The RCSP team serves as the convergence mechanism of the NTF-ELCAC," the commander of the 78th IB said.
The LGU and army officials are confident that the unresolved issues will be addressed once the RCSP team reaches its implementing phase. (nbq with reports from the 78th IB)


text:
Prayer Resources for Vocations to Priesthood
As we begin a new year, let's keep Vocations to Priesthood especially in our prayers. God continues to call all who are baptised to follow Him and He calls some to follow through the ministry of Priesthood. Let us "pray therefore the Lord of the harvest to send out labourers into his harvest." (Mt 9:38) The following link will bring you the parish resources for the period from next Sunday (The Baptism of the Lord) up to the Sixth Sunday in Ordinary Time. These comprise sample intercessory prayers and also some inserts which you might consider using in your parish newsletter or social media now or at some other time throughout the year. The link is:
https://vocations.ie/2021/01/04/parish-resources-jan-10th-to-feb-14th-2021/ If you know of someone interested in finding out more about the a vocation to priesthood within the Archdiocese of Dublin you can direct them to our website: dublindiocese/vocations
or please invite them to email the vocations director Fr. Enda Cunningham at: vocations@dublindiocese.ie or Fr. Séamus McEntee at: seamusmcentee@yahoo.com
"The pandemic has shown that people still need and value their priests"
Fr Tomás Surlis
(The Irish Catholic, October 8th 2020)
The vocations crisis is rooted in a social, cultural and ecclesial landscape that has changed radically in the last 20 years, writes Fr Tomás Surlis
The return to seminary this year was particularly challenging, given the current pandemic. However, we approached the challenge with vigour, since the experience of a common life is central to the experience of priestly formation in Ireland and across the world today. Living with and for each other helps our seminarians to develop the necessary skills they will need in priestly ministry going forward. In the seminary, the way we live is designed to prepare future priests for the reality of ministry in a changed and changing society and culture. Skills such as being a generous person for others, being a builder of communion and community, being a team leader and a person who collaborates with lay women and men at parish and diocesan level, as together the people of God exercises its co-responsibility for the life of the Church in our times, such as those called for by the Congregation for the Clergy in its recent instruction on The Pastoral Conversion of the Parish Community in the service of the evangelising mission of the Church (2020). Such attitudes of heart and mind are especially important in an ecclesial landscape that cries out for priests filled with zeal for both ministry and mission.
In 2019, the National Seminary welcomed thirteen (13) new seminarians. Eight (8) of these came into the first year of the Discipleship Stage of Philosophical Studies and five (5) entered what is known as the Configuration Stage of Theological Studies. This brought the number of full-time resident seminarians in St Patrick's College, Maynooth to thirty-three (33), up from twenty-two (22) in 2018-19. Of the thirty-three (33), twenty-seven (27) were in formation for Irish dioceses, with a further two being sponsored by an Irish diocese with a view to ministering in that diocese for some time after ordination, before returning to their home diocese. The remaining three were in formation for a diocese outside of Ireland.
In 2020, in keeping with HSE and Bishops' Conference guidelines on social distancing and sanitisation, we made ready to welcome thirty-two (32) resident seminarians. This number includes eight (8) new seminarians. Five (5) of the new seminarians entered the Discipleship Stage of Philosophical Studies, with two (2) of these undertaking a degree in Arts (including Philosophy) in Maynooth University. The other three (3) entered the Diploma Programme in Philosophy and Arts in the Pontifical University. Three (3) seminarians joined us in the Configuration Stage of Theological Studies, having completed their studies in philosophy outside of Ireland. Of the thirty-two (32) resident seminarians in Maynooth at the start of this year, twenty-seven (27) were in formation for Irish dioceses.
There is no doubt that people are sometimes shocked when they hear that there are just around thirty men in formation for the priesthood in the National Seminary. People speak of a 'vocations crisis.' They are correct. There is a crisis of vocation in the Church in Ireland and across many parts of the Western World, particularly in Western Europe. This is rooted in a social, cultural and ecclesial landscape that has changed radically in the last twenty years. The current pandemic has exposed some of the real potential that exists for developing forms of collaborative ministry and co-responsibility in the life of the Church.
In the National Seminary, we are continuing to energetically implement the insights of the 2016 document on priestly formation called The Gift of the Priestly Vocation. Together with Saint John Paul II's seminal Apostolic Exhortation Pastores dabo vobis – I will give you shepherds (1992), this new document has guided the Irish seminaries in formulating a National Admissions Policy, which was approved as a working document by the Irish Bishops at their June 2020 meeting. The 2016 document has also helped a committee, of which I was a part, to put together a draft of a national Directory for Priestly Formation in Irish Seminaries which the bishops are currently considering before it is sent to the Holy See for the recognitio. This new Directory represents an update of the existing Programme for the Formation of Priests in Irish Seminaries (2006). This is indeed timely, as the landscape in which future Irish priests will minister has changed significantly, even since then.
When I entered the seminary in 1998, I came from a family background and experience of parish where the vast majority of people attended Sunday Mass. The support I received in my decision to leave a fulfilling job as a teacher in Coláiste Iognáid in Galway to enter formation for priesthood in the diocese of Achonry was strong and heartfelt, from family, from friends and from my students and colleagues in Galway. To be honest, I almost took such support for granted. If I were entering seminary today, I'm not sure if the same level of support would be there from outside my family circle. Many of the men entering the seminary today are coming either from third-level institutions or the world of work. Some still come from second-level education but they, and all the others who come into first year, have the experience of one year of seminary formation behind them, in what is called the Propaedeutic Stage, before they come to Maynooth. This is a good thing and a most welcome development. It means that the settling in process takes far less time and that they are already familiar with many of the aspects of seminary life which, in my first year, took quite some getting used to.
The promise of the Lord of the Harvest to send labourers into his harvest still holds true. The wonder is not that there are so few responding to the call; the wonder is that there are so many who are able to hear that call amidst the cacophony of voices that clamour for their attention in our busy and noisy world. I thank the bishops of Ireland for their continued expression of confidence in St Patrick's College, Maynooth by entrusting the formation of their seminarians to us. I would also like to pay tribute to the diocesan Vocations Directors who are doing sterling work in vocations promotion, together with the Vocations Council of the Bishops Conference and the National Vocations Office which is based on the St Patrick's College campus. I also pay tribute to the invaluable support (both prayerful and financial) that is given to seminarians by the St Joseph's Young Priests Society and those women and men who pray for vocations to the priesthood and religious life all across the country. In Maynooth, we focus on the providing the best experience and highest standard of priestly formation possible. Not to do so would be to do a disservice to the men who are here, as well as to the people of God, from whom they come and to whom they will return as servants of the Gospel. The coronavirus pandemic has shown that people still need and value their priests. We are doing our very best to provide them with the priests they need: men for others, theactairí Chríost (messengers of Christ), holy men for a holy people.
Fr Tomás Surlis is a priest of the diocese of Achonry and Rector of the National Seminary, St Patrick's College, Maynooth
Vocations Sunday 2020
This Sunday, 3 May, is Vocations or Good Shepherd Sunday, the dedicated annual day for Catholics around the world to offer special prayers to encourage vocations from families and parishes to the priesthood and to religious life.
In his message for Vocations Sunday Pope Francis says, "The first word of vocation, then, is gratitude. Taking the right course is not something we do on our own, nor does it depend solely on the road we choose to travel. How we find fulfilment in life is more than a decision we make as isolated individuals; above all else, it is a response to a call from on high. The Lord points out our destination on the opposite shore and he grants us the courage to board the boat. In calling us, he becomes our helmsman; he accompanies and guides us; he prevents us from running aground on the shoals of indecision and even enables us to walk on surging waters."
For the full message and a range of resources, please visit: Vocations Sunday Resources 2020
Prayer to Discover Your Vocation
You have made me to know you,
To love you, and to serve you,
And thereby to find and fulfil myself.
I know that you are in all things
And that every path can lead me to you,
But, of them all, there is one path especially
By which you want me to come to you.
Since I will do what you want of me,
I pray you; send your Holy Spirit to me;
Into my mind to show me what you want of me;
Into my heart to give me the determination to do it,
And to do it with all my love, with all my mind,
And with all my strength, right to the end.
A Prayer for Seminarians
Father, thank You for the generosity of our seminarians.
Safeguard them as they prepare for the priesthood.
Keep all evil far from them, so they may become strong Christian men who are faithful to prayer, diligent in their studies, open to spiritual direction, and docile to all aspects of seminary formation.
Above all, enflame their hearts with love so they will be ardent and gentle shepherds for Your Church.
We make this prayer through the great High Priest, Jesus Christ our Lord.
St. Charles Borromeo, patron of seminarians, pray for us.
A PRAYER FOR VOCATIONS TO THE PRIESTHOOD
by Fr. Bill O'Shaughnessy, Tallaght Deanery Group (February 2020)
Lord our God, you said that "the harvest is rich
but the laborers are Few.
Pray, therefore, the Lord of the harvest to send labourers into his fields."
Lord, we pray for your Spirit to send us holy priests.
To ignite the spark inside men to faithfully minister as priests in the Archdiocese of Dublin.
Fill them with zeal to come forward with a heart on fire with divine love, so they may become mirrors of Christ, your Son, in a world in need of His light, meaning, hope and courage.
Send to the Archdiocese of Dublin, strong and courageous spiritual shepherds, fearless in proclaiming the Resurrection of Christ anew for our time.
May these men of prayer be always open to the responsible call of service to your beloved people.
We ask this through Christ Our Lord – AMEN.
Vocations Prayer Flyer:
'The most important moment of my life" – Sixty years ago, 29 June 1951, Joseph Ratzinger was ordained a priest
2011-06-29 L'Osservatore Romano
In his essential and limpid autobiographical account published in 1997 – the original German is entitled Aus meinem Leben: Erinnerungen 1927-1977 (Milestones: Memoirs 1927-1977) – Joseph Ratzinger remembers with vivid simplicity his ordination to the priesthood. The great German Catholic Cardinal, Michael von Faulhaber (1869-1952), distinguished biblicist and patrologist, Archbishop of Munich and Freising from 1917, who during the dark years of the Third Reich had become one of the most courageous critics of Hitler's regime, laid his hands on the 24-year old deacon in June 1951 and on his older brother Georg and 42 other young men.
"We were more than forty candidates, who, at the solemn call on that radiant summer day, which I remember as the high point of my life, responded "Adsum", Here I am. We should not be superstitious; but, at that moment when the elderly archbishop laid his hands on me, a little bird—perhaps a lark—flew up from the high altar in the cathedral and trilled a little joyful song. And I could not but see in this a reassurance from on high, as if I heard the words "This is good, you are on the right way."
There then followed four summer weeks that were like an unending feast. On the day of our first Holy Mass, our parish church of Saint Oswald gleamed in all its splendor, and the joy that almost palpably filled the whole place drew everyone there into the most living mode of "active participation" in the sacred event, but this did not require any external busyness. We were invited to bring the first blessing into people's homes, and everywhere we were received even by total strangers with a warmth and affection I had not thought possible until that day.
In this way I learned firsthand how earnestly people wait for a priest, how much they long for the blessing that flows from the power of the sacrament. The point was not my own or my brother's person. What could we two young men represent all by ourselves to the many people we were now meeting? In us they saw persons who had been touched by Christ's mission and had been empowered to bring his nearness to men. Precisely because we ourselves were not the point, a friendly human relationship could develop very quickly."
A priest for sixty years, Joseph Ratzinger carries out daily, with humility and transparence, the work of making the one Lord of the world and of history present to women and men of our time. For this, the Osservatore Romano offers Benedict XVI its best wishes, sure that its sentiments are echoed not only by those in the Catholic Church but by many others throughout the world. And repeats for him the words of the ancient prayer for the Pope, invoking Christ's protection and the only happiness that counts: Dominus conservet eum, vivificet eum, beatum faciat eum in terra et non tradat eum in animam inimicorum eius.
Pope Emeritus Benedict XVI reflects on sixty years of priestly ministry
Pope Benedict XVI celebrated Mass marking the feast of Saints Peter and Paul, patron saints of the city of Rome. During the Eucharistic celebration, the Pope also conferred the Pallium on 41 new Metropolitan archbishops, from countries all over the world, who have been appointed over the past year.
Attending the Mass in St Peter's Basilica on Wednesday morning was a special delegation of three Orthodox leaders representing the Ecumenical Patriarch of Constantinople, Bartholomew I, part of a traditional exchange of ecumenical delegations which has helped to strengthen the bonds of friendship between the Churches of the East and West since shortly after the 2nd Vatican Council.
But the Mass also marked a personal moment of reflection for the Pope himself who was celebrating the 60th anniversary of his own ordination to the priesthood.
"Sixty years on from the day of my priestly ordination…
In his homily Pope Benedict said that sixty years on from his ordination, he can still hear the words that were addressed to the new young priests that day in 1951, the words of St John's Gospel, 'I no longer call you servants but friends.' Words, the Pope added, that bring great inner joy and can also be seen as the entire programme of a priestly life.
"Friendship is not just about knowing someone, it is above all a communion of the will..
Reflecting on the meaning of that friendship with Christ, the Pope said it is above all learning to grow in ever greater conformity with His will, to know Him better through the Scriptures, through prayer, through the communion of Saints. Jesus' words on friendship, he said, should be seen in the context of His commission to His followers to go and make disciples of all nations – a command which challenges us to move beyond the boundaries of our own world and to bring the Gospel to all people.
"On the feast of Saints Peter and Paul my most cordial greeting goes first of all to the Ecumenical Patriarch Bartholomew 1st …
After his intimate reflection on the meaning of his own priestly ministry, the Pope also greeted the Orthodox delegation present in the Basilica, as well as the new Metropolitan Archbishops who received the white, woollen Pallum, a symbol of service and a sign of a communion with St Peter and his successors. Pope Benedict concluded with heartfelt words of thanks to the Lord for the past six decades of his own service to the Church, as well as thanks to all the people who, he said, have formed and accompanied me.
Why Not Take Some Time to Pray Using Our Icon
In silence gaze upon the face of Christ
He is calling you by name
He wants your happiness
Listen for his voice.
One thing I ask of the LORD,
this is what I seek:
that I may dwell in the house of the LORD
all the days of my life,
to gaze upon the beauty of the LORD
and to seek him in his temple.
(Allow these words to find a home in your heart)
In the silence of this moment ask the Lord to reveal to you the depths of his love and give us his peace.
Seek His Face
A Prayer Initiative of the Vocations Office
One of Irelands leading Iconographers, Sr Aloysius McVeigh, a Mercy Sister, from Derry, has provided us with an appropriate icon as the focus of our prayer.
The icon depicts the face of Christ. Its title is 'Achieropoitos' (image not made by hands), and is based on the shroud of Turin. This image is very appropriate as it is Christ who is the one who calls us to our true vocation in life– the vocation of holiness.
The theme of the prayer endeavour is 'Seek his face'. This icon was blessed by his Holiness Pope Benedict in Rome over Easter and will travel around our diocese spending a week in parishes encouraging parish communities to pray for vocations.
Look to the LORD and his strength;
seek his face Always.
Allow these words to enter into your heart
Slowly Read the Following Passage:
The Calling of the First Disciples
As Jesus was walking beside the Sea of Galilee, he saw two brothers, Simon called Peter and his brother Andrew. They were casting a net into the lake, for they were fishermen. "Come, follow me," Jesus said, "and I will make you fishers of men."
At once they left their nets and followed him.
Matthew 4: 18-22
Where is the Lord Calling You?
You love me and you want me to be happy and at peace.
Reveal your face to me,
show me the path I must walk,
Give me wisdom to know where you are calling me and the courage I need today to answer that call
Help me to seek your face each and every day of my life so that my life can be spent in your service.


text:
Introducing Ronneby
The city, surrounded by forests, is regarded as the heart of the region known as "the garden of Sweden." Ronneby was first recognized as a city in the 14th century, but lost its privileges during many turbulent years only regaining city status in 1882. With its history and nature, this typical Scandinavian city is waiting to be discovered.
Ronneby is known for:
Wald Trekking Wellness
Karlshamn (30 km)
Karlskrona (29 km)
F, C
Ronneby airport information
You can reach Ronneby city center from the airport using the number 21 or 22 bus services. The distance between the airport and the city center is 8 km and the journey takes about 30 minutes.
If you don't want to waste time waiting for the bus service, you can get to the city center using the taxi service that runs from the airport. The average cost of a taxi from the airport to the city center is 180 Swedish kronor and the journey takes about 15–20 minutes.
Durchschnittlicher Taxipreis: 180 Swedish kronor


text:
Golden's nuggets: Brooklyn was a good choice for Kevin Durant
Cedric Golden @CedGolden
Jul 1, 2019 at 6:37 PM Jul 1, 2019 at 7:00 PM
Kevin Durant could have remained in Golden State and made more money, but he wanted to show he could win championships without the aid of Stephen Curry, Klay Thompson and Draymond Green.
That wasn't going to happen with the New York Knicks — who had a disaster of a free agency Sunday — but with Kyrie Irving joining him with the Brooklyn Nets, there's a nice chance to make big noise when he comes back for the 2021 season. But for now, the Nets might be a middle-of-the-pack crew this season.
Add to that, Kawhi Leonard might no longer be playing in the Eastern Conference, and that will make the conference even more winnable, assuming KD doesn't lose too much after coming back from Achilles surgery.
On a local level, Durant will be united with fellow Texas ex Jarrett Allen, assuming Allen isn't traded before his deal is up in 2021. The Nets have only four players signed through the next two seasons, including Allen, meaning plenty of moves will be made between now and then.
Durant, who turned down a five-year, $221 supermax deal from Golden State, gives the Nets immense credibility. This was a good move assuming Irving learns from mistakes that have put a dark cloud over his ability to be a locker room leader after tenures with Cleveland and Boston.
Summer of Sam: While Texas quarterback Sam Ehlinger is in the news this summer for being on the cover of Dave Campbell's Texas Football magazine and being mentioned as a Heisman Trophy possibility, odds are 20-1 that he will win it over preseason favorites Trevor Lawrence of Clemson, Alabama's Tua Tagovailoa and Oklahoma's Jalen Hurts, to name a few.
The Westlake product looked good during the pro day simulation workouts at last week's Elite 11 camp in Frisco. He served as a counselor to the high school kids at the camp, including 2020 UT pledge Hudson Card of Lake Travis.
So he's making headlines this summer for all the right reasons. Anyone who knows him understands he doesn't back down from a good scrap, but the fact that he didn't clap back at fellow Austinite Baker Mayfield, who professed dislike for him in a radio interview last week, speaks to his growing maturity. Surely Sam had something to say. He was just smart enough not to do it. Good for him because there is nothing to gain there.
Bobby Bonilla Day: Some of you younger readers do not know Bobby Bonilla, but you are about to become fans, or at least of his agent. Want to hear about the gift that keeps on giving? On Monday, Bonilla, a former MLB player, received his ninth installment payment of $1,193,248.20 from the New York Mets.
The organization owed him $5.9 million when they released him before the 2000 season, but instead of taking the lump sum payment, Bonilla negotiated deferred payments over 35 years in exchange for 8% interest, starting in 2011. That's pure genius because by the time he cashed his first payment, that $5.9 million had grown to a robust $29.8 million.
So every July 1 since then, Bonilla has received a fat check for more than a million dollars. Bonilla, a .279 career hitter who once played with Barry Bonds in Pittsburgh back when Barry was skinny and not hitting 73 homers in a season, just made more in one day than current Mets rookie star Pete Alonso, who will pocket $550,000 this season. Better yet, the Mets are on the hook for 16 more payments. Bonilla, who last played in 2001, will be 72 when he receives his last check.
Now that's a retirement plan we could all get behind.
Venus meets future of women's tennis: Fifteen-year-old Cori "Coco" Gauff says she would have never picked up a tennis racquet if not for the exploits of Serena and Venus Williams.
Gauff, the 2018 French Open girls champion turned Wimbledon qualifier, stunned Venus in straights in the first round Monday, sending the 39-year-old seven-time major champion to the showers while giving the tennis world a look at what could be a bright future for American tennis.
From afar, to watch the match was to watch old Venus playing against teenage Venus. The 5-foot-9 Gauff, sporting the braids made famous by the Williamses, had the goods. After taking a science test at 11 p.m. last week before a morning match the next day, she passed the first major test of her professional career. She tearfully thanked her idol for everything she had done for her.
"I would not be here if it had not been for her," Gauff told the BBC. "It was the first time I've cried after a match. Well, the first time after winning a match."
Nothing is guaranteed in a sport where the burnout rate is extremely high, but Gauff has the makings of a future champion. Here's hoping she will fulfill her vast potential.


text:
Q: How to read text from xsl and each text should place in each tag The source file contains

TEST

The output desired applying the XSLT to the input file:

T

E

S

T

Is it possible?

A: Well you can try recursion in XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <root>
    <xsl:call-template name="for-each-character">
      <xsl:with-param name="data" select="p/text()"/>
    </xsl:call-template>
    </root>
  </xsl:template>
  <xsl:template name="for-each-character">
    <xsl:param name="data"/>
    <xsl:if test="string-length($data) > 0">

        <xsl:value-of select="substring($data,1,1)"/>

      <xsl:call-template name="for-each-character">
        <xsl:with-param name="data" select="substring($data,2,string-length($data))"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>

Hope this helps.

redpajama_set_name: RedPajamaStackExchange


THE Virgin Labfest, a festival of new plays (untried, untested, unpublished and unstaged) by emerging and well-known playwrights, directors and actors will be held from June 29 to July 10, 2011 at the Cultural Center of the Philippines' Tanghalang Huseng Batute (Studio Theater) and Bulwagang Amado Hernandez (Conference Room). The event is a joint venture of CCP, Tanghalang Pilipino and the Writers' Bloc, Inc. in cooperation with the National Commission for Culture and the Arts.
Now on its seventh year, the Virgin Labfest has earned a solid reputation for its exciting and provocative line-up of one-act plays from playwrights both young and old. This year's plays include KINAUMAGAHAN by Rachelle Rodriguez and Wennielyn Fajilan, REQUIEM by Juan Ekis, KAFATIRAN by Dingdong Novenario, ISANG GABI BAGO MAGBUKAS ANG PORTRAIT OF AN ARTIST AS A FILIPINO NI NICK JOAQUIN the first featured full-length play by Carlo Pacolor Garcia, STREETLIGHT MANIFESTO by Mixkaela Villalon, KAWALA by Rae Red, EVENING AT THE OPERA by Floy Quintos, MGA LOBO TULAD NG BUWAN by Pat Valera; BAWAL TUMAWID, NAKAMAMATAY by Joey Paras, and THE VALLEY MISSION CARE by Russell Legaspi. Plays from the previous Virgin Labfest will also be restaged. They are HIGIT PA DITO by Allan Lopez, ONDOY by Remi Velasco, and BALUNBALUNAN, BINGIBINGIHAN by Debbie Ann Tan.
Directors tapped to handle the plays include Riki Benedicto, Juan Ekis, JK Anicoche, Paul Santiago, Ed Lacson Jr., Paolo O'Hara, Jomari Jose, Pat Valera, Joey Paras, Missy Maramara, Tuxqs Rutaquio, Issa Lopez, Dennis Marasigan, Jose Estrella and Allison Segarra. Likewise, there will be readings of plays, among them, CHIAROSCURO by Lito Casaje, HOUSE OF CANDLES by Nick Pichay and HERMANO PULI by Layeta Bucoy. Open-forum will be held after each performance. Fragments, site specific excerpts, shall be staged by the Sipat Lawin Ensemble featuring new plays by Krista Ann Taclan and Lito Casaje.
For further inquiries, please call the CCP Dramatic Arts Division at 832-1125 locals 1606 to 1607.


Minh-Hoang is a very organized and driven developer. His feedback and experience has been invaluable for Coinleap.
Hoang Nguyen is terrific. I will definitely hire him again.
Was a pleasure to work with Hoang. He was persistent and made sure a solution was found. I highly recommend this developer. Very professional, great communication.
FailED helps me manage my failures and now I believe that those failures will never happen again. In some ways, I can track my failures monthly, yearly and see how I made those mistakes. Appreciate Hoang Nguyen!
Hoang is the best freelancer that I could find. I am so privileged that I find him. He did a great job. He works fast and professional. My project was really upgrade by Hoang. I highly recommend to work with him.
Fantastic provider, really professional and helpful. Hard working and understanding developer who codes well and fast. He understands the problem will and works with you to resolve it. Really happy with him. Perfect communications, so happy that I already gave him another project without hesitation and he aced that too. Recommended without thinning about it twice.
Full cycle iOS Application Development: Refine features, Wireframe, Design, Development, Testing, Launch.
Free consulting mobile app business & startup idea.
Proactive communication, always touchable, guarantee 24-hour responding.
Dedicated working, actively in giving idea, solution and suggestion.
Experience in idea building, willing to spend time and effort on startup as a team player.
Open to share business mindset, opensource world and valuable information.
I am an independent and experience iOS Engineer with many high quality applications released during 5+ years working in Software Development. Having done more than 20 projects from vary range of domains, include these amazing apps YLNews, FailED, Golden, Coinleap, I strongly believe in developing your idea to next level. My full resume can be found at LinkedIn.
Cycling, playing guitar, reading startup book or browsing Kickstarter are those my hobbies when not coding.
Do you need a professional and dedicated iOS developer for your next project? I am here, FOR HIRE. I have built apps for both companies and my own business so that proven skills and quality. Not only coding, but also consulting and sharing business mind.
High responsibility, proactive, awareness of time, budget, quality and always keen on incredible ideas, I'm willing to take all talent to bring the world fantasy applications from your idea. Just drop me an email and start the next game changer.
Not just perfect product, also happy feeling.
Everytime you failed in a mission, maybe in an examination or you cannot date a cute girl, whatever, just take one minute to figure out the failure with FailED, then you will be better.
A complete but customizable NEWS app as framework. Get the framework guy, tell him where to pull your great content and build your app. All takes 30 minutes. Push it to AppStore, then start promoting it to your users. THROW OPPORTUNITY COST AND LET MAKE BREAKING NEWS BE AS SOON AS POSSIBLE.
Golden helps you to be truthful, caring, confident, and balanced.
When you speak openly and act honestly, love and care for others and stand up for yourself, refrain from recklessness and pursue what fulfills you, in these moments, you are Golden.
Introducing a multi-coin platform, support Bitcoin-Dogecoin- Litecoin, built with security first, packed with features and crazy powerful APIs! Technology digital currency deserves. It's a kind of full coin wallet. The iOS version is still in private testing duration. As one of employee in very early stage, I developed iOS version for Coinleap from scratch as one man builder.
Share Joy is a young startup from Israel, allows us to initiate and join social events that are happening in your area. These could be spontaneous events like street performances, pick up basketball games, or water fights, or planned events like lectures or concerts. As a consultant, I helped Yisrael improve iOS version, add more features, give my idea to make the app better at User Experience.
Type Of Day is a simple (but not simpler) weather application. As its description, "A new uplifting, light hearted, fun and informative headline based way of looking at the daily weather.", Shaheryar Malik - an awesome designer - wants to bring the super cool app with precious information and prediction about weather to his users. Since Shaheryar is a cool and handsome designer, my task is to focus on building the brilliant application with strong architect, all is to bring those weather degree to whom in need.


A joint master plan will lay out a new vision for the future of Philadelphia 30th Street Station.
PHILADELPHIA – Amtrak, Drexel University and Brandywine Realty Trust have selected Skidmore, Owings & Merrill LLP (SOM), in association with Parsons Brinckerhoff, OLIN, and HR&A Advisors to develop a comprehensive joint master plan for the area around Philadelphia's 30th Street Station.
The joint planning effort represents a unique opportunity to develop new plans and re-envision existing planning efforts to create a single, integrated vision for the 30th Street Station precinct. The SOM team will aim to develop a future where the station is at the epicenter of a dynamic, urban neighborhood full of opportunities for community development, economic development and improved transportation connections. A wide range of commercial opportunities, including a new vision for retail spaces within the station and the potential development of air rights above 75 acres of rail yards adjacent to the station, will also be considered.
Development of the master plan, which will begin in summer 2014, is expected to take approximately two years. Opportunities for public comment and involvement will be announced and advertised.


Stay tuned...Harrison Ford has realized that he is not that great of an actor and decided that in order to get some credit and return in the spotlight, Indiana Jones 4 is the way to go.
(Harrison Ford is probably still mad he didn't get a shot to try out for the part of Anikan Skywalker in the newest trilogy of Star Wars).
Actually, an article in the Seattle Times today talks about how Harrison Ford is "crusading" for Indiana Jones 4 to press along to come out in 2007.
And yes, Ford is to play Indiana Jones...no word yet on whether Sean Connery will play his dad...and the story takes place after WWII.
Maybe Ford could break out of the nursing home and travel with his grandson to go beat up some Iraqies.


I know it's pricey to buy & process a fleece, but I think if you want to find a way to move some of your fiber, you might want to dye & sell some on Etsy. Because the fiber is a light grey, the colors would end up being more like jewel-tones.
If you want to get rid of some of that cormo, you can ALWAYS send some to MEEEEE (not for free, I'll pay of course)! :) I've been wanting to try some of that out!
BTW, what is pin drafting?
I love the yarn, and the hats look great, and the cormo looks totally droolworthy. Is cormo nice to spin?
Enjoy that WEC! I'm stoked that someone can use it. Personally, though, I feel like I got the better end of the deal. Those batts are to die for!
Lovely! Congrats on reaching the goal. Thanks for the heads up about the t-shirts.