| 1 | package Convert::Pheno::PXF::ToBFF::Biosamples; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 137 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 137 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 137 | ▶ | use autodie; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 137 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 137 | ▶ | use Convert::Pheno::Utils::Default qw(get_defaults); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 137 | our @EXPORT_OK = qw(extract_pxf_biosamples map_pxf_to_biosample); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 137 | my $DEFAULT = get_defaults(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 244 | ▶ | sub extract_pxf_biosamples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract_pxf_biosamples: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 244 | my ( $self, $phenopacket, $individual_id ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | return [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | unless exists $phenopacket->{biosamples} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 244 | ▶ | && ref( $phenopacket->{biosamples} ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $phenopacket->{"biosamples"} and ref $phenopacket->{"biosamples"} eq "ARRAY"
MC/DC50%1/2
exists $phenopacket->{"biosamples"} and ref $phenopacket->{"biosamples"} eq "ARRAY"
exists $phenopacket->{"biosamples"}
ref $phenopacket->{"biosamples"} eq "ARRAY"
Truth table66%2/3
A and B
A= exists $phenopacket->{"biosamples"}B= ref $phenopacket->{"biosamples"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 99 | my @biosamples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 99 | for my $biosample ( @{ $phenopacket->{biosamples} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 228 | push @biosamples, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | map_pxf_to_biosample( $self, $biosample, $individual_id ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 99 | return \@biosamples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 230 | ▶ | sub map_pxf_to_biosample { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_pxf_to_biosample: called CC=21 SCAR=30.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 230 | my ( $self, $source, $individual_id ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 230 | my %biosample = %{$source}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 230 | _normalize_biosample_aliases( \%biosample ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | my $mapped = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | id => $biosample{id}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | individualId => $biosample{individualId} // $individual_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | biosampleStatus => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | $biosample{materialSample} // $DEFAULT->{ontology_term}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | sampleOriginType => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | $biosample{sampleType} // $DEFAULT->{ontology_term}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 230 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
$biosample{"individualId"} // $individual_id
$biosample{"materialSample"} // $DEFAULT->{"ontology_term"}
$biosample{"sampleType"} // $DEFAULT->{"ontology_term"}
MC/DC0%0/2
$biosample{"individualId"} // $individual_id
$biosample{"individualId"}
$individual_id
MC/DC0%0/2
$biosample{"materialSample"} // $DEFAULT->{"ontology_term"}
$biosample{"materialSample"}
$DEFAULT->{"ontology_term"}
MC/DC0%0/2
$biosample{"sampleType"} // $DEFAULT->{"ontology_term"}
$biosample{"sampleType"}
$DEFAULT->{"ontology_term"}
Truth table66%2/3
A // B
A= $biosample{"individualId"}B= $individual_id
Truth table66%2/3
A // B
A= $biosample{"materialSample"}B= $DEFAULT->{"ontology_term"}
Truth table66%2/3
A // B
A= $biosample{"sampleType"}B= $DEFAULT->{"ontology_term"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 230 | ▶ | if ( exists $biosample{timeOfCollection} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 145 | my $collection_date = _map_collection_date( $biosample{timeOfCollection} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | my $collection_moment = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 145 | _map_collection_moment( $biosample{timeOfCollection} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 145 | ▶ | $mapped->{collectionDate} = $collection_date if defined $collection_date; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 145 | ▶ | $mapped->{collectionMoment} = $collection_moment if defined $collection_moment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $mapped->{diagnosticMarkers} = $biosample{diagnosticMarkers} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 230 | ▶ | if exists $biosample{diagnosticMarkers}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | $mapped->{histologicalDiagnosis} = $biosample{histologicalDiagnosis} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 230 | ▶ | if exists $biosample{histologicalDiagnosis}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | $mapped->{notes} = $biosample{description} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 230 | ▶ | if exists $biosample{description}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | $mapped->{pathologicalStage} = $biosample{pathologicalStage} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 230 | ▶ | if exists $biosample{pathologicalStage}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | $mapped->{pathologicalTnmFinding} = $biosample{pathologicalTnmFinding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 230 | ▶ | if exists $biosample{pathologicalTnmFinding}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | $mapped->{phenotypicFeatures} = _map_phenotypic_features( $biosample{phenotypicFeatures} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 230 | ▶ | if exists $biosample{phenotypicFeatures}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | $mapped->{sampleOriginDetail} = $biosample{sampledTissue} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 230 | ▶ | if exists $biosample{sampledTissue}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $mapped->{sampleProcessing} = $biosample{sampleProcessing} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 230 | ▶ | if exists $biosample{sampleProcessing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | $mapped->{sampleStorage} = $biosample{sampleStorage} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 230 | ▶ | if exists $biosample{sampleStorage}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $mapped->{tumorGrade} = $biosample{tumorGrade} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 230 | ▶ | if exists $biosample{tumorGrade}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | $mapped->{tumorProgression} = $biosample{tumorProgression} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 230 | ▶ | if exists $biosample{tumorProgression}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | $mapped->{measurements} = _map_measurements( $biosample{measurements} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 230 | ▶ | if exists $biosample{measurements}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | $mapped->{obtentionProcedure} = _map_procedure( $biosample{procedure} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 230 | ▶ | if exists $biosample{procedure}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 230 | my $extra = _build_info_payload( \%biosample ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 230 | ▶ | $mapped->{info} = { phenopacket => $extra } if %{$extra}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 230 | return $mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 230 | ▶ | sub _normalize_biosample_aliases { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_normalize_biosample_aliases: called CC=4 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 230 | my ($biosample) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 230 | my %alias = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | individual_id => 'individualId', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | derived_from_id => 'derivedFromId', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | sampled_tissue => 'sampledTissue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | sample_type => 'sampleType', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | phenotypic_features => 'phenotypicFeatures', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | time_of_collection => 'timeOfCollection', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | histological_diagnosis => 'histologicalDiagnosis', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | tumor_progression => 'tumorProgression', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | tumor_grade => 'tumorGrade', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | pathological_stage => 'pathologicalStage', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | pathological_tnm_finding => 'pathologicalTnmFinding', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | diagnostic_markers => 'diagnosticMarkers', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | material_sample => 'materialSample', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | sample_processing => 'sampleProcessing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | sample_storage => 'sampleStorage', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 230 | for my $source_key ( keys %alias ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 3450 | my $target_key = $alias{$source_key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 3450 | ▶ | next unless exists $biosample->{$source_key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | next if exists $biosample->{$target_key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $biosample->{$target_key} = delete $biosample->{$source_key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 230 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 145 | ▶ | sub _map_collection_date { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_collection_date: called CC=8 SCAR=24.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 145 | my ($time) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 145 | ▶ | return unless defined $time; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | return substr( $time->{timestamp}, 0, 10 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 145 | ▶ | if ref($time) eq 'HASH' && exists $time->{timestamp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $time eq "HASH" and exists $time->{"timestamp"}
MC/DC50%1/2
ref $time eq "HASH" and exists $time->{"timestamp"}
ref $time eq "HASH"
exists $time->{"timestamp"}
Truth table66%2/3
A and B
A= ref $time eq "HASH"B= exists $time->{"timestamp"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | return substr( $time->{interval}{start}, 0, 10 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | if ref($time) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | && exists $time->{interval} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | && ref( $time->{interval} ) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 144 | ▶ | && exists $time->{interval}{start}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
ref $time eq "HASH" and exists $time->{"interval"} and ref $time->{"interval"} eq "HASH" and exists $time->{"interval"}{"start"}
ref $time eq "HASH" and exists $time->{"interval"} and ref $time->{"interval"} eq "HASH"
ref $time eq "HASH" and exists $time->{"interval"}
MC/DC0%0/4
ref $time eq "HASH" and exists $time->{"interval"} and ref $time->{"interval"} eq "HASH" and exists $time->{"interval"}{"start"}
ref $time eq "HASH"
exists $time->{"interval"}
ref $time->{"interval"} eq "HASH"
exists $time->{"interval"}{"start"}
Truth table20%1/5
A and B and C and D
A= ref $time eq "HASH"B= exists $time->{"interval"}C= ref $time->{"interval"} eq "HASH"D= exists $time->{"interval"}{"start"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 144 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 145 | ▶ | sub _map_collection_moment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_collection_moment: called CC=6 SCAR=24.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 145 | my ($time) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 145 | ▶ | return unless defined $time && ref($time) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $time and ref $time eq "HASH"
MC/DC0%0/2
defined $time and ref $time eq "HASH"
defined $time
ref $time eq "HASH"
Truth table33%1/3
A and B
A= defined $timeB= ref $time eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | return $time->{age}{iso8601duration} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | if exists $time->{age} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | && ref( $time->{age} ) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 145 | ▶ | && exists $time->{age}{iso8601duration}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $time->{"age"} and ref $time->{"age"} eq "HASH" and exists $time->{"age"}{"iso8601duration"}
exists $time->{"age"} and ref $time->{"age"} eq "HASH"
MC/DC0%0/3
exists $time->{"age"} and ref $time->{"age"} eq "HASH" and exists $time->{"age"}{"iso8601duration"}
exists $time->{"age"}
ref $time->{"age"} eq "HASH"
exists $time->{"age"}{"iso8601duration"}
Truth table25%1/4
A and B and C
A= exists $time->{"age"}B= ref $time->{"age"} eq "HASH"C= exists $time->{"age"}{"iso8601duration"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 37 | ▶ | sub _map_phenotypic_features { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_phenotypic_features: called CC=13 SCAR=28.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 37 | my ($features) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 37 | ▶ | return unless ref($features) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 37 | my @mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 37 | for my $feature ( @{$features} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 55 | ▶ | next unless ref($feature) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 55 | my %mapped = %{$feature}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 55 | ▶ | $mapped{featureType} = delete $mapped{type} if exists $mapped{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 55 | ▶ | if ( exists $mapped{evidence} && ref( $mapped{evidence} ) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $mapped{"evidence"} and ref $mapped{"evidence"} eq "ARRAY"
MC/DC50%1/2
exists $mapped{"evidence"} and ref $mapped{"evidence"} eq "ARRAY"
exists $mapped{"evidence"}
ref $mapped{"evidence"} eq "ARRAY"
Truth table66%2/3
A and B
A= exists $mapped{"evidence"}B= ref $mapped{"evidence"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | for my $evidence ( @{ $mapped{evidence} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | ▶ | next unless ref($evidence) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | $evidence->{reference}{notes} = delete $evidence->{reference}{description} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | if exists $evidence->{reference} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | && ref( $evidence->{reference} ) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | && exists $evidence->{reference}{description} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | && !exists $evidence->{reference}{notes}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
exists $evidence->{"reference"} and ref $evidence->{"reference"} eq "HASH" and exists $evidence->{"reference"}{"description"} and not exists $evidence->{"reference"}{"notes"}
exists $evidence->{"reference"} and ref $evidence->{"reference"} eq "HASH" and exists $evidence->{"reference"}{"description"}
exists $evidence->{"reference"} and ref $evidence->{"reference"} eq "HASH"
MC/DC0%0/4
exists $evidence->{"reference"} and ref $evidence->{"reference"} eq "HASH" and exists $evidence->{"reference"}{"description"} and not exists $evidence->{"reference"}{"notes"}
exists $evidence->{"reference"}
ref $evidence->{"reference"} eq "HASH"
exists $evidence->{"reference"}{"description"}
not exists $evidence->{"reference"}{"notes"}
Truth table20%1/5
A and B and C and not(D)
A= exists $evidence->{"reference"}B= ref $evidence->{"reference"} eq "HASH"C= exists $evidence->{"reference"}{"description"}D= not exists $evidence->{"reference"}{"notes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 55 | push @mapped, \%mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 37 | return \@mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 19 | ▶ | sub _map_measurements { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_measurements: called CC=10 SCAR=25.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 19 | my ($measurements) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 19 | ▶ | return unless ref($measurements) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 19 | my @mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 19 | for my $measurement ( @{$measurements} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 19 | ▶ | next unless ref($measurement) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 19 | my %mapped = %{$measurement}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 19 | ▶ | $mapped{assayCode} = delete $mapped{assay} if exists $mapped{assay}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 19 | ▶ | $mapped{measurementValue} = delete $mapped{value} if exists $mapped{value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | $mapped{measurementValue} = delete $mapped{complexValue} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 19 | ▶ | if !exists $mapped{measurementValue} && exists $mapped{complexValue}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $mapped{"measurementValue"} and exists $mapped{"complexValue"}
MC/DC0%0/2
not exists $mapped{"measurementValue"} and exists $mapped{"complexValue"}
not exists $mapped{"measurementValue"}
exists $mapped{"complexValue"}
Truth table33%1/3
not(A) and B
A= not exists $mapped{"measurementValue"}B= exists $mapped{"complexValue"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $mapped{observationMoment} = delete $mapped{timeObserved} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 19 | ▶ | if exists $mapped{timeObserved}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | $mapped{procedure} = _map_procedure( $mapped{procedure} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 19 | ▶ | if exists $mapped{procedure}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 19 | push @mapped, \%mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 19 | return \@mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 181 | ▶ | sub _map_procedure { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_procedure: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 181 | my ($procedure) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 181 | ▶ | return unless ref($procedure) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 181 | my %mapped = %{$procedure}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 181 | ▶ | $mapped{procedureCode} = delete $mapped{code} if exists $mapped{code}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 181 | ▶ | if ( exists $mapped{performed} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 37 | my $performed = delete $mapped{performed}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 37 | ▶ | if ( ref($performed) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | $mapped{ageAtProcedure} = $performed->{age} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 37 | ▶ | if exists $performed->{age}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | $mapped{dateOfProcedure} = substr( $performed->{timestamp}, 0, 10 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 37 | ▶ | if exists $performed->{timestamp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 181 | return \%mapped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 230 | ▶ | sub _build_info_payload { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_info_payload: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 230 | my ($biosample) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 230 | my %info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 230 | for my $key ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | derivedFromId | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | taxonomy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | timeOfCollection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | procedure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | measurements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | sampledTissue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | sampleType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | materialSample | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | phenotypicFeatures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | pathologicalStage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | pathologicalTnmFinding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | diagnosticMarkers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | histologicalDiagnosis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | tumorProgression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | tumorGrade | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | sampleProcessing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | sampleStorage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 4370 | ▶ | $info{$key} = $biosample->{$key} if exists $biosample->{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 230 | return \%info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 137 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||