This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Concatenation of Samtools Faidx - 60nt limit by line

Hello,

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 r sequence

1 answer

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.

Log in to answer this question.