refactor phenotypes brapi calls
[sgn.git] / mason / breeders_toolbox / genotyping_trials / upload_genotyping_data_dialogs.mas
blobd19d31bcefee659f28dda96003ceb0dc21374bd0
1 <%args>
2 </%args>
4 <& /util/import_javascript.mas, classes => [ 'CXGN.BreedersToolbox.GenotypingTrial' ] &>
6 <div class="modal fade" id="upload_genotypes_dialog" name="upload_genotypes_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadGenotypesDialog">
7     <div class="modal-dialog modal-xl" role="document">
8         <div class="modal-content">
9             <div class="modal-header">
10                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
11                 <h4 class="modal-title" id="uploadGenotypesDialog">Upload Genotypes</h4>
12             </div>
13             <div class="modal-body">
14                 <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_genotypes_form" name="upload_genotypes_form" action="/ajax/genotype/upload">
16                     <div class="container-fluid">
18                         <&| /util/workflow.mas, id=> "upload_genotypes_workflow" &>
19                             <&| /util/workflow.mas:step, title=> "Intro" &>
20                                 <& /page/page_title.mas, title=>"This workflow will guide you through uploading genotypes into the database" &>
21                                 <p>Select a genotyping project on the next screen. This project can represent a series of genotyping plates sent to a genotyping facilty.</p>
22                                 <p>Ideally the sample names in your VCF file will match sample names in genotyping plates in the database; however, the sample names in your file can also match accession names in the database.</p>
23                                 <p>Curently we support the VCF format for upload.</p>
25                                 <br/><br/>
26                                 <center>
27                                 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
28                                 </center>
29                             </&>
31                             <&| /util/workflow.mas:step, title=> "Genotyping Project" &>
32                                 <& /page/page_title.mas, title=>"Select the genotyping project or create a new one" &>
34                                 <table id="upload_genotyping_data_project_search_results" width="100%" class="table table-hover table-striped">
35                                     <thead>
36                                         <tr>
37                                             <th>Select</th>
38                                             <th>Genotyping Project Name</th>
39                                             <th>Description</th>
40                                             <th>Breeding program</th>
41                                             <th>Year</th>
42                                             <th>Location</th>
43                                             <th>Genotyping Facility</th>
44                                         </tr>
45                                     </thead>
46                                 </table>
48                                 <center>
49                                 <button class="btn btn-primary" id="upload_genotyping_data_project_missing_button">My project is not here. Create a new one.</button>
50                                 </center>
51                                 <br/>
53                                 <!-- If genotyping project is selected above, the project_id is passed to controller, negating need to create new project -->
54                                 <input id="upload_genotype_project_id" name="upload_genotype_project_id" type="hidden" />
56                                 <div id="upload_genotyping_data_project_details" style="display:none">
57                                     <div class="well">
58                                         <div class="form-group">
59                                             <label class="col-sm-5 control-label">Genotyping Project Name: <br/><small>Should match Vendor Project if you have one</small></label>
60                                             <div class="col-sm-7">
61                                                 <input class="form-control" id="upload_genotype_vcf_project_name" name="upload_genotype_vcf_project_name" type="text" placeholder="e.g. NextGenCassava"/>
62                                             </div>
63                                         </div>
64                                         <div class="form-group">
65                                             <label class="col-sm-5 control-label">Genotyping Facility: </label>
66                                             <div class="col-sm-7">
67                                                 <select class="form-control" id="upload_genotype_vcf_facility_select" name="upload_genotype_vcf_facility_select">
68                                                     <option value="none">None</option>
69                                                     <option value="igd">Cornell IGD</option>
70                                                     <option value="intertek">Intertek</option>
71                                                     <option value="dart">Dart</option>
72                                                     <option value="bgi">BGI</option>
73                                                 </select>
74                                             </div>
75                                         </div>
76                                         <div class="form-group">
77                                             <label class="col-sm-5 control-label">Breeding Program: </label>
78                                             <div class="col-sm-7">
79                                                 <span id="upload_genotype_breeding_program_select_div"></span>
80                                             </div>
81                                         </div>
82                                         <div class="form-group">
83                                             <label class="col-sm-5 control-label">Year: </label>
84                                             <div class="col-sm-7">
85                                                 <span id="upload_genotype_year_select_div"></span>
86                                             </div>
87                                         </div>
88                                         <div class="form-group">
89                                             <label class="col-sm-5 control-label">Description: </label>
90                                             <div class="col-sm-7">
91                                                 <textarea class="form-control" id="upload_genotype_vcf_project_description" name="upload_genotype_vcf_project_description" maxlength="250"></textarea>
92                                             </div>
93                                         </div>
94                                     </div>
95                                 </div>
97                                 <br/>
98                                 <center>
99                                 <button class="btn btn-primary" id="upload_genotyping_data_project_check_button">Go to Next Step</button>
100                                 </center>
101                             </&>
102                             <&| /util/workflow.mas:step, title=> "Genotyping Protocol" &>
103                                 <& /page/page_title.mas, title=>"Provide info about the protocol used" &>
105                                 <table id="upload_genotyping_data_protocol_search_results" width="100%" class="table table-hover table-striped">
106                                     <thead>
107                                         <tr>
108                                             <th>Select</th>
109                                             <th>Protocol Name</th>
110                                             <th>Header Description</th>
111                                             <th>Number of Markers</th>
112                                             <th>Protocol Description</th>
113                                             <th>Reference Genome</th>
114                                             <th>Species</th>
115                                             <th>Sample Unit</th>
116                                             <th>Create Date</th>
117                                         </tr>
118                                     </thead>
119                                 </table>
121                                 <center>
122                                 <button class="btn btn-primary" id="upload_genotyping_data_protocol_missing_button">My protocol is not here. Create a new one.</button>
123                                 </center>
124                                 <br/>
126                                 <!-- If protocol is selected above, the protocol_id is passed to controller, negating need to create new protocol -->
127                                 <input id="upload_genotype_protocol_id" name="upload_genotype_protocol_id" type="hidden" />
129                                 <div id="upload_genotype_data_protocol_details" style="display:none">
130                                     <div class="well">
131                                         <div class="form-group">
132                                             <label class="col-sm-5 control-label">Genotyping Protocol Name:</label>
133                                             <div class="col-sm-7">
134                                                 <input class="form-control" id="upload_genotype_vcf_protocol_name" name="upload_genotype_vcf_protocol_name" type="text" placeholder=" e.g. GBS ApeKI Cassava genome v6 Jan2015"/>
135                                             </div>
136                                         </div>
137                                         <div class="form-group">
138                                             <label class="col-sm-5 control-label">Genotyping Protocol Reference Genome:</label>
139                                             <div class="col-sm-7">
140                                                 <input class="form-control" id="upload_genotype_vcf_reference_genome_name" name="upload_genotype_vcf_reference_genome_name" type="text" placeholder="Mesculenta_511_v7.0"/>
141                                             </div>
142                                         </div>
143                                         <div class="form-group">
144                                             <label class="col-sm-5 control-label">Species:</label>
145                                             <div class="col-sm-7">
146                                                 <input class="form-control" id="upload_genotypes_species_name_input" name="upload_genotypes_species_name_input" type="text" placeholder=" e.g. Manihot esculenta"/>
147                                             </div>
148                                         </div>
149                                         <div class="form-group">
150                                             <label class="col-sm-5 control-label">Description:</label>
151                                             <div class="col-sm-7">
152                                                 <input class="form-control" id="upload_genotypes_protocol_description_input" name="upload_genotypes_protocol_description_input" type="text" />
153                                             </div>
154                                         </div>
155                                         <div class="form-group">
156                                             <label class="col-sm-5 control-label">Choose Sample Unit: </label>
157                                             <div class="col-sm-7">
158                                                 <input type="radio" name="upload_genotype_vcf_observation_type" value="tissue_sample" checked>&nbsp;&nbsp;&nbsp;Exported Tissue Sample Name: The sample names in your VCF are tissue_sample_names that already exist in genotyping plates (e.g. 96 well plates) in the database. The sample names in your VCF file can be the tissue_sample_name triple pipe joined to the accession_name (e.g. tissue_sample_name|||accession_name) or just simply the tissue_sample_name corresponding to the genotyping plate well.
159                                                 <br/><br/>
160                                                 <input type="radio" name="upload_genotype_vcf_observation_type" value="accession">&nbsp;&nbsp;&nbsp;Accession: The sample names are of accession names
161                                             </div>
162                                         </div>
163                                     </div>
164                                 </div>
166                                 <div class="well">
167                                     <div class="form-group">
168                                         <label class="col-sm-5 control-label">Location of Data Generation: </label>
169                                         <div class="col-sm-7">
170                                             <span id="upload_genotype_location_select_div"></span>
171                                         </div>
172                                     </div>
173                                     <div class="form-group">
174                                         <label class="col-sm-5 control-label">Exported Tissue Sample Names Include Numbers Generated by Genotyping Facility (e.g. sample_name:IGD1001:09):<br/><small>The generated number is separated from the tissue sample name in the database by a ':' separating character.</small> </label>
175                                         <div class="col-sm-7">
176                                             <input type="checkbox" id="upload_genotype_vcf_include_igd_numbers" name="upload_genotype_vcf_include_igd_numbers" >
177                                         </div>
178                                     </div>
179                                 </div>
181                                 <br/>
182                                 <center>
183                                 <button class="btn btn-primary" id="upload_genotyping_data_protocol_check_button">Go to Next Step</button>
184                                 </center>
185                             </&>
186                             <&| /util/workflow.mas:step, title=> "Genotype Info" &>
187                                 <& /page/page_title.mas, title=>"Provide genotype information" &>
188                                 <br/><br/>
191                                 <div class="form-group">
192                                     <label class="col-sm-5 control-label">Select type of genotyping data: </label>
193                                     <div class="col-sm-7">
194                                         <select class="form-control" id="upload_genotype_data_format_select" name="upload_genotype_data_format_select">
195                                             <option value="vcf">VCF</option>
196                                             <option value="intertek">Intertek</option>
197                                         </select>
198                                     </div>
199                                 </div>
201                                 <div class="well well-sm" id="upload_genotype_data_format_vcf">
202                                     <div class="row">
203                                         <div class="col-sm-4">
204                                             <&| /page/explanation.mas, title=>'Template information' &>
205                                                 <p>
206                                                     <b>File format information</b>
207                                                     <br>
208                                                     <a id="upload_genotype_vcf_spreadsheet_info_format">VCF format</a>
209                                                 </p>
210                                             </&>
211                                         </div>
212                                         <div class="col-sm-8">
213                                             <br/>
214                                             <div class="panel panel-default">
215                                                 <div class="panel-body">
216                                                     <div class="form-group">
217                                                         <label class="col-sm-6 control-label">Select VCF File: </label>
218                                                         <div class="col-sm-6">
219                                                             <input type="file" name="upload_genotype_vcf_file_input" id="upload_genotype_vcf_file_input" encoding="multipart/form-data" />
220                                                         </div>
221                                                     </div>
222                                                 </div>
223                                             </div>
224                                         </div>
225                                     </div>
226                                 </div>
228                                 <div class="well well-sm" id="upload_genotype_data_format_intertek" style="display:none">
229                                     <div class="row">
230                                         <div class="col-sm-4">
231                                             <&| /page/explanation.mas, title=>'Template information' &>
232                                                 <p>
233                                                     <b>File format information</b>
234                                                     <br>
235                                                     <a id="upload_genotype_intertek_spreadsheet_info_format">Intertek format</a>
236                                                 </p>
237                                             </&>
238                                         </div>
239                                         <div class="col-sm-8">
240                                             <br/>
241                                             <div class="panel panel-default">
242                                                 <div class="panel-body">
243                                                     <div class="form-group">
244                                                         <label class="col-sm-6 control-label">Select Intertek SNP Result Grid File: </label>
245                                                         <div class="col-sm-6">
246                                                             <input type="file" name="upload_genotype_intertek_file_input" id="upload_genotype_intertek_file_input" encoding="multipart/form-data" />
247                                                         </div>
248                                                     </div>
249                                                 </div>
250                                             </div>
251                                             <div class="panel panel-default">
252                                                 <div class="panel-body">
253                                                     <div class="form-group">
254                                                         <label class="col-sm-6 control-label">Select Intertek SNP Information File: </label>
255                                                         <div class="col-sm-6">
256                                                             <input type="file" name="upload_genotype_intertek_snp_file_input" id="upload_genotype_intertek_snp_file_input" encoding="multipart/form-data" />
257                                                         </div>
258                                                     </div>
259                                                 </div>
260                                             </div>
261                                         </div>
262                                     </div>
263                                 </div>
265                                 <br/><br/>
266                                 <center>
267                                 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
268                                 </center>
269                             </&>
270                             <&| /util/workflow.mas:step, title=> "Confirm" &>
271                                 <& /page/page_title.mas, title=>"Finalize and submit your genotyping data" &>
273                                 <div id="upload_genotypes_missing_stocks_div" style="display:none">
274                                     <div id="upload_genotypes_add_missing_stocks_html">
275                                     </div>
277                                     <div class="form-group">
278                                         <label class="col-sm-5 control-label">Add these missing stocks as new accessions?: </label>
279                                         <div class="col-sm-7">
280                                             <select class="form-control" id="upload_genotype_add_new_accessions" name="upload_genotype_add_new_accessions">
281                                                 <option value="">No (currently disabled for safety)</option>
282                                                 <!--option value="1">Yes</option-->
283                                             </select>
284                                         </div>
285                                     </div>
286                                 </div>
288                                 <div id="upload_genotypes_errors_div">
289                                 </div>
291                                 <div id="upload_genotypes_warnings_div" style="display:none">
292                                     <div id="upload_genotypes_warnings_html">
293                                     </div>
295                                     <hr>
296                                     <div class="form-group">
297                                         <label class="col-sm-5 control-label">Ignore warnings and upload genotypes?: </label>
298                                         <div class="col-sm-7">
299                                             <select class="form-control" id="upload_genotype_accept_warnings" name="upload_genotype_accept_warnings">
300                                                 <option value="">No</option>
301                                                 <option value="1">Yes</option>
302                                             </select>
303                                         </div>
304                                     </div>
305                                 </div>
307                                 <center>
308                                 <button type="button" class="btn btn-primary" name="upload_genotype_submit" id="upload_genotype_submit">Submit</button>
309                                 </center>
310                             </&>
311                             <&| /util/workflow.mas:complete, title=> "Complete" &>
312                                 <& /page/page_title.mas, title=>"Complete! Your genotyping data was saved in the database." &>
314                                 <p>
315                                     <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
316                                     The genotyping data was saved successfully
317                                 </p>
319                                 <br/>
320                             </&>
321                         </&>
323                     </div>
324                 </form>
325             </div>
326             <div class="modal-footer">
327                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
328             </div>
329         </div>
330     </div>
331 </div>
333 <div class="modal fade" id="upload_genotype_vcf_spreadsheet_info_format_dialog" name="upload_genotype_vcf_spreadsheet_info_format_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadGenotypeVCFDialog">
334     <div class="modal-dialog modal-xl" role="document">
335         <div class="modal-content">
336             <div class="modal-header" style="text-align: center">
337                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
338                 <h4 class="modal-title" id="uploadGenotypeVCFDialog">Upload VCF Template Information</h4>
339             </div>
340             <div class="modal-body">
341                 <div class="container-fluid">
342                     <b>This is for uploading VCF genotype data.</b>
343                     <br/>
344                     <b>VCF is a tab separated format</b>
345                     <br />
346                     <b>Header:</b>
347                     <br>
348                     The first row (header) must contain the following fields, followed by all genotyped sample names:
350                     <table class="table table-hover table-bordered table-condensed" >
351                         <thead></thead>
352                         <tbody>
353                             <tr>
354                                 <td>#CHROM</td>
355                                 <td>POS</td>
356                                 <td>ID</td>
357                                 <td>REF</td>
358                                 <td>ALT</td>
359                                 <td>QUAL</td>
360                                 <td>FILTER</td>
361                                 <td>INFO</td>
362                                 <td>FORMAT</td>
363                                 <td>Sample names...</td>
364                             </tr>
365                         </tbody>
366                     </table>
368                     <b>Required fields:</b>
369                     <ul>
370                     <li>#CHROM (chromosome: An identifier from the reference genome pointing to a contig in the assembly file (cf. the ##assembly line in the header). All entries for a specific CHROM should form a contiguous block within the VCF file. The colon symbol (:) must be absent from all chromosome names to avoid parsing errors when dealing with breakends. (String, no white-space permitted, Required))</li>
371                     <li>POS (position: The reference position, with the 1st base having position 1. Positions are sorted numerically, in increasing order, within each reference sequence CHROM. It is permitted to have multiple records with the same POS. Telomeres are indicated by using positions 0 or N+1, where N is the length of the corresponding chromosome or contig. (Integer, Required) )</li>
372                     <li>ID ( identifier: Semi-colon separated list of unique identifiers where available. If this is a dbSNP variant it is encouraged to use the rs number(s). No identifier should be present in more than one data record. If there is no identifier available, then the missing value should be used. (String, no white-space or semi-colons permitted) )</li>
373                     <li>REF (reference base(s): Each base must be one of A,C,G,T,N (case insensitive). Multiple bases are permitted. The value in the POS field refers to the position of the first base in the String. For simple insertions and deletions in which either the REF or one of the ALT alleles would otherwise be null/empty, the REF and ALT Strings must include the base before the event (which must be reflected in the POS field), unless the event occurs at position 1 on the contig in which case it must include the base after the event; this padding base is not required (although it is permitted) for e.g. complex substitutions or other events where all alleles have at least one base represented in their Strings. If any of the ALT alleles is a symbolic allele then the padding base is required and POS denotes the coordinate of the base preceding the polymorphism. Tools processing VCF files are not required to preserve case in the allele Strings. (String, Required) )</li>
374                     <li>ALT (alternate base(s): Comma separated list of alternate non-reference alleles. These alleles do not have to be called in any of the samples. Options are base Strings made up of the bases A,C,G,T,N,*, (case insensitive) or a breakend replacement string as described in the section on breakends. The '*' allele is reserved to indicate that the allele is missing due to a upstream deletion. If there are no alternative alleles, then the missing value should be used. Tools processing VCF files are not required to preserve case in the allele String, except for IDs, which are case sensitive. (String; no whitespace, commas, or angle-brackets are permitted in the ID String itself) )</li>
375                     <li>QUAL (quality: Phred-scaled quality score for the assertion made in ALT. i.e. -10log10 prob(call in ALT is wrong). If ALT is '.' (no variant) then this is -10log10 prob(variant), and if ALT is not '.' this is -10log10 prob(no variant). If unknown, the missing value should be specified. (Numeric) )</li>
376                     <li>FILTER (filter status: PASS if this position has passed all filters, i.e. a call is made at this position. Otherwise, if the site has not passed all filters, a semicolon-separated list of codes for filters that fail. e.g. "q10;s50" might indicate that at this site the quality is below 10 and the number of samples with data is below 50% of the total number of samples. "0" is reserved and should not be used as a filter String. If filters have not been applied, then this field should be set to the missing value. (String, no white-space or semi-colons permitted) )</li>
377                     <li>INFO (additional information: (String, no white-space, semi-colons, or equals-signs permitted; commas are permitted only as delimiters for lists of values) INFO fields are encoded as a semicolon-separated series of short keys with optional values in the format: key=data[,data]. Arbitrary keys are permitted, although the following sub-fields are reserved (albeit optional):</li>
378                         <ul>
379                             <li>AA : ancestral allele</li>
380                             <li>AC : allele count in genotypes, for each ALT allele, in the same order as listed</li>
381                             <li>AF : allele frequency for each ALT allele in the same order as listed: use this when estimated from primary data, not called genotypes</li>
382                             <li>AN : total number of alleles in called genotypes</li>
383                             <li>BQ : RMS base quality at this position</li>
384                             <li>CIGAR : cigar string describing how to align an alternate allele to the reference allele</li>
385                             <li>DB : dbSNP membership</li>
386                             <li>DP : combined depth across samples, e.g. DP=154</li>
387                             <li>END : end position of the variant described in this record (for use with symbolic alleles)</li>
388                             <li>H2 : membership in hapmap2</li>
389                             <li>H3 : membership in hapmap3</li>
390                             <li>MQ : RMS mapping quality, e.g. MQ=52</li>
391                             <li>MQ0 : Number of MAPQ == 0 reads covering this record</li>
392                             <li>NS : Number of samples with data</li>
393                             <li>SB : strand bias at this position</li>
394                             <li>SOMATIC : indicates that the record is a somatic mutation, for cancer genomics</li>
395                             <li>VALIDATED : validated by follow-up experiment</li>
396                             <li>1000G : membership in 1000 Genomes</li>
397                         </ul>
398                     <br/>The exact format of each INFO sub-field should be specified in the meta-information (as described above). Example for an INFO field: DP=154;MQ=52;H2. Keys without corresponding values are allowed in order to indicate group membership (e.g. H2 indicates the SNP is found in HapMap 2). It is not necessary to list all the properties that a site does. )</li>
399                     <li>FORMAT (A format field is given specifying the data types and order (colon-separated alphanumeric String). This is followed by one field per sample, with the colon-separated data in this field corresponding to the types specified in the format. The first sub-field must always be the genotype (GT) if it is present. There are no required sub-fields. As with the INFO field, there are several common, reserved keywords that are standards across the community:
400                         <ul>
401                             <li>GT : genotype, encoded as allele values separated by either of / or |. The allele values are 0 for the reference allele (what is in the REF field), 1 for the first allele listed in ALT, 2 for the second allele list in ALT and so on. For diploid calls examples could be 0/1, 1 | 0, or 1/2, etc. For haploid calls, e.g. on Y, male nonpseudoautosomal X, or mitochondrion, only one allele value should be given; a triploid call might look like 0/0/1. If a call cannot be made for a sample at a given locus, '.' should be specified for each missing allele in the GT field (for example './.' for a diploid genotype and '.' for haploid genotype). The meanings of the separators are as follows (see the PS field below for more details on incorporating phasing information into the genotypes):</li>
402                             <ul>
403                                 <li>/ : genotype unphased</li>
404                                 <li>| : genotype phased</li>
405                             </ul>
406                             <li>DP : read depth at this position for this sample (Integer)</li>
407                             <li>FT : sample genotype filter indicating if this genotype was "called" (similar in concept to the FILTER field). Again, use PASS to indicate that all filters have been passed, a semi-colon separated list of codes for filters that fail, or '.' to indicate that filters have not been applied. These values should be described in the metainformation in the same way as FILTERs (String, no white-space or semi-colons permitted)</li>
408                             <li>GL : genotype likelihoods comprised of comma separated floating point log10-scaled likelihoods for all possible genotypes given the set of alleles defined in the REF and ALT fields. In presence of the GT field the same ploidy is expected and the canonical order is used; without GT field, diploidy is assumed. If A is the allele in REF and B,C,... are the alleles as ordered in ALT, the ordering of genotypes for the likelihoods is given by: F(j/k) = (k*(k+1)/2)+j. In other words, for biallelic sites the ordering is: AA,AB,BB; for triallelic sites the ordering is: AA,AB,BB,AC,BC,CC, etc. For example: GT:GL 0/1:-323.03,-99.29,-802.53 (Floats)</li>
409                             <li>GLE : genotype likelihoods of heterogeneous ploidy, used in presence of uncertain copy number. For example: GLE=0:-75.22,1:-223.42,0/0:-323.03,1/0:-99.29,1/1:-802.53 (String)</li>
410                             <li>PL : the phred-scaled genotype likelihoods rounded to the closest integer (and otherwise defined precisely as the GL field) (Integers)</li>
411                             <li>GP : the phred-scaled genotype posterior probabilities (and otherwise defined precisely as the GL field); intended to store imputed genotype probabilities (Floats)</li>
412                             <li>GQ : conditional genotype quality, encoded as a phred quality -10log10 p(genotype call is wrong, conditioned on the site's being variant) (Integer)</li>
413                             <li>HQ : haplotype qualities, two comma separated phred qualities (Integers)</li>
414                             <li>PS : phase set. A phase set is defined as a set of phased genotypes to which this genotype belongs. Phased genotypes for an individual that are on the same chromosome and have the same PS value are in the same phased set. A phase set specifies multi-marker haplotypes for the phased genotypes in the set. All phased genotypes that do not contain a PS subfield are assumed to belong to the same phased set. If the genotype in the GT field is unphased, the corresponding PS field is ignored. The recommended convention is to use the position of the first variant in the set as the PS identifier (although this is not required). (Non-negative 32-bit Integer)</li>
415                             <li>PQ : phasing quality, the phred-scaled probability that alleles are ordered incorrectly in a heterozygote (against all other members in the phase set). We note that we have not yet included the specific measure for precisely defining "phasing quality"; our intention for now is simply to reserve the PQ tag for future use as a measure of phasing quality. (Integer)</li>
416                             <li>EC : comma separated list of expected alternate allele counts for each alternate allele in the same order as listed in the ALT field (typically used in association analyses) (Integers)</li>
417                             <li>MQ : RMS mapping quality, similar to the version in the INFO field. (Integer)</li>
418                         </ul>
419                     <br/>If any of the fields is missing, it is replaced with the missing value. For example if the FORMAT is GT:GQ:DP:HQ then 0 | 0 : . : 23 : 23, 34 indicates that GQ is missing. Trailing fields can be dropped (with the exception of the GT field, which should always be present if specified in the FORMAT field). )</li>
420                     </ul>
422                 </div>
423             </div>
424             <div class="modal-footer">
425                 <button id="close_upload_genotyping_spreadsheet_info_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
426             </div>
427         </div>
428     </div>
429 </div>
431 <div class="modal fade" id="upload_genotype_intertek_spreadsheet_info_format_dialog" name="upload_genotype_intertek_spreadsheet_info_format_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadGenotypeIntertekDialog">
432     <div class="modal-dialog modal-xl" role="document">
433         <div class="modal-content">
434             <div class="modal-header" style="text-align: center">
435                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
436                 <h4 class="modal-title" id="uploadGenotypeIntertekDialog">Upload Intertek Template Information</h4>
437             </div>
438             <div class="modal-body">
439                 <div class="container-fluid">
440                     <b>This is for uploading Intertek genotype data.</b>
441                     <br/>
442                     <b>Please use CSV formatted files</b>
443                     <br/>
444                     <br/>
445                     <b>For Intertek SNP Result Grid File:</b>
446                     <br>
447                     <p>The header must be:</p>
448                     <br/>
450                     <table class="table table-hover table-bordered table-condensed" >
451                         <thead></thead>
452                         <tbody>
453                             <tr>
454                                 <td>SampleName.LabID</td>
455                                 <td>All Marker Names In Separate Columns (e.g. marker name = S12_7926132)</td>
456                             </tr>
457                         </tbody>
458                     </table>
460                     <br/>
461                     <p>The SampleName.LabID column should contain the sample name (exported_tissue_sample_name or accession_name) and it must exist in the database already
462                     </p>
463                            
464                     <b>For Intertek SNP Information File:</b>
465                     <br>
466                     <p>The header must be:</p>
467                     <br/>
469                     <table class="table table-hover table-bordered table-condensed" >
470                         <thead></thead>
471                         <tbody>
472                             <tr>
473                                 <td>IntertekSNPID</td>
474                                 <td>CustomerSNPID</td>
475                                 <td>Reference</td>
476                                 <td>Alternate</td>
477                                 <td>Chromosome</td>                                                                                                                                                          <td>Position</td>                                                                                                                                                            <td>Quality</td>
478                                 <td>Filter</td>
479                                 <td>Info</td>
480                                 <td>Format</td>
481                             </tr>
482                         </tbody>
483                     </table>
484                 </div>
485             </div>
486             <div class="modal-footer">
487                 <button id="close_upload_genotyping_intertek_spreadsheet_info_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
488             </div>
489         </div>
490     </div>
491 </div>
494 <style>
496 .ui-autocomplete { z-index:2147483647; }
498 </style>
500 <script>
501 jQuery(document).ready(function(){
503     var upload_genotyping_data_trial_table = jQuery('#upload_genotyping_data_project_search_results').DataTable( {
504         'ajax': {
505             'url':'/ajax/genotyping_data/projects?select_checkbox_name=upload_genotyping_data_project_select',
506         },
507     });
509     var upload_genotyping_data_protocol_table = jQuery('#upload_genotyping_data_protocol_search_results').DataTable( {
510         'ajax': {
511             'url':'/ajax/genotyping_data/protocols?select_checkbox_name=upload_genotyping_data_protocol_select',
512         },
513     });
515     jQuery('#upload_genotyping_data_project_missing_button').click(function(){
516         jQuery('#upload_genotyping_data_project_details').show();
517         return false;
518     });
520     jQuery('#upload_genotyping_data_project_check_button').click(function(){
521         selected = [];
522         jQuery('input[name="upload_genotyping_data_project_select"]:checked').each(function() {
523             selected.push(jQuery(this).val());
524         });
525         if (selected.length > 1){
526             alert('Only select one genotyping project!');
527         } else {
528             if (selected.length == 0 && jQuery('#upload_genotype_vcf_project_name').val() == ''){
529                 alert('Select a genotyping project or create a new one!');
530             } else if (selected.length == 1 && jQuery('#upload_genotype_vcf_project_name').val() != ''){
531                 alert('If you selected a project, do not try to make a new one at the same time!');
532             } else if (selected.length == 1 && jQuery('#upload_genotype_vcf_project_name').val() == ''){
533                 jQuery('#upload_genotype_project_id').val(selected[0]);
534                 Workflow.complete('#upload_genotyping_data_project_check_button');
535                 Workflow.focus('#upload_genotypes_workflow', 2);
536             } else if (selected.length == 0 && jQuery('#upload_genotype_vcf_project_name').val() != '') {
537                 if (jQuery('#upload_genotype_year_select').val() == ''){
538                     alert('Please give a year');
539                 } else if (jQuery('#upload_genotype_vcf_project_description').val() == ''){
540                     alert('Please give a description.');
541                 } else {
542                     jQuery('#upload_genotype_project_id').val(undefined);
543                     Workflow.complete('#upload_genotyping_data_project_check_button');
544                     Workflow.focus('#upload_genotypes_workflow', 2);
545                 }
546             }
547         }
548         return false;
549     });
551     jQuery('#upload_genotyping_data_protocol_missing_button').click(function(){
552         jQuery('#upload_genotype_data_protocol_details').show();
553         return false;
554     });
556     jQuery('#upload_genotyping_data_protocol_check_button').click(function(){
557         selected = [];
558         jQuery('input[name="upload_genotyping_data_protocol_select"]:checked').each(function() {
559             selected.push(jQuery(this).val());
560         });
561         if (selected.length > 1){
562             alert('Only select one genotyping protocol!');
563         } else {
564             if (selected.length == 0 && jQuery('#upload_genotype_vcf_protocol_name').val() == ''){
565                 alert('Select a genotyping protocol or create a new one!');
566             } else if (selected.length == 1 && jQuery('#upload_genotype_vcf_protocol_name').val() != ''){
567                 alert('If you selected a protocol, do not try to make a new one at the same time!');
568             } else if (selected.length == 1 && jQuery('#upload_genotype_vcf_protocol_name').val() == ''){
569                 jQuery('#upload_genotype_protocol_id').val(selected[0]);
570                 Workflow.complete('#upload_genotyping_data_protocol_check_button');
571                 Workflow.focus('#upload_genotypes_workflow', 3);
572             } else if (selected.length == 0 && jQuery('#upload_genotype_vcf_protocol_name').val() != '') {
573                 if (jQuery('#upload_genotype_vcf_reference_genome_name').val() == ''){
574                     alert('Please give a reference genome name.');
575                 } else if (jQuery('#upload_genotypes_species_name_input').val() == ''){
576                     alert('Please give a species name.');
577                 } else {
578                     jQuery('#upload_genotype_protocol_id').val(undefined);
579                     Workflow.complete('#upload_genotyping_data_protocol_check_button');
580                     Workflow.focus('#upload_genotypes_workflow', 3);
581                 }
582             }
583         }
584         return false;
585     });
587     jQuery('#upload_genotype_vcf_spreadsheet_info_format').click(function(){
588         jQuery('#upload_genotype_vcf_spreadsheet_info_format_dialog').modal('show');
589     });
591     jQuery('#upload_genotype_data_format_select').change(function(){
592         var selected_option = jQuery(this).val();
593         if (selected_option == 'vcf') {
594             jQuery('#upload_genotype_data_format_vcf').show();
595             jQuery('#upload_genotype_data_format_intertek').hide();
596         } else if(selected_option == 'intertek') {
597             jQuery('#upload_genotype_data_format_vcf').hide();
598             jQuery('#upload_genotype_data_format_intertek').show();
599         }
600     });
602     jQuery('#upload_genotype_intertek_spreadsheet_info_format').click(function(){
603         jQuery('#upload_genotype_intertek_spreadsheet_info_format_dialog').modal('show');
604     });
608 </script>