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