We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a74c7d commit 063c311Copy full SHA for 063c311
bin/fastq-peek.sh
@@ -26,3 +26,13 @@ LINE_COUNT=$(wc -l < "$FASTQ_FILE")
26
READ_COUNT=$((LINE_COUNT / 4))
27
28
echo "Number of reads in $FASTQ_FILE: $READ_COUNT"
29
+
30
+# Calculate Percent GC
31
+## Count the number of G and C nucleotides
32
+GC_COUNT=$(grep -E '^[ATCGN]+$' "$FASTQ_FILE" | tr -cd 'GC' | wc -c)
33
+## Count the total number of nucleotides (A, T, C, G)
34
+TOTAL_BASE_COUNT=$(grep -E '^[ATCGN]+$' "$FASTQ_FILE" | tr -cd 'ATCG' | wc -c)
35
+## Calculate the GC content as a percentage
36
+GC_CONTENT=$(awk "BEGIN {print ($GC_COUNT / $TOTAL_BASE_COUNT) * 100}")
37
38
+echo "GC content in $FASTQ_FILE: $GC_CONTENT%"
0 commit comments