Changeset 5730


Ignore:
Timestamp:
Nov 18, 2019, 2:12:54 PM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #1199: Implement Variant calling pipeline

Added a dialog for displaying some information about the discovered variants. So far, the Gene name and an optional link to Cosmic is extracted and displayed. There is a lot more information and upon request it would be possible to display more.

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  
    9797      html += '<td>'+Reggie.formatCount(raw.VariantsRaw)+'</td>';
    9898      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      }
    100103      html += '</td>';
    101104
     
    149152    }
    150153
     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   
    151161    Doc.show('step-1');
    152162    Doc.show('goregister');
     
    166176  }
    167177 
    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
    169188  vcall.submit = function()
    170189  {
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/JsonUtil.java

    r5485 r5730  
    1616import net.sf.basedb.core.BioWell;
    1717import net.sf.basedb.core.DbControl;
     18import net.sf.basedb.core.File;
    1819import net.sf.basedb.core.Hardware;
    1920import net.sf.basedb.core.Item;
     
    260261    return json;
    261262  }
     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  }
    262276
    263277}
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/VariantCallingServlet.java

    r5728 r5730  
    22
    33import java.io.IOException;
     4import java.io.InputStream;
    45import java.util.ArrayList;
     6import java.util.Arrays;
    57import java.util.List;
     8import java.util.zip.GZIPInputStream;
    69
    710import javax.servlet.ServletException;
     
    5255import net.sf.basedb.reggie.grid.ScriptUtil;
    5356import net.sf.basedb.reggie.grid.VariantCallingJobCreator;
     57import net.sf.basedb.reggie.vcf.SnpData;
     58import net.sf.basedb.reggie.vcf.VariantCallingInfoFactory;
     59import net.sf.basedb.reggie.vcf.VcfParser;
     60import net.sf.basedb.util.FileUtil;
    5461import net.sf.basedb.util.Values;
    5562import net.sf.basedb.util.error.ThrowableUtil;
     
    169176         
    170177          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));
    172179         
    173180          // Load job information
     
    187194       
    188195        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        }
    189237      }
    190238   
     
    453501 
    454502 
    455 
    456503}
Note: See TracChangeset for help on using the changeset viewer.