This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to write some sequences in a (.fq)-like file?

Hi

I have a DNAStringset containing some sequences of length 25. i want to make an .fq file of it but first i need to add a "specific" header (which stored in a vector) for each read. the data is like this:

A DNAStringSet instance of length 2
 width seq                             names               
 [1]    25 AGCTTTTCATTCTGACTGCAACGGG    coli
 [2]    25 ATTTCCTTACTCAACCCCGAAACGC    coli

And the result that i want is like:

@coli:1500
AGCTTTTCATTCTGACTGCAACGGG
+
XXXXXXXXXXXXXXXXXXXXXXXX
@coli:1700
ATTTCCTTACTCAACCCCGAAACGC
+
XXXXXXXXXXXXXXXXXXXXXXXX

I can simply make each line and write it to file using cat() function but this is really slow for large datasets. so i found writeXStringSet(data,format=".fq") to use. but i can't find how to prepare my object for using this function.

My question is:

How to prepare my file for this function? or is there any other easy and quick way of doing this?

Thanks all

r writexstringset write read io

No offense, but can I ask why you want to do this? Because fastq is a specific format for sequencing reads, so for example the rows for each read are important:

@read meta info
read
+
read quality scores

If you convert this data the way you've outlined in your post, I'm not entirely clear what your plan is for using it.

yeah of course :) , because i want to use bowtie to find some fragments of a genome in another one, so for sending this fragments to bowtie i need to prepare them as a read

1 answer

Oh, you'd be best off using BLASTN actually. There is a command line version as well, besides the one hosted on the NCBI website.

Log in to answer this question.