How to concatenate samtools output into one single file?
1
0
Entering edit mode
2.0 years ago
tomas4482 ▴ 390

I need to extract the genome sequence of >10000 regions. For one example:

samtools faidx GRCh38.primary_assembly.genome.fa chr12:9074800-9074802

output:

AGA

But there are >10000 output. I don't know how to efficiently concatenate them into one single file just like:

AGA
GTA
GG
ATC
TGG
..
..
..

A possible solution I could find out is adding samtools faidx GRCh38.primary_assembly.genome.fa chr12:9074800-9074802> 1.txt to create >10000 files. Then I concatenate all these files using other scripts. But it looks stupid.

Is there any other way to achieve this purpose? Thank you.

samtools • 471 views
ADD COMMENT
2
Entering edit mode
2.0 years ago
-r, --region-file FILE

    Read regions from a file. Format is chr:from-to, one per line. 
ADD COMMENT
0
Entering edit mode

Thank you so much! I forgot samtools parameters.

ADD REPLY

Login before adding your answer.

Traffic: 2932 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6