Edit format from .fa to .fq
3
0
Entering edit mode
7.2 years ago

Can you teach me how to convert .fa file into .fq file through cmd?

I am really new to linux.

sequence • 3.2k views
ADD COMMENT
1
Entering edit mode

I'm not sure if you are aware of this but I would like to point out that a fasta file does not contain the required information to produce a fastq file. A conversion to something which looks like a fastq is possible as shown by the answers below, but the basecall quality scores will be dummy values and not reflect anything real or relevant.

ADD REPLY
0
Entering edit mode
7.2 years ago
lessismore ★ 1.4k

download this : https://code.google.com/archive/p/fasta-to-fastq/ and : perl fasta_to_fastq.pl reads.fasta > my_converted_fasta.fq

ADD COMMENT
0
Entering edit mode
7.2 years ago

linearize the fasta with awk. Use a second awk to convert to a fastq. Use '#' as the default quality:

awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N++;next;} {printf("%s",$0);} END {printf("\n");}' input.fa  | awk '{L=length($2);printf("@%s\n%s\n+\n",substr($1,2),$2);for(i=0;i<L;++i) printf("#");printf("\n");}'
ADD COMMENT
0
Entering edit mode
7.2 years ago
GenoMax 148k

reformat.sh from BBMap suite. reformat.sh in=your_file.fa out=your_fastq.fq qfake=30 (adjust Q value as desired, it is fake anyway).

ADD COMMENT

Login before adding your answer.

Traffic: 1578 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