-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)} | ||
}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters