<commit_before># Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#      http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

use strict;
use warnings;
use Data::Dumper;
use Test::More;
use Bio::EnsEMBL::Test::MultiTestDB;

use FindBin qw($Bin);

use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Test::TestUtils;
use Bio::EnsEMBL::Variation::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Variation::Source;
use Bio::EnsEMBL::Variation::Study;
use Bio::EnsEMBL::Variation::Individual;
use Bio::EnsEMBL::Variation::SupportingStructuralVariation;
use Bio::EnsEMBL::Variation::StructuralVariationSample;

my $multi = Bio::EnsEMBL::Test::MultiTestDB->new('homo_sapiens');

my $vdb  = $multi->get_DBAdaptor('variation');

my $svs_adaptor = $vdb->get_StructuralVariationSampleAdaptor;


# test constructor

## need Source object 
my $source_name = 'DGVa';
my $source_id   = 11;

my $source = Bio::EnsEMBL::Variation::Source->new
  (-dbID => $source_id,
   -name => $source_name
);

## need Study object 
my $study_name = 'estd1';

my $study = Bio::EnsEMBL::Variation::Study->new
  (-name       => $study_name,
   -_source_id => $source->dbID
);

## need Individual object 
my $ind_id     = 2105;
my $ind_name   = 'NA18635';
my $ind_gender = 'Male';

my $ind = Bio::EnsEMBL::Variation::Individual->new
  (-dbID        => $ind_id,
   -name        => $ind_name,
   -gender      => $ind_gender
);

## need strain (Individual object)

my $strain_id     = 8675;
my $strain_name   = 'NA19122';
my $strain_gender = 'Male';

my $strain = Bio::EnsEMBL::Variation::Individual->new
  (-dbID        => $strain_id,
   -name        => $strain_name,
   -gender      => $strain_gender
);

## need Supporting Structural Variantion object 
my $ssv_id   = 18294456;
my $ssv_name = 'essv4067';

my $ssv = Bio::EnsEMBL::Variation::SupportingStructuralVariation->new
  (-dbID   => $ssv_id,
   -name   => $ssv_name,
   -study  => $study,
   -source => $source
);


my $dbID = 6107305;

my $svs = Bio::EnsEMBL::Variation::StructuralVariationSample->new
  (-dbID                     => $dbID,
   -_structural_variation_id => $ssv->dbID,
   -individual               => $ind,
   -strain                   => $strain,
   -study                    => $study,
   -adaptor                  => $svs_adaptor
  );

ok($svs->dbID() eq $dbID,                                     'dbID');
ok($svs->structural_variation->variation_name() eq $ssv_name, 'ssv name');
# Individual
ok($svs->individual->name() eq $ind_name,                     'individual name');
ok($svs->individual->gender() eq $ind_gender,                 'individual gender ');
# Strain
ok($svs->strain->name() eq $strain_name,                      'strain name');
ok($svs->strain->gender() eq $strain_gender,                  'strain gender ');
# Study
ok($svs->study->name() eq $study_name ,                       'study name' );

# test structural variation object
my $sv = $svs->structural_variation();
ok($svs->structural_variation($sv), 'structural_variation object (using argument)');<commit_msg>updates to match new sample schema<commit_after># Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#      http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

use strict;
use warnings;
use Data::Dumper;
use Test::More;
use Bio::EnsEMBL::Test::MultiTestDB;

use FindBin qw($Bin);

use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Test::TestUtils;
use Bio::EnsEMBL::Variation::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Variation::Source;
use Bio::EnsEMBL::Variation::Study;
use Bio::EnsEMBL::Variation::Sample;
use Bio::EnsEMBL::Variation::Individual;
use Bio::EnsEMBL::Variation::SupportingStructuralVariation;
use Bio::EnsEMBL::Variation::StructuralVariationSample;

my $multi = Bio::EnsEMBL::Test::MultiTestDB->new('homo_sapiens');

my $vdb  = $multi->get_DBAdaptor('variation');

my $svs_adaptor = $vdb->get_StructuralVariationSampleAdaptor;


# test constructor

## need Source object 
my $source_name = 'DGVa';
my $source_id   = 11;

my $source = Bio::EnsEMBL::Variation::Source->new
  (-dbID => $source_id,
   -name => $source_name
);

## need Study object 
my $study_name = 'estd1';

my $study = Bio::EnsEMBL::Variation::Study->new
  (-name       => $study_name,
   -_source_id => $source->dbID
);

## need Individual object 
my $ind_id     = 2105;
my $ind_name   = 'NA18635';
my $ind_gender = 'Male';

my $ind = Bio::EnsEMBL::Variation::Individual->new
  (-dbID        => $ind_id,
   -name        => $ind_name,
   -gender      => $ind_gender
);

## need strain (Sample object)

my $strain_id     = 8675;
my $strain_name   = 'NA19122';

my $strain = Bio::EnsEMBL::Variation::Sample->new
  (-dbID => $strain_id,
   -name => $strain_name,
   -individual => $ind
);

## need Supporting Structural Variantion object 
my $ssv_id   = 18294456;
my $ssv_name = 'essv4067';

my $ssv = Bio::EnsEMBL::Variation::SupportingStructuralVariation->new
  (-dbID   => $ssv_id,
   -name   => $ssv_name,
   -study  => $study,
   -source => $source
);

my $dbID = 6107305;

my $svs = Bio::EnsEMBL::Variation::StructuralVariationSample->new
  (-dbID                     => $dbID,
   -_structural_variation_id => $ssv->dbID,
   -strain                   => $strain,
   -study                    => $study,
   -adaptor                  => $svs_adaptor
  );

ok($svs->dbID() eq $dbID,                                     'dbID');
ok($svs->structural_variation->variation_name() eq $ssv_name, 'ssv name');
# Individual
ok($svs->strain->individual->name() eq $ind_name,                     'individual name');
ok($svs->strain->individual->gender() eq $ind_gender,                 'individual gender ');
# Strain
ok($svs->strain->name() eq $strain_name,                      'strain name');
# Study
ok($svs->study->name() eq $study_name ,                       'study name' );

# test structural variation object
my $sv = $svs->structural_variation();
ok($svs->structural_variation($sv), 'structural_variation object (using argument)');
{'fraction_non_alphanumeric': 0.14408110809653005, 'fraction_numerical': 0.014850778237898044, 'mean_word_length': 3.5362694300518136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4316579', 'n_tokens_mistral': 2550, 'n_tokens_neox': 2318, 'n_words': 578}