thanks for this code, lakhujanivijay! but when i run it, is not actually printing the calculation. is giving me the number of reads followed by /4|bc\n. i've been trying to figure out where this is not working, but i had no success. can someone help? :)
Number of read with fastq file name
I want no. of reads in fastq file with file name, below script can only give no. of reads in fastq file:
File name are like this:
Soil-6_S22_L001.m150-p1.join.fq
Soil-7.m150-p1.join.fq
Soil-8_S32_L001.m150-p1.join.fq
I am interested to get no. of reads with file name like this:
Soil-6 384994
Soil-7 205889
How should I modify below script?
#!/bin/bash
for i in `ls *.fq`; do echo $(cat ${i} | wc -l)/4|bc; done
Kind Regards
• 3,833 views
•
link
3 answers
#!/bin/bash
for i in `ls *.fq`; do file_name=$(basename -s .fq $i); printf "$file_name\t$(cat ${i} | wc -l)/4|bc\n"; done
Explanation
file_name=$(basename -s .fq $i)
basename = linux command to strip directory and suffix from filenames
-s = SUFFIX, remove a trailing SUFFIX
file_name=$(basename -s .fq $i) = remove the suffix .fq from the given file and store the name in the variable called file_name
• 0 views
•
link
• 0 views
•
link
could you help point me out to those programs, @cpad0112? i was searching online for solutions and this was the best i could find. thank you!
• 0 views
•
link
for i in *.fq ; do echo -n "$i " && cat $i | paste - - - - | wc -l ; done
• 0 views
•
link
for i in *.fq; do echo "$( echo $i | perl -pe 's/_.*//') $( grep -c '@' $i)"
• 0 views
•
link
Log in to answer this question.
input fastq:
with awk to print from one file:
from multiple files: