Do you want to learn how to rename samples in FastQC? FastQC is a free software to perform quality control of reads in fastq format.
Tool used
In this post, we will use the following version of FastQC:
fastqc --version
FastQC v0.12.1
Method 1
According to the INSTALL.txt file, we should use the command below to stream data from STDIN into FastQC and to use “myreport” as sample name:
zcat myfile.fastq.gz | fastqc stdin:myreport
Method 2
However, if your FastQC version or your cluster does not allow the use of the first method, you can rename your samples manually using the following script:
old_name="Sample_1_S323_L001_R1_001"
new_name="Sample_1"
fastqc --extract --nogroup ${old_name}.fastq.gz
rm ${old_name}_fastqc.zip
mv ${old_name}_fastqc ${new_name}_fastqc
mv ${old_name}_fastqc.html ${new_name}_fastqc.html
sed -i "s|${old_name}.fastq.gz|${new_name}|g" ${new_name}_fastqc/fastqc.fo
sed -i "s|${old_name}.fastq.gz|${new_name}|g" ${new_name}_fastqc/fastqc_data.txt
sed -i "s|${old_name}.fastq.gz|${new_name}|g" ${new_name}_fastqc/fastqc_report.html
sed -i "s|${old_name}.fastq.gz|${new_name}|g" ${new_name}_fastqc/summary.txt
sed -i "s|${old_name}.fastq.gz|${new_name}|g" ${new_name}_fastqc.html
zip -r ${new_name}_fastqc.zip ${new_name}_fastqc
rm -r ${new_name}_fastqc
Conclusion
In conclusion, it is possible to change the sample names in FastQC, whether during or after the function call. Which method did you use?