How to pipe awk of bed file into samtools to extract fasta sequences?

How to pipe awk of bed file into samtools to extract fasta sequences?

1

I have a bed file (seq.bed) that contains “queryID queryStart queryEnd”. Following is the example (the content of seq.bed file).

SRR5892231.6 28 178

SRR5892231.7 4 307

SRR5892231.7 16 307

SRR5892231.9 216 408

I would like to extract out sequences that have at least 100bp in their upstream regions.
if I use the following awk,

awk 'OFS="t" {print $1, $2-100, $2}' seq.bed

how can i use pipe to send the output to samtools for “samtools faidx seq.fna queryID:queryStar-queryEnd“?

Could you please help me figure out how to pass $1, $2-100, and $2 for
samtools faidx seq.fna queryID:queryStar-queryEnd?


bedtools


pipe


samtools


bash

• 32 views

Read more here: Source link