lib/Convert/Pheno/BFF/Biosample.pm

filter: Statementstmt 100% 26 / 26 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.2% 40 / 42 CC 6 SCAR 13.9
CC
6
Cov
97%
biosample_to_phenopacket
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« lib/Convert/Pheno/PXF/ToBFF.pm ↑ Summary lib/Convert/Pheno/Operations.pm »
1 package Convert::Pheno::BFF::Biosample;
2  
3 136 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 136 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 136 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 136 ▶use Storable qw(dclone);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 136 our @EXPORT_OK = qw(biosample_to_phenopacket);
10  
11 118 ▶sub biosample_to_phenopacket {
Subroutine biosample_to_phenopacket: called CC=6 SCAR=17.9
Pod undocumented
12 118 my ($biosample) = @_;
13 my $pxf = {
14 id => $biosample->{id},
15 individualId => $biosample->{individualId},
16 materialSample => dclone( $biosample->{biosampleStatus} ),
17 118 sampleType => dclone( $biosample->{sampleOriginType} ),
18 };
19  
20 $pxf->{sampledTissue} = dclone( $biosample->{sampleOriginDetail} )
21 118 ▶ if exists $biosample->{sampleOriginDetail};
Branch: 1 branch
BranchTrueFalseTotal
if exists $biosample->{"sampleOriginDetail"} 18 100 118
22 $pxf->{histologicalDiagnosis} = dclone( $biosample->{histologicalDiagnosis} )
23 118 ▶ if exists $biosample->{histologicalDiagnosis};
Branch: 1 branch
BranchTrueFalseTotal
if exists $biosample->{"histologicalDiagnosis"} 100 18 118
24 $pxf->{timeOfCollection} = {
25 timestamp => $biosample->{collectionDate} . 'T00:00:00Z',
26 }
27 118 ▶ if exists $biosample->{collectionDate};
Branch: 1 branch
BranchTrueFalseTotal
if exists $biosample->{"collectionDate"} 17 101 118
28  
29 118 ▶ if ( ref( $biosample->{measurements} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $biosample->{"measurements"} eq "ARRAY") 17 101 118
30 $pxf->{measurements} = [
31 map {
32 my $measurement = {
33 assay => dclone( $_->{assayCode} ),
34 17 value => dclone( $_->{measurementValue} ),
35 };
36 $measurement->{timeObserved} = {
37 timestamp => $_->{date} . 'T00:00:00Z',
38 }
39 17 ▶ if exists $_->{date};
Branch: 1 branch
BranchTrueFalseTotal
if exists $_->{"date"} 17 0 17
40 17 $measurement;
41 17 } @{ $biosample->{measurements} }
42 ];
43 }
44  
45 118 return $pxf;
46 }
47  
48 136 1;
« lib/Convert/Pheno/PXF/ToBFF.pm ↑ Summary lib/Convert/Pheno/Operations.pm »