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
                Techniques and Challenges in Conservation Genomics
                by seqadmin



                The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                Avian Conservation
                Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                03-08-2024, 10:41 AM
              • seqadmin
                The Impact of AI in Genomic Medicine
                by seqadmin



                Artificial intelligence (AI) has evolved from a futuristic vision to a mainstream technology, highlighted by the introduction of tools like OpenAI's ChatGPT and Google's Gemini. In recent years, AI has become increasingly integrated into the field of genomics. This integration has enabled new scientific discoveries while simultaneously raising important ethical questions1. Interviews with two researchers at the center of this intersection provide insightful perspectives into...
                02-26-2024, 02:07 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 03-14-2024, 06:13 AM
              0 responses
              32 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-08-2024, 08:03 AM
              0 responses
              72 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-07-2024, 08:13 AM
              0 responses
              80 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-06-2024, 09:51 AM
              0 responses
              68 views
              0 likes
              Last Post seqadmin  
              Working...
              X