Skip to content

Commit 4e5e3dc

Browse files
committed
Update to 0-Setup.snb
1 parent 2f3a592 commit 4e5e3dc

File tree

1 file changed

+75
-40
lines changed

1 file changed

+75
-40
lines changed

VCF_Comp/0-Setup.snb

+75-40
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,48 @@
2222
},
2323
"cell_type" : "markdown",
2424
"source" : "# Setup\n\nIn this notebook, we make sure a paired set of variants is available. We provide the annotated datafiles as well for reference."
25+
}, {
26+
"metadata" : {
27+
"trusted" : true,
28+
"input_collapsed" : false,
29+
"collapsed" : false,
30+
"id" : "F5C022C6BA6C45A296F199786753A879"
31+
},
32+
"cell_type" : "code",
33+
"source" : "import scala.sys.process._\nimport scala.language.postfixOps\n\ndef shellTestToBool(shellCommand:String):Boolean = {\n Some(shellCommand !)\n .map{ _ match {\n case 0 => true\n case _ => false }\n }.get\n}",
34+
"outputs" : [ {
35+
"name" : "stdout",
36+
"output_type" : "stream",
37+
"text" : "import scala.sys.process._\nimport scala.language.postfixOps\nshellTestToBool: (shellCommand: String)Boolean\n"
38+
}, {
39+
"metadata" : { },
40+
"data" : {
41+
"text/html" : ""
42+
},
43+
"output_type" : "execute_result",
44+
"execution_count" : 4
45+
} ]
46+
}, {
47+
"metadata" : {
48+
"trusted" : true,
49+
"input_collapsed" : false,
50+
"collapsed" : false,
51+
"id" : "2D0DED5DF344445382E884E80A11B4AE"
52+
},
53+
"cell_type" : "code",
54+
"source" : "// Update this!\nval projectDir = \"./\"\n\n// Paths\nval snpEffBaseDir = projectDir + \"snpEff/\"\nval snpEffVersionString = \"v4_2\"\nval snpEffSourceZip = s\"snpEff_${snpEffVersionString}_core.zip\"\n\n// Checks\nval runningInDocker = shellTestToBool(\"test -f /.dockerenv\")\nval wgetInstalled = shellTestToBool(\"which wget\")\nval unzipInstalled = shellTestToBool(\"which unzip\")\nval snpEffInstalled = shellTestToBool(s\"test -f ${snpEffBaseDir}${snpEffSourceZip}\")\nval snpEffBaseDirExists = shellTestToBool(s\"test -d ${snpEffBaseDir}\")",
55+
"outputs" : [ {
56+
"name" : "stdout",
57+
"output_type" : "stream",
58+
"text" : "projectDir: String = ./\nsnpEffBaseDir: String = ./snpEff/\nsnpEffVersionString: String = v4_2\nsnpEffSourceZip: String = snpEff_v4_2_core.zip\nrunningInDocker: Boolean = true\nwgetInstalled: Boolean = false\nunzipInstalled: Boolean = false\nsnpEffInstalled: Boolean = false\nsnpEffBaseDirExists: Boolean = true\n"
59+
}, {
60+
"metadata" : { },
61+
"data" : {
62+
"text/html" : ""
63+
},
64+
"output_type" : "execute_result",
65+
"execution_count" : 2
66+
} ]
2567
}, {
2668
"metadata" : {
2769
"id" : "96E7D50796C04924AC4E1F7F905F6F13"
@@ -40,14 +82,35 @@
4082
"outputs" : [ {
4183
"name" : "stdout",
4284
"output_type" : "stream",
43-
"text" : "total 91951\ndrwxr-xr-x 6 root root 204 May 31 12:19 .\ndrwxrwxr-x 9 daemon daemon 4096 May 31 19:43 ..\n-rw------- 1 root root 1860660 May 31 12:04 8122_N.vcf.gz\n-rw------- 1 root root 1888646 May 31 12:05 8122_T.vcf.gz\n-rw------- 1 root root 45003812 May 31 12:02 snpEff.8122_N.vcf.gz\n-rw------- 1 root root 45398741 May 31 12:02 snpEff.8122_T.vcf.gz\n\nimport sys.process._\n"
85+
"text" : "total 91951\ndrwxr-xr-x 6 root root 204 May 31 12:19 .\ndrwxrwxr-x 10 daemon daemon 4096 Jun 7 12:06 ..\n-rw------- 1 root root 1860660 May 31 12:04 8122_N.vcf.gz\n-rw------- 1 root root 1888646 May 31 12:05 8122_T.vcf.gz\n-rw------- 1 root root 45003812 May 31 12:02 snpEff.8122_N.vcf.gz\n-rw------- 1 root root 45398741 May 31 12:02 snpEff.8122_T.vcf.gz\n\nimport sys.process._\n"
86+
}, {
87+
"metadata" : { },
88+
"data" : {
89+
"text/plain" : ""
90+
},
91+
"output_type" : "execute_result",
92+
"execution_count" : 4
93+
} ]
94+
}, {
95+
"metadata" : {
96+
"trusted" : true,
97+
"input_collapsed" : false,
98+
"collapsed" : false,
99+
"id" : "CFBDC3020EAD41A38F79F1886F6F036C"
100+
},
101+
"cell_type" : "code",
102+
"source" : ":sh ls -al ./snpEff/",
103+
"outputs" : [ {
104+
"name" : "stdout",
105+
"output_type" : "stream",
106+
"text" : "total 5\ndrwxr-xr-x 3 root root 102 Jun 7 12:19 .\ndrwxrwxr-x 10 daemon daemon 4096 Jun 7 12:20 ..\n-rw-r--r-- 1 root root 122 Jun 7 11:45 README.md\n\nimport sys.process._\n"
44107
}, {
45108
"metadata" : { },
46109
"data" : {
47110
"text/plain" : ""
48111
},
49112
"output_type" : "execute_result",
50-
"execution_count" : 1
113+
"execution_count" : 3
51114
} ]
52115
}, {
53116
"metadata" : {
@@ -138,27 +201,6 @@
138201
},
139202
"cell_type" : "markdown",
140203
"source" : "## SnpEff"
141-
}, {
142-
"metadata" : {
143-
"trusted" : true,
144-
"input_collapsed" : false,
145-
"collapsed" : false,
146-
"id" : "6277EC2932474DC1AEC963BF8E02A87A"
147-
},
148-
"cell_type" : "code",
149-
"source" : "//val snpEffBaseDir = \"/Users/toni/Dropbox/_Janssen/CellPass/vcf-comp/snpEff/\"\nval tmpDir = \"/tmp/\"\nval snpEffBaseDir = tmpDir + \"snpEff/\"\nval snpEffVersionString = \"v4_2\"",
150-
"outputs" : [ {
151-
"name" : "stdout",
152-
"output_type" : "stream",
153-
"text" : "tmpDir: String = /tmp/\nsnpEffBaseDir: String = /tmp/snpEff/\nsnpEffVersionString: String = v4_2\n"
154-
}, {
155-
"metadata" : { },
156-
"data" : {
157-
"text/html" : ""
158-
},
159-
"output_type" : "execute_result",
160-
"execution_count" : 19
161-
} ]
162204
}, {
163205
"metadata" : {
164206
"trusted" : true,
@@ -167,18 +209,18 @@
167209
"id" : "6B65F2EC197341A8A879A4E0DD7B2B5A"
168210
},
169211
"cell_type" : "code",
170-
"source" : "import scala.sys.process._\nimport scala.language.postfixOps\n\n\"which wget\" #|| \"apt-get install -y wget\" !\n\n\"which unzip\" #|| \"apt-get install -y unzip\" !",
212+
"source" : "if (runningInDocker) {\n println(\"Running in Docker, checking wget and unzip dependencies...\")\n if (! wgetInstalled) { \n println(\"Installing wget\")\n \"apt-get install -y wget\"! \n } else println(\"wget already installed\")\n if (! unzipInstalled) { \n println(\"Installing unzip\")\n \"apt-get install -y unzip\"! \n } else println(\"unzip already installed\")\n} else {\n println(\"Not running in Docker, make sure wget and unzip are available...\")\n}",
171213
"outputs" : [ {
172214
"name" : "stdout",
173215
"output_type" : "stream",
174-
"text" : "import scala.sys.process._\nimport scala.language.postfixOps\nres54: Int = 0\n"
216+
"text" : "Running in Docker, checking wget and unzip dependencies...\nInstalling wget\nInstalling unzip\nres7: AnyVal = 0\n"
175217
}, {
176218
"metadata" : { },
177219
"data" : {
178220
"text/html" : "0"
179221
},
180222
"output_type" : "execute_result",
181-
"execution_count" : 28
223+
"execution_count" : 5
182224
} ]
183225
}, {
184226
"metadata" : {
@@ -188,36 +230,29 @@
188230
"id" : "EC30FE5830904E588DEAA28BE132DACA"
189231
},
190232
"cell_type" : "code",
191-
"source" : "s\"test -f ${snpEffBaseDir}/snpEff_${snpEffVersionString}_core.zip\" #|| \ns\"wget http://heanet.dl.sourceforge.net/project/snpeff/snpEff_${snpEffVersionString}_core.zip -P ${snpEffBaseDir}\" !\n\ns\"unzip ${snpEffBaseDir}snpEff_${snpEffVersionString}_core.zip -d ${tmpDir}\" !",
233+
"source" : "val snpEffDownloaded = \n if (!snpEffInstalled) {\n println(\"Downloading from Sourceforge...\")\n shellTestToBool(s\"wget http://heanet.dl.sourceforge.net/project/snpeff/${snpEffSourceZip} -P ${snpEffBaseDir}\")\n } else true\n\n// If the download is not successfull, remove the stale file\nif (!snpEffDownloaded) shellTestToBool(s\"rm ${snpEffBaseDir}${snpEffSourceZip}\")\n\nif (!snpEffInstalled && snpEffDownloaded) {\n println(\"Unzipping snpEff...\") \n shellTestToBool(s\"unzip ${snpEffBaseDir}${snpEffSourceZip} -d ${snpEffBaseDir}\")\n}\n\n\n\n\n",
192234
"outputs" : [ {
193235
"name" : "stdout",
194236
"output_type" : "stream",
195-
"text" : "res52: Int = 1\n"
237+
"text" : "Downloading from Sourceforge...\nUnzipping snpEff...\nsnpEffDownloaded: Boolean = true\nres55: AnyVal = true\n"
196238
}, {
197239
"metadata" : { },
198240
"data" : {
199-
"text/html" : "1"
241+
"text/html" : "true"
200242
},
201243
"output_type" : "execute_result",
202-
"execution_count" : 27
244+
"execution_count" : 34
203245
} ]
204246
}, {
205247
"metadata" : {
206248
"trusted" : true,
207249
"input_collapsed" : false,
208-
"collapsed" : false,
209-
"id" : "5F4DAE33B1E7429785F8815D24B379F4"
250+
"collapsed" : true,
251+
"id" : "32FC02C2E3F147128283B90CB9245E50"
210252
},
211253
"cell_type" : "code",
212254
"source" : "",
213-
"outputs" : [ {
214-
"metadata" : { },
215-
"data" : {
216-
"text/html" : ""
217-
},
218-
"output_type" : "execute_result",
219-
"execution_count" : 8
220-
} ]
255+
"outputs" : [ ]
221256
} ],
222257
"nbformat" : 4
223258
}

0 commit comments

Comments
 (0)