Package: brapi2biosamples
BrAPI 2 BioSamplesCommand Line Interface (CLI) to generate BioSamples ready JSON and to submit samples toBioSamplesusing theBreeding API.
The submission is compliant with theMIAPPE BioSamples validation scheme.PrerequisitesThe credentials of a BioSamples account. Registerhere.The BioSamples account is added to a domain. This domain will be used as a parameter in the CLI.A BrAPI endpoint of version 1.2/1.3 with following endpoints and attributes available:/trials/{trialDbId}/studies/{studyDbId}/germplasm/germplasm/{germplasmDbId}germplasmDbIdcommonCropNamegenusspeciesaccessionNumbergermplasmNameThe trailDbId of a trial you want to submit the data ofPython >=3.5InstallationSimply use following command line to install brapi2biosamples fetcher on linux/macOS:sudo python3 -m pip install git+git://github.com/bedroesb/brapi2biosamples.gitor this command for Windows (be sure that Python is installed):pip install git+git://github.com/bedroesb/brapi2biosamples.gitUsageWhen brapi2biosamples is installed correctly it should be available through the commandbrapi2biosamples. You can easily test which version is installed withbrapi2biosamples -v. The tool has several mandatory options:brapi2biosamples [OPTIONS]OptionDescriptionRequired-v, --versionPrint version number-t, --trialDbIdThe identifier of a trialyes-e, --endpointThe URL towards the BrAPI endpoint, not ending with /yes-d, --dateThe date of sample publication (example:2021-01-20T17:05:13Z)-D, --domainThe domain of your ENA accountyes--draftWhen this flag is given, the samples will not be submitted to BioSamples but exported as JSON--devWhen this flag is given, the samples will be submitted to the dev instance of BioSamples--secretPath to a secret.yml file to deliver the BioSample credentials--updatePath to a tsv file to update submissions--infoPath to a info.yml file to deliver the extra attributes--outputPath to a directory where the JSON files are written to.-h, --helpShow this message and exit.--renameIf the "germplasmDbId" is source specific reconstruct the name with "genus, instituteName and accessionNumber".--decodeSpecify the fields that need to be decode by base64, split by coma. ex -c "field 1, field 2"If the brapi2biosamples CLI is used with  the--draftflag, it will dump the JSON files for submission in the working directory or in an output directory specified by the--outputoption. It is recommended to try out your endpoints this way before actual submission.When the JSON look fine, remove the--draftflag in your command + the--secretoption (mandatory on submission) and samples will be submitted to BioSamples. The--secretoption points towards a .secret.yml file with. Please follow the syntax of the example secret.yml in this repository.It is possible to submit to the BioSamples dev instance for testing purposes by adding the--devflag to your command.If you do not specify the sample publication date with the--dateoption, the current time will be used.After submission a file will be created with all the BioSample accession numbers of the corresponding samples.Injecting extra metadata missing in the BrAPI endpointsNot all BrAPI endpoints contain all the necessary metadata one want submit with his samples. Using the providedinfo.ymlit is possible to hardcode some metadata that could be missing in the endpoint.The fields that are currently supported are:biological material geographic locationsample descriptionontologyTerms_organismorganismUpdating samples in BioSamplesIn order to update the samples, one need to specify a tab separated file of two columns. This file is used as mapping between the germplasmDbId on BrAPI (first column) and the accession on BioSamples (second column). THis way no wrong data is written to the existing samples on BioSamples.Zea_VIB_RIL_8W_1RIL8way___114	SAMEA8409916
Zea_VIB_RIL_8W_10RIL8way___124	SAMEA8409917
Zea_VIB_RIL_8W_11RIL8way___118	SAMEA8409918
Zea_VIB_RIL_8W_12RIL8way___120	SAMEA8409919
Zea_VIB_RIL_8W_13RIL8way___121	SAMEA8409920
....ExamplesMaking BioSample json filesMinimalbrapi2biosamples -t 1 -e "https://pippa.psb.ugent.be/BrAPIPPA/brapi/v1" -D --draft "self.pippa_submission"With output directory definedbrapi2biosamples -t 1 -e "https://pippa.psb.ugent.be/BrAPIPPA/brapi/v1" -D --draft "self.pippa_submission" --output ./test/Submitting the samples to the dev instance of BioSamplesMinimal:brapi2biosamples --dev -e "https://pippa.psb.ugent.be/BrAPIPPA/brapi/v1/" -t 1 -D "self.pippa_submission" --secret .secret.ymlWith with an additionalinfo.ymlfile to inject metadata missing in the BrAPI endpointbrapi2biosamples --dev -e "https://pippa.psb.ugent.be/BrAPIPPA/brapi/v1/" -t 1 -D "self.pippa_submission" --info info.yml --secret .secret.ymlUpdating samples on BioSamplesMinimal:brapi2biosamples -e "https://pippa.psb.ugent.be/BrAPIPPA/brapi/v1/" -t 2 -D "self.PIPPA_samples" --secret.secret.yml  --update 20210315_trial2_submission_details.text