Skip to content

Commit

Permalink
3.1.0 copy
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Mar 11, 2019
1 parent 14f614a commit ca48251
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 92 deletions.
47 changes: 18 additions & 29 deletions Deps/Bindaas/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
FROM ubuntu:16.04
MAINTAINER Pradeeban Kathiravelu "[email protected]"
FROM alpine:3.8
LABEL maintainer="[email protected]"

### update and include Shadow to manage users and groups
RUN apk update
RUN apk --no-cache add wget
RUN apk --no-cache add shadow

# build with
# sudo docker build --rm=true -t="repo/imgname" .

### update
RUN apt-get -q update
RUN apt-get -q -y upgrade
RUN apt-get -q -y dist-upgrade
RUN apt-get install -q -y libcurl3

# Java
RUN mkdir /root/src
# Add group Bindaas and user Bindaas
RUN groupadd -g 9999 bindaas && \
useradd -r -u 9999 -g bindaas bindaas

WORKDIR /root/src

RUN apt-get install -y openjdk-8-jre
RUN apk --no-cache add openjdk8-jre
WORKDIR /root/bindaas/
RUN wget https://github.com/sharmalab/bindaas/releases/download/v3.3.5/bindaas-dist-3.3.5.tar.gz
RUN tar -xvf bindaas-dist-3.3.5.tar.gz && rm bindaas-dist-3.3.5.tar.gz
COPY bindaas.config.json /root/bindaas/bin/
COPY run.sh /root/bindaas/bin/

# Add java to path
ENV PATH /root/src/jre1.8.0_171/bin:$PATH

RUN chown -R bindaas:bindaas /root/

# Bindaas
RUN mkdir -p /root/bindaas

ADD https://github.com/sharmalab/bindaas/releases/download/v3.0.2/bindaas-dist-3.0.2.tar.gz /root/bindaas/

WORKDIR /root/bindaas
RUN ls
RUN mv bindaas-dist-3.0.2.tar.gz bindaas.tar.gz 2>&1; exit 0
RUN tar -xvf bindaas.tar.gz 2>&1; exit 0
RUN rm bindaas.tar.gz 2>&1; exit 0
WORKDIR /root/bindaas/bin

COPY bindaas.config.json /root/bindaas/bin/
USER bindaas

EXPOSE 9099
EXPOSE 8080
WORKDIR /root/bindaas/bin

COPY /run.sh /root/bindaas/bin/run.sh


CMD ["sh", "run.sh"]
5 changes: 3 additions & 2 deletions Deps/Bindaas/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
#nohup /usr/bin/mongod &

java -Dpid=BINDAAS_INSTANCE -Xmx1024m -jar org.eclipse.osgi_3.8.2.v20130124-134944.jar
java -jar -Dpid=BINDAAS_INSTANCE org.eclipse.osgi_3.10.100.v20150529-1857.jar

while true; do sleep 1000; done
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# caMicroscope Distribution

