This is a test version of Biostars. For the public version, visit https://www.biostars.org.
convert FASTA into FASTQ using linux

Hiiii....If anyone can please helo me how to convert fasta files into fastq using ubuntu....i shall be very thank ful....

sequence

4 answers

For those who may happen to reach this thread by way of search in future you can convert a fasta file to fastq format using reformat.sh from BBMap suite.

Please remember that the Q-scores created here are fake (example below sets Q-scores to 35 for all bases).

reformat.sh in=test.fa out=fake.fq qfake=35

There is a perl script here

Usage is

perl fasta_to_fastq.pl reads.fasta > my_converted_fasta.fq

Note: This assumes a qual score of 40. Nice tool though!

very nice script, Thank you so much! It also works on Mac!

please, the qual string length is one base longer than the sequence length. Could you advise how to solve it?

Paste your sequence and qual strings here - maybe that will help figure out what's happening.

Hi! The script works unless I use warnings; If I use it, then it gives a warning:

Use of uninitialized value $header in string ne at fasta_to_fastq.pl line 13, <FILE> line 1.

In line 13 is:

if($header ne "") {

Thank you in advance

You'll have to add my $header; somewhere at the top op the script (aka, declare the variable). I would also advise to add use strict; (next to use warnings)

Hi,

FASTQ has more information content than FASTA. The conversion would require that you add some kind of quality scores, most probably some dummy values.

What would really enable us help you better is knowing the purpose behind your quest.

The simplest and fastest is to use seqtk:

seqtk seq -A input.fq > output.fa

OP is thinking FASTA to FASTQ. Is that even possible?

You can convert but... without quality score?

MTE. Which is why I was wondering why OP wants to do this exactly. No tools that *needs* a FASTQ file will make do with a FASTA file's info content.

Yep. Now I'm curious about why the OP wants to do this conversion.. let's wait.

you can always filter out the reads with low quality score from fastq file and then convert to fasta

I'm sorry, what?

I think I conveyed some other impression from my comment. I meant that the reads which are not of good quality , e.g. reads containing mostly NNNNNNN , can be removed from fastq and then to be converted to fasta.

Is it right?

We are talking about the conversion from fasta to fastq, I think you've misunderstood the question.

whoops misread that since it is a strange use case

one can make up quality scores - and it is possible that some tools insist on fastq even though they would not make use of the quality information.

such as k-mer-izers?

Does this work for fasta to fastq? since you wrote fastq > fasta

Ok, It worked, but I am trying to make a sam file from it and im getting a zero file out put with this error. Segmentation fault: 11 could you help?

Please open a separate question for this issue.

I am trying to make a sam file from it

You will need to add a lot more details here.

Log in to answer this question.