Changeset 5730
- Timestamp:
- Nov 18, 2019, 2:12:54 PM (3 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/analysis/vcall_confirm.js
r5728 r5730 97 97 html += '<td>'+Reggie.formatCount(raw.VariantsRaw)+'</td>'; 98 98 html += '<td>'; 99 html += raw.vcfFile ? raw.spots : '-'; 99 if (raw.vcfFile) 100 { 101 html += raw.spots + '<span class="link vcf-link" data-file-id="'+raw.vcfFile.id+'" data-item-id="'+raw.id+'" title="View summary for the variants"><img src="../images/vcf_file.png" style="margin-left: 2px;"></span>'; 102 } 100 103 html += '</td>'; 101 104 … … 149 152 } 150 153 154 var linkedVcf = document.getElementsByClassName('vcf-link'); 155 for (var i = 0; i < linkedVcf.length; i++) 156 { 157 Events.addEventHandler(linkedVcf[i], 'click', vcall.vcfLinkOnClick); 158 } 159 160 151 161 Doc.show('step-1'); 152 162 Doc.show('goregister'); … … 166 176 } 167 177 168 178 vcall.vcfLinkOnClick = function(event) 179 { 180 var fileId = Data.int(event.currentTarget, 'file-id'); 181 var itemId = Data.int(event.currentTarget, 'item-id'); 182 var url = 'view_variants.jsp?ID=' + App.getSessionId(); 183 url += '&fileId='+fileId; 184 url += '&itemId='+itemId; 185 Dialogs.openPopup(url, 'ViewVcf', 900, 600); 186 } 187 169 188 vcall.submit = function() 170 189 { -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/JsonUtil.java
r5485 r5730 16 16 import net.sf.basedb.core.BioWell; 17 17 import net.sf.basedb.core.DbControl; 18 import net.sf.basedb.core.File; 18 19 import net.sf.basedb.core.Hardware; 19 20 import net.sf.basedb.core.Item; … … 260 261 return json; 261 262 } 263 264 /** 265 @since 4.24 266 */ 267 public static JSONObject getFileAsJSON(File file) 268 { 269 JSONObject jsonFile = new JSONObject(); 270 jsonFile.put("id", file.getId()); 271 jsonFile.put("name", file.getName()); 272 jsonFile.put("size", file.getSize()); 273 jsonFile.put("path", file.getPath().toString()); 274 return jsonFile; 275 } 262 276 263 277 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/VariantCallingServlet.java
r5728 r5730 2 2 3 3 import java.io.IOException; 4 import java.io.InputStream; 4 5 import java.util.ArrayList; 6 import java.util.Arrays; 5 7 import java.util.List; 8 import java.util.zip.GZIPInputStream; 6 9 7 10 import javax.servlet.ServletException; … … 52 55 import net.sf.basedb.reggie.grid.ScriptUtil; 53 56 import net.sf.basedb.reggie.grid.VariantCallingJobCreator; 57 import net.sf.basedb.reggie.vcf.SnpData; 58 import net.sf.basedb.reggie.vcf.VariantCallingInfoFactory; 59 import net.sf.basedb.reggie.vcf.VcfParser; 60 import net.sf.basedb.util.FileUtil; 54 61 import net.sf.basedb.util.Values; 55 62 import net.sf.basedb.util.error.ThrowableUtil; … … 169 176 170 177 File vcf = raw.getFile(dc, Datafiletype.VCF); 171 if (vcf != null) raw.setAnnotation("vcfFile", vcf.getPath().toString());178 if (vcf != null) raw.setAnnotation("vcfFile", JsonUtil.getFileAsJSON(vcf)); 172 179 173 180 // Load job information … … 187 194 188 195 json.put("rawBioAssays", jsonRawBioAssays); 196 } 197 else if ("GetVcfStatistics".equals(cmd)) 198 { 199 int fileId = Values.getInt(req.getParameter("fileId")); 200 int itemId = Values.getInt(req.getParameter("itemId")); 201 dc = sc.newDbControl(); 202 203 Rawbioassay vcall = Rawbioassay.getById(dc, itemId); 204 AlignedSequences alignment = vcall.getAlignedSequences(dc); 205 206 vcall.setAnnotation("VariantsRaw", Annotationtype.VARIANTS_RAW.getAnnotationValue(dc, alignment.getItem())); 207 208 File vcf = File.getById(dc, fileId); 209 InputStream vcfIn = null; 210 try 211 { 212 VcfParser parser = new VcfParser(); 213 parser.setUseLineNoAsId(true); 214 parser.setInfoFactory(new VariantCallingInfoFactory( 215 Arrays.asList("CCv87_ID"), 216 Arrays.asList("Gene_Name") 217 )); 218 vcfIn = vcf.getDownloadStream(0); 219 if (vcf.getName().endsWith(".gz")) vcfIn = new GZIPInputStream(vcfIn); 220 parser.parse(vcfIn, vcf.getName()); 221 FileUtil.close(vcfIn); 222 223 List<SnpData> snpList = parser.getSnpData(); 224 JSONArray jsonSnp = new JSONArray(); 225 for (SnpData snp : snpList) 226 { 227 jsonSnp.add(snp.asJSONObject()); 228 } 229 230 json.put("rawbioassay", vcall.asJSONObject()); 231 json.put("snpData", jsonSnp); 232 } 233 finally 234 { 235 FileUtil.close(vcfIn); 236 } 189 237 } 190 238 … … 453 501 454 502 455 456 503 }
Note: See TracChangeset
for help on using the changeset viewer.