| 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
| |||||||||||
| 22 | $pxf->{histologicalDiagnosis} = dclone( $biosample->{histologicalDiagnosis} ) | ||||||||||
| 23 | 118 | ▶ | if exists $biosample->{histologicalDiagnosis}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | $pxf->{timeOfCollection} = { | ||||||||||
| 25 | timestamp => $biosample->{collectionDate} . 'T00:00:00Z', | ||||||||||
| 26 | } | ||||||||||
| 27 | 118 | ▶ | if exists $biosample->{collectionDate}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 118 | ▶ | if ( ref( $biosample->{measurements} ) eq 'ARRAY' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 40 | 17 | $measurement; | |||||||||
| 41 | 17 | } @{ $biosample->{measurements} } | |||||||||
| 42 | ]; | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 118 | return $pxf; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 136 | 1; | |||||||||