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
        Understanding Genetic Influence on Infectious Disease
        by seqadmin




        During the COVID-19 pandemic, scientists observed that while some individuals experienced severe illness when infected with SARS-CoV-2, others were barely affected. These disparities left researchers and clinicians wondering what causes the wide variations in response to viral infections and what role genetics plays.

        Jean-Laurent Casanova, M.D., Ph.D., Professor at Rockefeller University, is a leading expert in this crossover between genetics and infectious...
        09-09-2024, 10:59 AM
      • seqadmin
        Addressing Off-Target Effects in CRISPR Technologies
        by seqadmin






        The first FDA-approved CRISPR-based therapy marked the transition of therapeutic gene editing from a dream to reality1. CRISPR technologies have streamlined gene editing, and CRISPR screens have become an important approach for identifying genes involved in disease processes2. This technique introduces targeted mutations across numerous genes, enabling large-scale identification of gene functions, interactions, and pathways3. Identifying the full range...
        08-27-2024, 04:44 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Today, 06:25 AM
      0 responses
      13 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, Yesterday, 01:02 PM
      0 responses
      12 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-18-2024, 06:39 AM
      0 responses
      14 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-11-2024, 02:44 PM
      0 responses
      14 views
      0 likes
      Last Post seqadmin  
      Working...
      X