Skip to content

Python script to extract Biosample metadata to a csv file

License

Notifications You must be signed in to change notification settings

serratus-bio/bs2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bs2csv

Description

Python script to extract metadata for a list of given BioSample ids from the NCBI BioSample database. Data is extracted from XML files and output to a CSV.

Note

CSV output works best when comparing metadata from different BioSamples in the same BioProject as the tag names in the XML will be consistent. Comparing runs from different BioProjects can result in a messy CSV output.

Local Usage

Setup

# [optional] create/load virtualenv
pip install -r requirements.txt

Example usage

python bs2csv.py input_ids.txt 
  • input_ids.txt is a text file containing new line separated NCBI BioSample accession ids

Example usage with flags

python bs2csv.py input_ids.txt  -o metadata_output.csv -v values.txt
  • metadata_output.csv is the name of the desired output file. Defaults to biosample_metadata.csv
  • values.txt is a text file containing new line separated values that are used when extracting metadata
    • only the information from tags found in values.txt will be stored in the output

About

Python script to extract Biosample metadata to a csv file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages