-
Laurent Gil authored
Parser to create an HTML documentation from the table.sql file.
68674eb0
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
sql2html.pl 17.03 KiB
#!/bin/perl
# 1st Feb 2011
# Generate an HTML documentation page from an SQL file.
#
# It needs to have a "javascript like" documentation above each table. e.g.:
####################################################################################
#/**
#@table variation
#@desc This is the schema's generic representation of a variation.
#@column variation_id Primary key, internal identifier.
#@column source_id Foreign key references to the @link source table.
#@column name Name of the variation. e.g. "rs1333049".
#@column validation_status Variant discovery method and validation from dbSNP.
#@column ancestral_allele Taken from dbSNP to show ancestral allele for the variation.
#@column flipped This is set to 1 if the variant is flipped.
#@column class_so_id Class of the variation, based on the Sequence Ontology.
#@see variation_synonym
#@see flanking_sequence
#@see failed_variation
#@see variation_feature
#@see variation_group_variation
#@see allele
#@see allele_group_allele
#@see individual_genotype_multiple_bp
#*/
#
#
#create table variation (
# variation_id int(10) unsigned not null auto_increment, # PK
# source_id int(10) unsigned not null,
# name varchar(255),
# validation_status SET('cluster','freq','submitter','doublehit','hapmap','1000Genome','failed','precious'),
# ancestral_allele text,
# flipped tinyint(1) unsigned NULL DEFAULT NULL,
# class_so_id ENUM('SO:0001483','SO:1000002','SO:0000667') DEFAULT 'SO:0001059', # default to sequence_alteration
#
# primary key( variation_id ),
# unique ( name ),
# key source_idx (source_id)
#);
########################################################################################
# Tags description:
# /** and */ : begin and end of the document block
# @header : tag to create a group of tables
# @table : name of the sql table
# @desc : description of the role/content of the table, set or info tags
# @column : column_name [tab(s)] Column description. Note: 1 ligne = 1 column
# @see : tables names linked to the described table
# @link : Internal link to an other table description. The format is ... @link table_name ...
# @info : tag to describe additional information about a table or a set of tables
use strict;
use POSIX;
use Getopt::Long;
###############
### Options ###
###############
my ($sql_file,$html_file,$db_team,$header_flag,$sort_headers,$sort_tables,$help);
usage() if (!scalar(@ARGV));
GetOptions(
'i=s' => \$sql_file,
'o=s' => \$html_file,
'd=s' => \$db_team,