Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Python script to parse a FASTQ file !

  • Public
By Abhi 195 days ago
#Python script to parse a FASTQ file and extract basic information such as the sequence identifier, sequence, and quality scores #pip install biopython from Bio import SeqIO def parse_fastq(fastq_file): # Initialize a list to store parsed sequences sequences = [] # Read the sequences from the FASTQ file for record in SeqIO.parse(fastq_file, "fastq"): sequence_info = { "id": record.id, "sequence": str(record.seq), "quality": record.letter_annotations["phred_quality"] } sequences.append(sequence_info) return sequences # Example usage fastq_file = "path/to/your/sequences.fastq" parsed_sequences = parse_fastq(fastq_file) # Print out the parsed sequences for seq in parsed_sequences: print(f"ID: {seq['id']}") print(f"Sequence: {seq['sequence']}") print(f"Quality: {seq['quality']}") print()