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
                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 on Modified Bases...
                Yesterday, 07:01 AM
              • seqadmin
                Current Approaches to Protein Sequencing
                by seqadmin


                Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                04-04-2024, 04:25 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 04-11-2024, 12:08 PM
              0 responses
              55 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 10:19 PM
              0 responses
              51 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 09:21 AM
              0 responses
              45 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-04-2024, 09:00 AM
              0 responses
              55 views
              0 likes
              Last Post seqadmin  
              Working...
              X