-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installation improvement and doc update
- Loading branch information
acormier
authored and
acormier
committed
Mar 3, 2016
1 parent
3e6130a
commit 86bf208
Showing
3 changed files
with
45 additions
and
69 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,4 +1,4 @@ | ||
#!/usr/bin/python | ||
#!/usr/bin/env python | ||
from ion.plugin import * | ||
import os | ||
import sys | ||
|
@@ -9,27 +9,25 @@ | |
import pickle | ||
from django.template import Context, Template | ||
from django.conf import settings | ||
settings.configure() | ||
|
||
|
||
class IonWisecondor(IonPlugin): | ||
version = "0.1" | ||
""" IonWisecondor """ | ||
version = "1.0.1" | ||
allow_autorun = False | ||
author = "[email protected]" | ||
envDict = dict(os.environ) | ||
|
||
|
||
def launch(self, data=None): | ||
print("Launch started...") | ||
|
||
|
||
|
||
# ================ GET GLOBAL PATH | ||
self.outputDir = os.environ["RESULTS_DIR"]; # The wisecondor results directory | ||
self.analysisDir = os.environ["ANALYSIS_DIR"]; | ||
self.pluginDir = os.environ["PLUGIN_PATH"]; | ||
self.urlRoot = os.environ["URL_ROOT"] # /output/Home/X/ | ||
self.urlPlugin = os.environ["TSP_URLPATH_PLUGIN_DIR"] # /output/Home/X/plugin_out/IonWisecondor | ||
|
||
self.date = os.environ["TSP_ANALYSIS_DATE"] | ||
|
||
# ================ GET INSTANCE PARAMETERS AND STORE THEM IN A LIST | ||
fileCount = int(os.environ["PLUGINCONFIG__COUNT"]) | ||
files = [] | ||
|
@@ -38,47 +36,40 @@ def launch(self, data=None): | |
key = "PLUGINCONFIG__ITEMS__"+str(i) | ||
barcode = os.environ[key+"__BARCODE"] | ||
sample = os.environ[key+"__SAMPLE"] | ||
path = self.analysisDir +"/" + barcode + "_rawlib.bam" | ||
|
||
input = self.analysisDir +"/" + barcode + "_rawlib.bam" | ||
item["sample"] = sample | ||
item["barcode"] = barcode | ||
item["key"] = key | ||
item["path"] = path | ||
item["pickle"] = self.urlPlugin + "/" + barcode +"_rawlib.pickle" | ||
item["gcc"] = self.urlPlugin + "/" + barcode +"_rawlib.gcc" | ||
item["tested"] = self.urlPlugin + "/" + barcode +"_rawlib.tested" | ||
item["pdf"] = self.urlPlugin + "/" + barcode +"_rawlib.pdf" | ||
|
||
files.append(item) | ||
|
||
item["key"] = key | ||
item["input"] = input | ||
item["pickle"] = self.urlPlugin + "/" + sample + "_" + self.date +".pickle" | ||
item["gcc"] = self.urlPlugin + "/" + sample + "_" + self.date +".gcc" | ||
item["tested"] = self.urlPlugin + "/" + sample + "_" + self.date +".tested" | ||
item["pdf"] = self.urlPlugin + "/" + sample + "_" + self.date +".pdf" | ||
files.append(item) | ||
# ================ LOOP ON EACH FILES AND START COMPUTATION | ||
for item in files: | ||
# Launch run.sh | ||
cmd = self.pluginDir+"/run.sh %s %s %s" % (item["path"], self.outputDir, self.pluginDir) | ||
cmd = self.pluginDir+"/run.sh %s %s %s %s %s" % (item["input"], self.outputDir, self.pluginDir, item["sample"], self.date) | ||
p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | ||
stdout, stderr = p1.communicate() | ||
# Check error | ||
if p1.returncode == 0: | ||
# Compute average of zSmoothDict from barcode_rawlib.tested | ||
|
||
filePath = os.environ["RESULTS_DIR"] + "/" + item["barcode"] + "_rawlib.tested" | ||
|
||
# Compute average of zSmoothDict from sample_rawlib.tested | ||
filePath = os.environ["RESULTS_DIR"] + "/" + item["sample"] + "_" + self.date + ".tested" | ||
|
||
item["s21"] = self.scoreOf(filePath, "21") | ||
item["s18"] = self.scoreOf(filePath, "18") | ||
item["s13"] = self.scoreOf(filePath, "13") | ||
|
||
print(stdout) | ||
else: | ||
raise Exception(stderr) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
# ================ GENERATE RESULTS HTML FROM DJANGO TEMPLATE SYSTEM | ||
|
||
settings.configure() | ||
source = open(os.environ["RUNINFO__PLUGIN__PATH"] + "/block_template.html", "r").read() | ||
t = Template(source) | ||
# Pass files arguments to the template | ||
|
@@ -89,7 +80,6 @@ def launch(self, data=None): | |
f.write(html) | ||
f.close() | ||
|
||
|
||
def scoreOf(self, testedFile, chrom): | ||
with open(testedFile) as file: | ||
data = pickle.loads(file.read()) | ||
|
@@ -99,12 +89,7 @@ def scoreOf(self, testedFile, chrom): | |
score = sum(zScores) / len(zScores) | ||
except : | ||
score = -1 | ||
|
||
return round(score,2) | ||
|
||
|
||
|
||
|
||
if __name__ == "__main__": | ||
PluginCLI(IonWisecondor()) | ||
|
||
PluginCLI() |
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,17 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<h2>Run Transfer Plugin</h2> | ||
This plugin transfers signal processing output files to another Torrent Server and launches a re-analysis | ||
of the dataset on that server. The files that are transferred are Basecaller Input Files. | ||
<ul> | ||
<li>1.wells | ||
<li>analysis.bfmask.bin | ||
<li>analysis.bfmask.stat | ||
<li>average_nuke_trace*.txt | ||
<li>Bead_density_*.png | ||
</ul> | ||
Proton datasets will transfer block-level files when the thumbnail option is unchecked. When thumbnail option is checked, | ||
only the thumbnail files will be transferred. | ||
<h2>IonWisecondor Plugin</h2> | ||
<p><b>WIthin-SamplE COpy Number aberration DetectOR</b></p> | ||
<p>Detect fetal trisomies and smaller CNV's in a maternal plasma sample using whole-genome data.</p> | ||
</body> | ||
</html> | ||
</html> |
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