0
|
1 #!/bin/bash
|
|
2
|
|
3 #########################################
|
|
4 ### SPECIFY THE NUMBER OF CPU ###
|
|
5 #########################################
|
|
6 cpu=1
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11 html=$1;shift
|
|
12 parameters=$1;shift
|
|
13 source=$1;shift
|
|
14 input=$1
|
|
15
|
|
16 if [[ $source == "html" ]]
|
|
17 then input=${input%%.*}_files/Mutational_Analysis/Figures/Input_NMF/Input_NMF_Count.txt
|
|
18 fi
|
|
19
|
|
20 output_dir=${html%%.*}_files
|
|
21 mkdir $output_dir
|
|
22
|
|
23 Rscript $SCRIPT_PATH/R/somaticSignature_Galaxy.r $parameters --cpu $cpu --input $input --output $output_dir 2>&1
|
|
24
|
|
25
|
|
26 ## Test the existence of the files and graphs produced by NMF
|
|
27 if [[ ! -e "$output_dir/NMF/Files/MatrixW-Normto100.txt" ]]; then
|
|
28 >&2 echo "error"
|
|
29 exit
|
|
30 fi
|
|
31
|
|
32
|
|
33 echo "<html><body>" >> $html
|
|
34 echo "<center> <h2> NMF Mutational signatures analysis </h2> </center>" >> $html
|
|
35
|
|
36
|
|
37 echo "<table>" >> $html
|
|
38 echo "<tr> <br/> <th><h3>Heatmap of the mixture coefficient matrix</h3></th> </tr>" >> $html
|
|
39 echo "<tr> <td> <center> <br/> <a href="NMF/Files/Cluster_MixtureCoeff.txt">Cluster_MixtureCoeff.txt</a> </center> </td> </tr>" >> $html
|
|
40 echo "<tr>" >> $html
|
|
41
|
|
42 if [[ ! -e "$output_dir/NMF/Figures/Heatmap_MixtureCoeff.png" ]]; then
|
|
43 echo "WARNING: NMF package can't plot the heatmap when the samples size is above 300. <br/>" >> $html
|
|
44 else
|
|
45 echo "<td> <center> <a href="NMF/Figures/Heatmap_MixtureCoeff.png">" >> $html
|
|
46 echo "<img src="NMF/Figures/Heatmap_MixtureCoeff.png" /></a> <center> </td>" >> $html
|
|
47 fi
|
|
48 echo "</tr>" >> $html
|
|
49 echo "</table>" >> $html
|
|
50
|
|
51 echo "<br/><br/>" >> $html
|
|
52
|
|
53 echo "<table>" >> $html
|
|
54 echo "<tr>" >> $html
|
|
55 echo "<th><h3>Signature composition</h3></th>" >> $html
|
|
56 echo "</tr>" >> $html
|
|
57 echo "<tr><td> <center> <a href="NMF/Files/MatrixW-Normto100.txt">Composition somatic mutation (input matrix for the tool MutSpec-Compare)</a><center></td></tr>" >> $html
|
|
58 echo "<tr>" >> $html
|
|
59 echo "<td><a href="NMF/Figures/CompositionSomaticMutation.png">" >> $html
|
|
60 echo "<img width="1000" src="NMF/Figures/CompositionSomaticMutation.png" /></a></td>" >> $html
|
|
61 echo "</tr> " >> $html
|
|
62 echo "</table>" >> $html
|
|
63 echo "<br/><br/>" >> $html
|
|
64
|
|
65 echo "<table>" >> $html
|
|
66 echo "<tr>" >> $html
|
|
67 echo "<th><h3>Sample contribution to signatures</h3></th>" >> $html
|
|
68 echo "</tr>" >> $html
|
|
69 echo "<tr><td> <center> <a href="NMF/Files/MatrixH-Inputggplot2.txt">Contribution mutation signature matrix</a></center></td></tr>" >> $html
|
|
70 echo "<tr>" >> $html
|
|
71 echo "<td><a href="NMF/Figures/ContributionMutationSignature.png">" >> $html
|
|
72 echo "<img width="700" src="NMF/Figures/ContributionMutationSignature.png" /></a></td>" >> $html
|
|
73 echo "</tr> " >> $html
|
|
74 echo "</table>" >> $html
|
|
75 echo "<br/><br/>" >> $html
|
|
76
|
|
77
|
|
78 echo "<table>" >> $html
|
|
79 echo "<tr>" >> $html
|
|
80 echo "<th><h3>Average contributions of each signatures in each cluster</h3></th>" >> $html
|
|
81 echo "</tr>" >> $html
|
|
82 echo "<tr><td> <center> <a href="NMF/Files/Average_ContriByCluster.txt">Average contributions</a></center></td></tr>" >> $html
|
|
83 echo "<tr>" >> $html
|
|
84 echo "<td><a href="NMF/Figures/Average_ContriByCluster.png">" >> $html
|
|
85 echo "<img width="700" src="NMF/Figures/Average_ContriByCluster.png" /></a></td>" >> $html
|
|
86 echo "</tr> " >> $html
|
|
87 echo "</table>" >> $html
|
|
88 echo "<br/><br/>" >> $html
|
|
89
|
|
90 echo "<br/><br/><br/><br/>" >> $html
|
|
91
|
|
92
|
|
93
|
|
94 exit 0
|