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