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
                Recent Advances in Sequencing Analysis Tools
                by seqadmin


                The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
                Today, 07:48 AM
              • seqadmin
                Essential Discoveries and Tools in Epitranscriptomics
                by seqadmin




                The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                04-22-2024, 07:01 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, Today, 07:17 AM
              0 responses
              11 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 05-02-2024, 08:06 AM
              0 responses
              19 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-30-2024, 12:17 PM
              0 responses
              20 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-29-2024, 10:49 AM
              0 responses
              28 views
              0 likes
              Last Post seqadmin  
              Working...
              X