2
$\begingroup$

I have received Illumina sequencing reads for 100 samples. I have 8 R1.fastq.gz and 8 R2.fastq.gz files for each sample in each subfolder. I want to run an MD5 check for all the fastq files in each subfolder.

My folder structure looks like:

/mydata/sequencing/clean
/mydata/sequencing/clean/Sample1
/mydata/sequencing/clean/Sample2
......
/mydata/sequencing/clean/Sample100

I am using the following code being on the /mydata/sequencing/clean directory.

find . -type f -exec md5sum-lite {} \;

This code is printing the md5 result on Terminal.

How do I get these results printed to a .txt file? Besides, is there a more elegant way to do this MD5 check?

Thank you.

$\endgroup$
5
  • $\begingroup$ You posted the same thing in Biostars.org :) biostars.org/p/9509386 $\endgroup$
    – Supertech
    Feb 6, 2022 at 20:49
  • $\begingroup$ Haha yes. Because sometimes I do not get a reply to my questions (may be they are too naive some times) :( $\endgroup$
    – Anik Dutta
    Feb 6, 2022 at 20:55
  • $\begingroup$ Glad you got the answer. $\endgroup$
    – Supertech
    Feb 6, 2022 at 21:01
  • $\begingroup$ thats because its on the wrong stack $\endgroup$
    – pippo1980
    Feb 6, 2022 at 23:51
  • $\begingroup$ Anyways it is always great to receive feedback on bioinformatics problems. Nice to see that many roads lead to Rome. $\endgroup$
    – Anik Dutta
    Feb 7, 2022 at 18:50

1 Answer 1

2
$\begingroup$

Small modification,

find . -type f -exec md5sum-lite {} \; >> output.txt

If you use > the output will almost certainly contain a single record.

$\endgroup$
5
  • 1
    $\begingroup$ Thank you for the prompt reply. Is there any other code that you know of for looping the md5 command over different subfolders? $\endgroup$
    – Anik Dutta
    Feb 6, 2022 at 19:34
  • $\begingroup$ Yes of course ... there are loads of ways to do this. A bash script is good (separate question IMO). However, the > and >> will still be central. In terms of elegance, your one liner looks cool. BTW >> is very likely the solution because of the find approach. One liners are cool BTW. $\endgroup$
    – M__
    Feb 6, 2022 at 19:39
  • 1
    $\begingroup$ Thank you very much. $\endgroup$
    – Anik Dutta
    Feb 6, 2022 at 19:51
  • $\begingroup$ Your welcome. Your second question (alternative code) is worth asking because of the variety of ways it can answered, e.g. a bash for loop, Python subprocessing, Perl one liner are the approaches I can think of. $\endgroup$
    – M__
    Feb 7, 2022 at 1:32
  • 1
    $\begingroup$ Yeah. totally agreed. $\endgroup$
    – Anik Dutta
    Feb 7, 2022 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.