Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • AnushaC
    Member
    • Sep 2013
    • 78

    To Give Sequential Input command *******

    Hi Everyone ,
    If I have a directory with a certain extension for exam all bed graph files in a directory how to sequentially take the input . I want give all bedgraph files to command
    unionBedGraphs [OPTIONS] -i FILE1 FILE2 FILE3 ... FILEn like that
    don't say for loop if i use for loop it is giving files recursively
    raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203400.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203401.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203402.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203403.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203404.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203405.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203406.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203407.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203408.sorted.bam
    /raid/development/anusha/python_test/shelltest/fetalbrain_bwa_sortbam/SRR203409.sorted.bam
    anusha@hn:/raid/development/anusha/python_test/shelltest/fetalbrain_bwa_bam> vim bamtbg.copy.sh
    anusha@hn:/raid/development/anusha/python_test
    I did try to use
    name=`ls *bam`
    name2=`echo $name | sed 's/ /,/g'`

    but it worked with command line not a to shell program
    I did try to use
    #!/bin/bash
    #PBS -l nodes=1pn=2
    for file in `ls $1/*.sorted.bam`
    do
    #name=`ls $1/*.sorted.bam`
    IP=`basename $file .sorted.bam`
    chs="/raid/references-andI-indexes/hg19/"
    name2=`echo $file| sed 's/ /,/g'`
    IP1=`basename $name2 .sorted.bam`
    echo $file,$name2,$IP,$IP1

    #genomeCoverageBed -ibam $file -g $chs -bg > $2/$OP
    done

    Still giving me output file by file
    please appreciate the help

    Thanks,
    Anusha.ch
  • bruce01
    Senior Member
    • Mar 2011
    • 160

    #2
    Try:

    files=$(ls *bam)

    you seem to want comma separated (from your sed commands), but the 'unionBedGraphs' is given as space separated list so above should do that. But the $() convention should work to define your list.

    Comment

    • rhinoceros
      Senior Member
      • Apr 2013
      • 372

      #3
      Code:
      for f in ../*.bam
      do
      something with $f
      done
      or if you just want the file name

      Code:
      for f in ../*.bam
      do
      name=$(basename "$f")
      something with $name
      done
      You can e.g. echo $name >> list
      Last edited by rhinoceros; 02-10-2014, 04:29 AM.
      savetherhino.org

      Comment

      Latest Articles

      Collapse

      • GATTACAT
        Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by GATTACAT
        Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
        07-01-2026, 11:43 AM
      • SEQadmin2
        Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by SEQadmin2


        I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

        Here are nine questions we think about, in roughly the order they matter, before...
        06-18-2026, 07:11 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Today, 11:05 AM
      0 responses
      6 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-02-2026, 11:08 AM
      0 responses
      27 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-30-2026, 05:37 AM
      0 responses
      25 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-26-2026, 11:10 AM
      0 responses
      25 views
      0 reactions
      Last Post SEQadmin2  
      Working...