1 angular 2 .module('app') 3 .controller('signatureDetailsModalCtrl', ['$scope', '$state','$uibModal', '$uibModalInstance','IlincsR','PharmAction','sig','signatures', function($scope, 4 $state,$uibModal, $uibModalInstance,IlincsR,PharmAction,sig,signatures) { 5 6 7 8 function getDownloadSignature(signatures) { 9 // console.log(Array.isArray(signatures)); 10 var sigType=signatures.substring(0,3); 11 if (sigType=="ENC") { 12 $scope.sigENC=true; 13 } else { 14 $scope.sigENC=false; 15 } 16 17 // console.log(); 18 19 IlincsR 20 .downloadSignature({sigID: signatures,display: true}) 21 .$promise 22 .then(function(results) { 23 $scope.signatureData=results.data.signature; 24 $scope.signatureFile=results.data.fileName[0]; 25 $scope.sessionID=results.data.fileName[0].substring(4,results.data.fileName[0].length-4); 26 // $scope.sigDownShow = true; 27 $scope.sigDownLoad =false; 28 $scope.dataLoading =false; 29 30 $scope.customDownTheme = { 31 iconUp: 'fa fa-sort-amount-asc pull-right samplesHead', 32 iconDown: 'fa fa-sort-amount-desc pull-right samplesHead', 33 listItemsPerPage: [10, 20], 34 itemsPerPage: 10, 35 loadOnInit: true 36 }; 37 38 if ($scope.sigENC) { 39 $scope.downloadSigResource = { 40 "header": //response.data.header, 41 [ 42 { "GeneID": "gene ID" }, 43 { "GeneNames": "Symbol" }, 44 { "score":"Score"}, 45 { "prob": "Probability" } 46 ], 47 "rows": $scope.signatureData 48 }; 49 } 50 else { 51 52 $scope.downloadSigResource = { 53 "header": //response.data.header, 54 [ 55 // { "signatureID": "signature ID" }, 56 { "GeneID": "gene ID" }, 57 { "GeneNames": "Symbol" }, 58 { "coefficients":"Differential Expression"}, 59 { "Pvals": "P Value" } 60 // { "Diff_Exp":"Differential Expression"}, 61 // { "P_Value": "P Value" } 62 // { "score":"Score"}, 63 // { "prob": "Probability" } 64 ], 65 "rows": $scope.signatureData 66 //response.data 67 // ,"pagination": { 68 // "page": 2 69 // } 70 }; 71 } 72 73 }); 74 } 75 76 function getPharmAction(sig){ 77 // $scope.pharmActionTerm 78 // console.log(sig); 79 // PharmAction.findOne( 80 // // {lincspertid: "LSM-1232",perturbagenid: "BRD-A00100033"}, 81 // // {filter:{where:[{lincspertid: "LSM-1232"},{perturbagenid: "BRD-A00100033"}]}}, 82 // // {where:{and:[{lincspertid: "LSM-1232"},{perturbagenid: "BRD-A00100033"}]}}, 83 // // {where:{lincspertid:sig.lincspertid}}, 84 // {where:{and:[{lincspertid:sig.lincspertid},{perturbagenid:sig.perturbagenID}]}}, 85 // function(data){ 86 // console.log(data); 87 // console.log(data.length); 88 // $scope.pharmAction = data; 89 // }, 90 // function(errorResponse){console.log("pharm Action not found."),console.log(errorResponse)}); 91 92 PharmAction
93 .find({filter:{where:{and:[{lincspertid:sig.lincspertid},{perturbagenid:sig.perturbagenID}]}}}) 94 .$promise 95 .then(function(data) { 96 // console.log(data); 97 // console.log(data.length); 98 $scope.pharmActions = data; 99 // $scope.pharmActionsNumber = data; 100 }); 101 102 }; 103 104 $scope.showSignatureData = function(item){ 105 // $scope.sigDownLoad = true; 106 $scope.filterByDown={}; 107 $scope.sigDownShow =!$scope.sigDownShow; 108 // $scope.filterSig 109 // getDownloadSignature(item); 110 } 111 112 113 $scope.goConcordant = function (signatureId) { 114 // $uibModalInstance.close($scope.selected.item); 115 $uibModalInstance.dismiss('concordant'); 116 117 $state.go('concordantSignatures',{signatureID:signatureId}); 118 }; 119 120 $scope.modalDismiss = function (signatureId) { 121 $uibModalInstance.dismiss('concordant'); 122 }; 123 124 125 126 $scope.ok = function () { 127 $uibModalInstance.close($scope.selected.item); 128 }; 129 130 $scope.cancel = function () { 131 $uibModalInstance.dismiss('cancel'); 132 }; 133 134 $scope.openIframeModal = function (linkID,type) { 135 136 // console.log(linkID); 137 // console.log(type); 138 139 var modalInstance = $uibModal.open({ 140 animation: $scope.animationsEnabled, 141 // templateUrl: 'myModalContent.html', 142 templateUrl: 'views/templates/modals/iFrame.html', 143 controller: 'iFrameModalInstanceCtrl', 144 size: 'xxl', 145 windowClass: 'app-modal-window', 146 resolve: { 147 linkID: function () { 148 return linkID; 149 }, 150 type: function () { 151 return type; 152 } 153 } 154 }); 155 } 156 157 $scope.addToLocalSigs = function(sigs) { 158 159 if (localStorage.getObj("SignatureListStorage")) { 160 $scope.localSigs = localStorage.getObj("SignatureListStorage"); 161 } else { 162 $scope.localSigs = []; 163 } 164 165 angular.forEach(sigs, function(sig) { 166 // console.log("Checking Signature: "+sig); 167 168 169 170 index=$scope.localSigs.indexOf(sig); 171 // console.log("Signature index: "+index); 172 if (index<0){ 173 // if ($scope.filterchk.length<2) { 174 $scope.localSigs.push(sig) 175 // } else { 176 // $scope.filterchk.shift(); 177 // $scope.filterchk.push($scope.newFilter) 178 // } 179 } else { 180 // console.log("Signature already in local storage"); 181 // $scope.filterSig.splice(index,1); 182 } 183 }) 184 localStorage.setObj('SignatureListStorage', $scope.localSigs); 185 } 186 187 //from signatures service 188 $scope.getLibName = function(lib) { 189 return signatures.getLibName(lib); 190 } 191 192 init = function() { 193 194 $scope.showPlot=false; 195 // console.log(sig); 196 $scope.opened = sig; 197 $scope.sigDownShow =false; 198 $scope.dataLoading =true; 199 200 // console.log(sig); 201 if (sig.signatureid) { 202 // console.log("sig OK"); 203 getDownloadSignature(sig.signatureid); 204 if (sig.lincspertid&&sig.perturbagenID) 205 { 206 getPharmAction(sig); 207 } 208 } 209 else { 210 // console.log("NO sig"); 211 // console.log(sig); 212 setTimeout(function() { 213 getDownloadSignature(sig.signatureid); 214 if (sig.lincspertid&&sig.perturbagenID) 215 { 216 getPharmAction(sig); 217 } 218 }, 1000); 219 } 220 221 222 } 223 224 225 226 init(); 227 228 }]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.