Cutadapt All Samples Exercise


15 Minutes


Now that we’ve learned the basics of running Cutadapt, we need to trim all the rest of our samples. If you remember from the Computational Foundations course, we learned about using bash variables. Let’s try an exercise where we use a bash variable to trim each one of our FASTQ files.


Instructions:


  • Work independently in the main room, posting any questions that arise to slack.
  • Recommendations for writing your own code:
    • Read function documentation
    • Test out ideas - it’s okay to make mistakes and generate errors
    • Use a search engine to look up errors or recommended solutions using keywords
  • We’ll review possible solutions after time is up as a group.


  • Review Cutadapt’s help page and choose the proper arguments for our Cutadapt command(s).
  • Use a bash variable along with Cutadapt to trim all remaining FASTQ files.
  • Confirm that we have all of our expected output files.


Hint: Using a bash variable allows us to quickly change some arguments in a repeated command, e.g. :

noun="World"
echo "Hello, $noun!"
noun="Class"
echo "Hello, $noun!"
LS0tCnRpdGxlOiAiRXhlcmNpc2UgMDEiCmF1dGhvcjogIlVNIEJpb2luZm9ybWF0aWNzIENvcmUiCm91dHB1dDoKICAgICAgICBodG1sX2RvY3VtZW50OgogICAgICAgICAgICBpbmNsdWRlczoKICAgICAgICAgICAgICAgIGluX2hlYWRlcjogaGVhZGVyLmh0bWwKICAgICAgICAgICAgdGhlbWU6IHBhcGVyCiAgICAgICAgICAgIGZpZ19jYXB0aW9uOiB0cnVlCiAgICAgICAgICAgIG1hcmtkb3duOiBHRk0KICAgICAgICAgICAgY29kZV9kb3dubG9hZDogdHJ1ZQotLS0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KYm9keXsgLyogTm9ybWFsICAqLwogICAgICBmb250LXNpemU6IDE0cHQ7CiAgfQpwcmUgewogIGZvbnQtc2l6ZTogMTJwdAp9Cjwvc3R5bGU+Cgo8YnI+CgojIyBDdXRhZGFwdCBBbGwgU2FtcGxlcyBFeGVyY2lzZQoKPGJyPgoKKioxNSBNaW51dGVzKioKCjxicj4KCk5vdyB0aGF0IHdlJ3ZlIGxlYXJuZWQgdGhlIGJhc2ljcyBvZiBydW5uaW5nIEN1dGFkYXB0LCB3ZSBuZWVkIHR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