Question: Concatenation of Samtools Faidx - 60nt limit by line
gravatar for ryan.leenay
21 months ago by
ryan.leenay0 wrote:


I am attempting to use samtools faidx to pull down a sequence to do some visualization in R. My current code reads:

(within R)

system(sprintf("samtools faidx Genome/hg38.fa chr:36287064-36287162,intern = TRUE)[[2]])

But unfortunately, the R only outputs the first 60 nucleotides. When I run the samtools faidx function on command line, I can see that the second line is below the first 60nt.

Is there a samtools option I can specify to have it be on a single line? I can write an R script to figure that out, but I would like to avoid that, as this range/size will change and not all ranges will be over multiple lines.

Thank you!

samtools sequence R • 576 views
ADD COMMENTlink modified 21 months ago by Carlo Yague4.6k • written 21 months ago by ryan.leenay0
gravatar for Carlo Yague
21 months ago by
Carlo Yague4.6k
Carlo Yague4.6k wrote:

There is no built-in option in samtools faidx to output an one-line fasta. However you can pipe the output into awk to get the desired format, as explained in this thread.

ADD COMMENTlink written 21 months ago by Carlo Yague4.6k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2114 users visited in the last hour