Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • 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

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


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

      • 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...
        04-22-2024, 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, Today, 08:47 AM
      0 responses
      11 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      60 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      59 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 09:21 AM
      0 responses
      54 views
      0 likes
      Last Post seqadmin  
      Working...
      X