Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • how to use bash script to make iterative loop through directory with two file types

    Well you've all been wonderful about answering my novice questions...so here is another. I thank you in advance for generously providing an answer.

    What I'm trying to do is loop through a directory, using simple bash script, to a set of files and then process the files to a *.sam format using bwa...here's the code I have so far...

    #!bin/bash
    #basic syntax below
    #bwa samse ref.fa aln_sa.sai short_read.fq > aln-se.sam

    module load bwa

    FILE1="$WORK/trimmed/*se.fq"
    FILE2="$WORK/trimmed/*.sai"

    for f in FILE1 and FILE2
    do
    bwa samse whole_genome.fa "$f2".sai "$f1".fq > "$f".sam
    done

  • #2
    how to use bash script to make iterative loop through directory with two file types

    if your *.sai and *se.fq files have the same prefix (presumably you have one file of each type for each bwa alignment you want to run), you could try:

    Code:
    FILE2="$WORK/trimmed/*.sai"
    WORKDIR="$WORK/trimmed/"
    
    for f in $FILE2
    do
    
          prefix=`basename $f .sai`
    
          bwa samse whole_genome.fa ${WORKDIR}${prefix}.sai     ${WORKDIR}${prefix}se.fq > ${WORKDIR}${prefix}.sam
    
    done
    Last edited by mastal; 05-22-2013, 02:41 PM. Reason: corrected error in code

    Comment


    • #3
      Hi Mastal:

      Thank you for the reply, and I will certainly try this out...they do have similar prefixes...

      -Jennifer

      Comment

      Latest Articles

      Collapse

      • 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
      • 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

      ad_right_rmr

      Collapse

      News

      Collapse

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