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
        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...
        Today, 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
      37 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      41 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 09:21 AM
      0 responses
      35 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-04-2024, 09:00 AM
      0 responses
      54 views
      0 likes
      Last Post seqadmin  
      Working...
      X