From 421a76ead99c3cd4926fec0abedfe606112f17c3 Mon Sep 17 00:00:00 2001 From: Marina Gourtovaia Date: Mon, 28 Sep 2020 21:17:15 +0100 Subject: [PATCH 1/2] new table for ampliconstats data --- Changes | 4 + MANIFEST | 1 + .../Schema/Result/IseqProductAmpliconstat.pm | 347 ++++++++++++++++++ .../Schema/Result/IseqProductMetric.pm | 19 +- scripts/update_schema_6.12.0.sql | 36 ++ 5 files changed, 405 insertions(+), 2 deletions(-) create mode 100644 lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductAmpliconstat.pm create mode 100644 scripts/update_schema_6.12.0.sql diff --git a/Changes b/Changes index 29c921e..7976b76 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ LIST OF CHANGES --------------- + - a new iseq_product_ampliconstats table to store per sample + per amplicon statistics that is generated by 'samtools + ampliconstats' + release 6.11.0 - iseq_heron_product_metrics table: set index on the id_run column, diff --git a/MANIFEST b/MANIFEST index 0635360..dde80f9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -14,6 +14,7 @@ lib/WTSI/DNAP/Warehouse/Schema/Result/CgapSupplierBarcode.pm lib/WTSI/DNAP/Warehouse/Schema/Result/FlgenPlate.pm lib/WTSI/DNAP/Warehouse/Schema/Result/IseqFlowcell.pm lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductMetric.pm +lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductAmpliconstat.pm lib/WTSI/DNAP/Warehouse/Schema/Result/IseqHeronProductMetric.pm lib/WTSI/DNAP/Warehouse/Schema/Result/IseqExternalProductMetric.pm lib/WTSI/DNAP/Warehouse/Schema/Result/IseqExternalProductComponent.pm diff --git a/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductAmpliconstat.pm b/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductAmpliconstat.pm new file mode 100644 index 0000000..b7a983a --- /dev/null +++ b/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductAmpliconstat.pm @@ -0,0 +1,347 @@ + +package WTSI::DNAP::Warehouse::Schema::Result::IseqProductAmpliconstat; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +WTSI::DNAP::Warehouse::Schema::Result::IseqProductAmpliconstat + +=head1 DESCRIPTION + +Some of per sample per amplicon metrics generated by samtools ampliconstats + +=cut + +use strict; +use warnings; + +use Moose; +use MooseX::NonMoose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->load_components('InflateColumn::DateTime'); + +=head1 TABLE: C + +=cut + +__PACKAGE__->table('iseq_product_ampliconstats'); + +=head1 ACCESSORS + +=head2 id_iseq_pr_astats_tmp + + data_type: 'bigint' + extra: {unsigned => 1} + is_auto_increment: 1 + is_nullable: 0 + +Internal to this database id, value can change + +=head2 created + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + default_value: 'CURRENT_TIMESTAMP' + is_nullable: 1 + +Datetime this record was created + +=head2 last_changed + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + default_value: 'CURRENT_TIMESTAMP' + is_nullable: 1 + +Datetime this record was created or changed + +=head2 id_iseq_product + + data_type: 'char' + is_foreign_key: 1 + is_nullable: 0 + size: 64 + +Product id, a foreign key into iseq_product_metrics table + +=head2 primer_panel + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +A string uniquely identifying the primer panel + +=head2 primer_panel_num_amplicons + + data_type: 'smallint' + extra: {unsigned => 1} + is_nullable: 0 + +Total number of amplicons in the primer panel + +=head2 amplicon_index + + data_type: 'smallint' + extra: {unsigned => 1} + is_nullable: 0 + +Amplicon index (position) in the primer panel, from 1 to the value of primer_panel_num_amplicons + +=head2 pp_name + + data_type: 'varchar' + is_nullable: 0 + size: 40 + +Name of the portable pipeline that generated the data + +=head2 pp_version + + data_type: 'varchar' + is_nullable: 1 + size: 40 + +Version of the portable pipeline and/or samtools that generated the data + +=head2 metric_fpcov_1 + + data_type: 'decimal' + is_nullable: 1 + size: [5,2] + +Coverage percent at depth 1 + +=head2 metric_fpcov_10 + + data_type: 'decimal' + is_nullable: 1 + size: [5,2] + +Coverage percent at depth 10 + +=head2 metric_fpcov_20 + + data_type: 'decimal' + is_nullable: 1 + size: [5,2] + +Coverage percent at depth 20 + +=head2 metric_fpcov_100 + + data_type: 'decimal' + is_nullable: 1 + size: [5,2] + +Coverage percent at depth 100 + +=head2 metric_freads + + data_type: 'integer' + extra: {unsigned => 1} + is_nullable: 1 + +Number of aligned filtered reads + +=cut + +__PACKAGE__->add_columns( + 'id_iseq_pr_astats_tmp', + { + data_type => 'bigint', + extra => { unsigned => 1 }, + is_auto_increment => 1, + is_nullable => 0, + }, + 'created', + { + data_type => 'datetime', + datetime_undef_if_invalid => 1, + default_value => 'CURRENT_TIMESTAMP', + is_nullable => 1, + }, + 'last_changed', + { + data_type => 'datetime', + datetime_undef_if_invalid => 1, + default_value => 'CURRENT_TIMESTAMP', + is_nullable => 1, + }, + 'id_iseq_product', + { data_type => 'char', is_foreign_key => 1, is_nullable => 0, size => 64 }, + 'primer_panel', + { data_type => 'varchar', is_nullable => 0, size => 255 }, + 'primer_panel_num_amplicons', + { data_type => 'smallint', extra => { unsigned => 1 }, is_nullable => 0 }, + 'amplicon_index', + { data_type => 'smallint', extra => { unsigned => 1 }, is_nullable => 0 }, + 'pp_name', + { data_type => 'varchar', is_nullable => 0, size => 40 }, + 'pp_version', + { data_type => 'varchar', is_nullable => 1, size => 40 }, + 'metric_fpcov_1', + { data_type => 'decimal', is_nullable => 1, size => [5, 2] }, + 'metric_fpcov_10', + { data_type => 'decimal', is_nullable => 1, size => [5, 2] }, + 'metric_fpcov_20', + { data_type => 'decimal', is_nullable => 1, size => [5, 2] }, + 'metric_fpcov_100', + { data_type => 'decimal', is_nullable => 1, size => [5, 2] }, + 'metric_freads', + { data_type => 'integer', extra => { unsigned => 1 }, is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key('id_iseq_pr_astats_tmp'); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint( + 'iseq_hrm_digest_unq', + ['id_iseq_product', 'primer_panel', 'amplicon_index'], +); + +=head1 RELATIONS + +=head2 iseq_product + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + 'iseq_product', + 'WTSI::DNAP::Warehouse::Schema::Result::IseqProductMetric', + { id_iseq_product => 'id_iseq_product' }, + { is_deferrable => 1, on_delete => 'NO ACTION', on_update => 'NO ACTION' }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-09-29 13:29:47 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BU6yKQbGElrb3nXbK9ZqIA + +our $VERSION = '0'; + +=head1 RELATIONS + +=head2 iseq_heron_product_metric + +Type: belongs_to + +Related object: L + +This relationship is created for convenience. Products in this table might not +necessary be present in the iseq_heron_product_metrics table. + +=cut + +__PACKAGE__->belongs_to( + 'iseq_heron_product_metric', + 'WTSI::DNAP::Warehouse::Schema::Result::IseqProductMetric', + { id_iseq_product => 'id_iseq_product' }, + { is_deferrable => 1, on_delete => 'NO ACTION', on_update => 'NO ACTION' }, +); + +__PACKAGE__->meta->make_immutable; +1; + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +Result class definition in DBIx binding for the multi-lims warehouse database. + +=head1 DIAGNOSTICS + +=head1 CONFIGURATION AND ENVIRONMENT + +=head1 SUBROUTINES/METHODS + +=head1 DEPENDENCIES + +=over + +=item strict + +=item warnings + +=item Moose + +=item MooseX::NonMoose + +=item MooseX::MarkAsMethods + +=item DBIx::Class::Core + +=item DBIx::Class::InflateColumn::DateTime + +=back + +=head1 INCOMPATIBILITIES + +=head1 BUGS AND LIMITATIONS + +=head1 AUTHOR + +Marina Gourtovaia Emg8@sanger.ac.ukE + +=head1 LICENSE AND COPYRIGHT + +Copyright (C) 2020 Genome Research Ltd. + +This file is part of the ml_warehouse package L. + +NPG is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=cut diff --git a/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductMetric.pm b/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductMetric.pm index 55c1d91..a51eda2 100644 --- a/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductMetric.pm +++ b/lib/WTSI/DNAP/Warehouse/Schema/Result/IseqProductMetric.pm @@ -885,6 +885,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 iseq_product_ampliconstats + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + 'iseq_product_ampliconstats', + 'WTSI::DNAP::Warehouse::Schema::Result::IseqProductAmpliconstat', + { 'foreign.id_iseq_product' => 'self.id_iseq_product' }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 iseq_product_components Type: has_many @@ -938,8 +953,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-07-16 16:20:22 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7bfqP9vnlQ7g6s17gXNkrA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-09-29 10:33:58 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+RvmRk17x23bviWalcUgGw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/scripts/update_schema_6.12.0.sql b/scripts/update_schema_6.12.0.sql new file mode 100644 index 0000000..0420ccb --- /dev/null +++ b/scripts/update_schema_6.12.0.sql @@ -0,0 +1,36 @@ +CREATE TABLE `iseq_product_ampliconstats` ( + `id_iseq_pr_astats_tmp` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT \ + COMMENT 'Internal to this database id, value can change', + `created` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT \ + 'Datetime this record was created', + `last_changed` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP \ + COMMENT 'Datetime this record was created or changed', + `id_iseq_product` CHAR(64) NOT NULL COMMENT \ + 'Product id, a foreign key into iseq_product_metrics table', + `primer_panel` VARCHAR(255) NOT NULL COMMENT \ + 'A string uniquely identifying the primer panel', + `primer_panel_num_amplicons` SMALLINT UNSIGNED NOT NULL COMMENT \ + 'Total number of amplicons in the primer panel', + `amplicon_index` SMALLINT UNSIGNED NOT NULL COMMENT + 'Amplicon index (position) in the primer panel, from 1 to the value of primer_panel_num_amplicons', + `pp_name` varchar(40) NOT NULL COMMENT + 'Name of the portable pipeline that generated the data', + `pp_version` varchar(40) DEFAULT NULL COMMENT + 'Version of the portable pipeline and/or samtools that generated the data', + `metric_FPCOV_1` DECIMAL(5,2) DEFAULT NULL COMMENT \ + 'Coverage percent at depth 1', + `metric_FPCOV_10` DECIMAL(5,2) DEFAULT NULL COMMENT \ + 'Coverage percent at depth 10', + `metric_FPCOV_20` DECIMAL(5,2) DEFAULT NULL COMMENT \ + 'Coverage percent at depth 20', + `metric_FPCOV_100` DECIMAL(5,2) DEFAULT NULL COMMENT \ + 'Coverage percent at depth 100', + `metric_FREADS` INT UNSIGNED DEFAULT NULL COMMENT \ + 'Number of aligned filtered reads', + PRIMARY KEY (`id_iseq_pr_astats_tmp`), + KEY `iseq_pastats_amplicon` (`primer_panel_num_amplicons`, `amplicon_index`), + CONSTRAINT `iseq_pastats_prm_fk` FOREIGN KEY (`id_iseq_product`) \ + REFERENCES `iseq_product_metrics` (`id_iseq_product`) ON DELETE NO ACTION ON UPDATE NO ACTION, + UNIQUE KEY `iseq_hrm_digest_unq`(`id_iseq_product`, `primer_panel`, `amplicon_index`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci \ + COMMENT='Some of per sample per amplicon metrics generated by samtools ampliconstats'; From 944ebf45c28d1c2683dc0be8ccd85e915b54baa4 Mon Sep 17 00:00:00 2001 From: mgcam Date: Tue, 6 Oct 2020 16:58:39 +0100 Subject: [PATCH 2/2] Changes file update for release 6.12.0 --- Changes | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes b/Changes index 7976b76..61eac87 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ LIST OF CHANGES --------------- +release 6.12.0 - a new iseq_product_ampliconstats table to store per sample per amplicon statistics that is generated by 'samtools ampliconstats'