Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample info #17

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Contact information:
* Nextflow version 23.10.0 build 5889
* ffq v0.3
* Trimmomatic v0.39
* jq v1.7.1
* [edirect](https://www.ncbi.nlm.nih.gov/books/NBK25501/)


### Pipeline execution
Expand Down
9 changes: 5 additions & 4 deletions nextflow/bin/sampleinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@

# Creating the file variable from outside the script (from nextflow pipeline or command line flag)
filejs=${1}
jqpth=`which jq`

# Creating variable with BioSample value
bspl=`jq '.[].sample' "$filejs"`; echo BioSample: "${bspl//\"/}"
bspl=`$jqpth '.[].sample' "$filejs"`; echo BioSample: "${bspl//\"/}"

# Creating variable with Accession number
filnm=`jq '.[].accession' "$filejs"`; echo Acession: "${filnm//\"/}"
filnm=`$jqpth '.[].accession' "$filejs"`; echo Acession: "${filnm//\"/}"

# Gathering .json metadata information from Entrez Utilities into variable
smr=`esearch -db biosample -query $bspl | esummary -mode json`

# Parsing attributes information from metadata into variables
## Sample Name
splnm=`echo "$smr" | jq '.. | select(.title?).title'`
splnm=`echo "$smr" | $jqpth '.. | select(.title?).title'`
splnm=${splnm^^}
## Sample Data including all attributes from file
attb=`jq '.. | select(.sampledata?).sampledata' <<< "$smr"`
attb=`$jqpth '.. | select(.sampledata?).sampledata' <<< "$smr"`
attb=${attb##*<Attributes>}
attb=${attb%</Attributes>*}
## Listing each attribute
Expand Down