[![Build Status](https://travis-ci.org/camicroscope/Distro.svg?branch=master)](https://travis-ci.org/camicroscope/Distro)

caMicroscope 3.X distribution


Expand All @@ -15,7 +18,7 @@ To enable ssl, mount the private key and certificate files to elevate in /root/s
## Component Services
mongo - vanilla mongo container

idxMongo - ephemeral container to index mongo
idxMongo - ephemeral container to index mongo (that is, this container is *expected* to exit once it's done its job)

bindaas - api service for mongo (see https://github.com/sharmalab/bindaas)

Expand Down
8 changes: 4 additions & 4 deletions caMicroscope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ services:
- ./config/bindaas_projects/:/root/bindaas/bin/projects/
- ./config/bindaas.config.json:/root/bindaas/bin/bindaas.config.json
iip:
build: "https://github.com/camicroscope/iipImage.git#v3.0.0"
build: "https://github.com/camicroscope/iipImage.git#v3.1.0"
container_name: ca-iip
logging:
driver: none
volumes:
- ./images/:/images/
viewer:
build: "https://github.com/camicroscope/caMicroscope.git#v3.0.0"
build: "https://github.com/camicroscope/caMicroscope.git#v3.1.0"
container_name: ca-front
logging:
driver: none
loader:
build: "https://github.com/camicroscope/SlideLoader.git#v3.0.0"
build: "https://github.com/camicroscope/SlideLoader.git#v3.1.0"
container_name: ca-load
logging:
driver: none
volumes:
- ./images/:/images/
elevate:
build: "https://github.com/camicroscope/Security.git#v3.0.0"
build: "https://github.com/camicroscope/Security.git#v3.1.0"
container_name: ca-security
ports: ["4010:4010"]
volumes:
Expand Down
108 changes: 53 additions & 55 deletions migrate/convert_heatmaps.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,89 @@
//convert.js
//
var readline = require('readline');
const readline = require('readline');
const path = require('path')
const fs = require('fs');
const inputFolder = process.argv[2] || './input';
const outputFolder = process.argv[3] || './output';

const fileTemps = {};

let remainder = 0;
fs.readdirSync(inputFolder).forEach(fileName => {
//const filePath = `${fileName}`;
convert(fileName);
const ext = path.extname(`${inputFolder}/${fileName}`);
if(ext!=='.json') return;
fileTemps[fileName] = null;
convert(fileName)
});

let filename = process.argv[2] || "heatmap_TCGA-28-1751-01Z-00-DX1.low_res.json";

let tempObject;
function convert(filename){

function convert(filename) {
// read file
const myInterface = readline.createInterface({
input: fs.createReadStream(`${inputFolder}/${filename}`)
})
let lineno = 0;
let data = [];
let size = {};

let fields = [];
let ranges = [0, 1];
let ranges = [0,1];
// read file
const myInterface = readline.createInterface({
input: fs.createReadStream(`${inputFolder}/${filename}`)
});

remainder++;
myInterface.on('line', function(line) {

myInterface.on('line', function (line) {
const record = JSON.parse(line);
if (lineno == 1) {
tempObject = record;
if(record.properties.metric_value == 0)return;
++lineno;
if(lineno==1) {
fileTemps[filename] = record;
};

if (record.properties.metric_value == 0) return;
lineno++;
data.push([
record.bbox[0],
record.bbox[1],
...record.properties.multiheat_param.metric_array
]);
}).on('close', () => {
const content = generateDoc(data);
if (!fs.existsSync(outputFolder)) fs.mkdirSync(outputFolder);
fs.writeFile(`${outputFolder}/NEW_${filename}`, content, function(err) {
if (err) throw err;
remainder--;
console.log(`${filename} completed`);
if (remainder == 0) console.log('finished');
else console.log(`${remainder} Files remaining`);
//
});

record.bbox[0],
record.bbox[1],
...record.properties.multiheat_param.metric_array]);
}).on('close',()=>{
const content = generateDoc(data,filename);
if(!fs.existsSync(outputFolder)) fs.mkdirSync(outputFolder);
fs.writeFile(`${outputFolder}/NEW_${filename}`, content, function(err) {
console.log('close');
if (err) throw err;
remainder--;
console.log(`${filename} completed`);
if(remainder == 0) console.log('finished');
else console.log(`${remainder} Files remaining`);
});
});
}

function generateDoc(data) {
const [x, y, x1, y1] = tempObject.bbox;
const width = x1 - x;
const height = y1 - y;
const fields = tempObject.properties.multiheat_param.heatname_array.map(d => {
return {
name: d,
range: [0, 1]
}
});
return `{
"provenance":{
"image":{
"subject_id":"${tempObject.provenance.image.subject_id}",
"case_id":"${tempObject.provenance.image.case_id}",
"slide": "${tempObject.provenance.image.subject_id}",
"specimen": "",
function generateDoc(data,filename){
const [x,y,x1,y1] = fileTemps[filename].bbox;
const width = x1 - x;
const height = y1 - y;
const fields = fileTemps[filename].properties.multiheat_param.heatname_array.map(d =>{
return{
name:d,
range:[0,1]
}});
return `{
"provenance":{
"image":{
"subject_id":"${fileTemps[filename].provenance.image.subject_id}",
"case_id":"${fileTemps[filename].provenance.image.case_id}",
"slide": "${fileTemps[filename].provenance.image.subject_id}",
"specimen": "",
"study": ""
},
"analysis":{
"study_id":"${tempObject.provenance.analysis.study_id}",
"analysis":{
"study_id":"${fileTemps[filename].provenance.analysis.study_id}",
"computation":"heatmap",
"size": [${width},${height}],
"fields":${JSON.stringify(fields)},
"execution_id":"${tempObject.provenance.analysis.execution_id}",
"execution_id":"${fileTemps[filename].provenance.analysis.execution_id}",
"source":"computer"
}
},
"data":${JSON.stringify(data)}
}`;
}
}
5 changes: 4 additions & 1 deletion test/test_add_slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const { JSDOM } = jsdom;
const fetch = require("node-fetch")

// jsdom instance
const testurl = "http://localhost:4010/table.html"
const posturl = "http://localhost:4010/data/Slide/post"
const findurl = "http://localhost:4010/data/Slide/find?slide=TEST"


describe('Slide Loading Step 1', function () {

it('Posts a Slide', function (done) {
this.timeout(5000);
var slideData = {"name" : "TEST" , "specimen": '', "study": '', "location" : "/images/sample.svs" , "mpp" : 0.499};
var postProcess = fetch(posturl, {
"method":"POST",
Expand All @@ -22,6 +22,7 @@ describe('Slide Loading Step 1', function () {
},
body:JSON.stringify(slideData)})
postProcess.then(x=>x.json()).then(x=>{
console.log(x)
assert.equal(x.count,1, "Post Reported Successful")
done()
}).catch(e=>{
Expand All @@ -34,8 +35,10 @@ describe('Slide Loading Step 1', function () {
describe('Slide Loading Step 2', function () {
// can we see it in find
it('Finds the added slide', function (done) {
this.timeout(5000);
let getProcess = fetch(findurl)
getProcess.then(x=>x.json()).then(x=>{
console.log(x)
assert.equal(x.length,1, "Slide Shows up in API List")
done()
}).catch(e=>{
Expand Down

0 comments on commit ca48251

Please sign in to comment.