My goal is to compare reads from two different fastq files on a Linux machine. The following are the comparisons to perform:

  1. How many common reads are between the two fastq files?
  2. How many reads are present in one fastq file that are not present in the other? i.e reads that are unique to each file.
  3. Where and how do the sequences differ in both files? Is there a difference in nucleotide base at the end of the sequence(3' end), the start of the sequence(5'end) or is it somewhere in the middle of the sequence? Is there a difference in length of the sequence? If so, what is the length and what is the difference? I would like to get the original sequences plus the difference between them for analysis.
  4. Does the quality score differ? Where and how do the quality of sequences differs?

Any guidance regarding how to approach this question is very appreciated.

Edit: I'm working on paired-end reads from the same individual. What I want to do is to compare different trimming tools from their output.

  • 4
    $\begingroup$ Are you expecting the files to be similar? Are these WGS samples? Targeted? Using the same assay? Are they reads from the same individual? Same species but different individuals? Different species? The details will depend on how many differences you expect. Also, this is a whole project, what do you have so far, and what do you need from us? $\endgroup$
    – terdon
    Commented Oct 17, 2022 at 14:51
  • 1
    $\begingroup$ Are you absolutely sure that comparing the files at this level is the right way to go about answering whatever questions you have? Fastqs have millions and millions of reads, you really want to find the differences on a letter by letter basis? $\endgroup$
    – swbarnes2
    Commented Oct 17, 2022 at 17:38
  • 1
    $\begingroup$ Please show example input files (with enough lines to make the problem obvious), and example output $\endgroup$
    – gringer
    Commented Oct 18, 2022 at 20:35
  • 1
    $\begingroup$ github.com/OpenGene/fastp $\endgroup$ Commented Oct 19, 2022 at 5:12
  • $\begingroup$ I doubt anyone has time nor energy to write full code for you to do this but I would start with Bio.SeqIO from BioPython, you could start here: biostars.org/p/147317 $\endgroup$
    – Avamys
    Commented Oct 22, 2022 at 11:13

1 Answer 1


There are several things you can try. For example, Simka (https://github.com/GATB/simka) is tool that compares the profiles of the genomic content of fastq files and generates several types of plots e.g. heatmap.

Another tool that might be useful is multifastqc (https://multiqc.info/), which aggregates results and has multiple options.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.