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
                Strategies for Sequencing Challenging Samples
                by seqadmin


                Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                03-22-2024, 06:39 AM
              • 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

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 03-27-2024, 06:37 PM
              0 responses
              13 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-27-2024, 06:07 PM
              0 responses
              11 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-22-2024, 10:03 AM
              0 responses
              53 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-21-2024, 07:32 AM
              0 responses
              69 views
              0 likes
              Last Post seqadmin  
              Working...
              X