Info
🌱 來自:bioinfo
fastq_files
- A typical FASTQ identifier line of the reads generated by an illumine instrument looks as follows:
@<instrument>:<run num>:<flowcell ID>:<lane>:<tile>:<x>:<y>:<UMI> <read>:<filtered>:<control num>:<index>
The following command line will count the number of records stored in the FASTQ files
cat SRR030834.fastq | echo $((`wc -l`/4))
If we need to display the file name and read count for multiple files, with the “.fastq” file name extension, in a directory, we can use the following script
for filename in *.fastq;
do
echo -e "$filename\t `cat $filename | wc -l | awk '{print $1 / 4}'`"
這個命令包含了幾個不同的部分:
-
echo -e
: 這個命令用於輸出文本到終端。-e
選項表示啟用特殊字符的解析,例如\t
會被解析為 tab 字符。 -
"$filename\t
: 在echo
中,$filename
是一個變量,它代表著檔案的名稱。"\t"
是一個特殊的 escape sequence,表示插入一個 tab 字符。 -
cat $filename | wc -l | awk '{print $1 / 4}'
: 這部分命令是用來計算檔案中行數的四分之一。具體來說:cat $filename
會將檔案的內容輸出到標準輸出。wc -l
會計算輸入中的行數。awk '{print $1 / 4}'
會將wc -l
命令的輸出作為輸入,並將其第一個字段(即行數)除以 4,然後輸出結果。
總體來說,這個命令的目的是輸出檔案的名稱,後面跟著一個 tab 字符,然後是該檔案中行數的四分之一。