Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automated script for paired end sequencing

    Hello everybody,

    I have a folder with paired end sequencing data (divided by the asterisk to make group clearly visible here). I would like to run an automated script, which analyses couple by couple (trimming, mapping and so one). I already introduced placeholders for the single steps, but I don't know how to introduce two file (which belong together) at the same time.
    I would be thankful, if someone had a hint for me.

    10pct-0_S3_R1_001.fastq
    10pct-0_S3_R2_001.fastq
    *
    10pct-0_S7_R1_001.fastq
    10pct-0_S7_R2_001.fastq
    *
    10pct-15_S4_R1_001.fastq
    10pct-15_S4_R2_001.fastq
    *
    10pct-15_S8_R1_001.fastq
    10pct-15_S8_R2_001.fastq



    placeholder1='name1'
    placeholder2='name2'
    placeholder3='beginning_of_the_couple_name'

    for placeholder1 in *; do

    trim_galore ../$placeholder1.fastq ../$placeholder2.fastq -q 20 --paired --phred33
    bowtie2 $bowtie_opts $bowtie_index -1 ../$placeholder1.fq -2 ../$placeholder2.fq > $placeholder3.SAM


    samtools view -bS ../$placeholder3.SAM > $placeholder3.BAM

    samtools sort $placeholder3.BAM Sorted_BAMs/sorted_$placeholder3



    done

  • #2
    You don't need to get both names. Just take the first one use regex to change the _R1_ part or get rid of everything from _R1_

    Try this:

    placeholder1='name1'
    placeholder2=`echo $placeholder1 | sed 's/_R1_/_R2_/g'`
    placeholder3=`echo $placeholder1 | sed 's/_R1_\S\+//g'`

    Comment


    • #3
      Thanks a lot for the quick reply!
      Now i run into the trouble, that i only need to choose every 2nd file.
      I wanted to start by listing all files ending with fastq and putting them into a variable, but this files=*.fastq only returns the first file

      Comment


      • #4
        Rather than:

        placeholder1='name1'
        placeholder2='name2'
        placeholder3='beginning_of_the_couple_name'

        for placeholder1 in *; do

        try:


        for placeholder1 in `ls *_R1_*.fastq`; do

        placeholder2=`echo $placeholder1 | sed 's/_R1_/_R2_/g'`
        placeholder3=`echo $placeholder1 | sed 's/_R1_\S\+//g'`
        Last edited by azneto; 01-07-2016, 08:48 AM.

        Comment


        • #5
          So this will start with this file:
          10pct-0_S3_R1_001.fastq
          use it as placeholder and also use this file for the second placeholder:
          ->10pct-0_S3_R2_001.fastq<-
          Nevertheless, as soon as the first round is finished, it will start over with this file again:
          ->10pct-0_S3_R2_001.fastq<-
          I would need something to skip this file.
          Everything i tried so far totally fails...

          Comment


          • #6
            I've noticed that and changed my reply. Check it out:

            for placeholder1 in `ls *_R1_*.fastq`; do

            Comment


            • #7
              Thanks a lot!
              Sorry, i didn't see that you changed your post.
              This solution is not what i thought of, but it's easy and solves the problem
              Thank you.
              Last edited by Alex852013; 01-07-2016, 09:54 AM.

              Comment

              Latest Articles

              Collapse

              • seqadmin
                Quality Control Essentials for Next-Generation Sequencing Workflows
                by seqadmin




                Like all molecular biology applications, next-generation sequencing (NGS) workflows require diligent quality control (QC) measures to ensure accurate and reproducible results. Proper QC begins at nucleic acid extraction and continues all the way through to data analysis. This article outlines the key QC steps in an NGS workflow, along with the commonly used tools and techniques.

                Nucleic Acid Quality Control
                Preparing for NGS starts with isolating the...
                02-10-2025, 01:58 PM
              • seqadmin
                An Introduction to the Technologies Transforming Precision Medicine
                by seqadmin


                In recent years, precision medicine has become a major focus for researchers and healthcare professionals. This approach offers personalized treatment and wellness plans by utilizing insights from each person's unique biology and lifestyle to deliver more effective care. Its advancement relies on innovative technologies that enable a deeper understanding of individual variability. In a joint documentary with our colleagues at Biocompare, we examined the foundational principles of precision...
                01-27-2025, 07:46 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 02-07-2025, 09:30 AM
              0 responses
              67 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 02-05-2025, 10:34 AM
              0 responses
              104 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 02-03-2025, 09:07 AM
              0 responses
              83 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 01-31-2025, 08:31 AM
              0 responses
              45 views
              0 likes
              Last Post seqadmin  
              Working...
              X