SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
RNA-Seq: Sequential stopping for high-throughput experiments. Newsbot! Literature Watch 0 08-22-2012 02:00 AM
BWA Combined Reference vs sequential alignment Tomi Bioinformatics 1 01-17-2012 01:51 PM
Cuffcompare/cuffdiff changes FPKM values of same BAM in sequential runs SEQond RNA Sequencing 2 10-17-2011 06:42 AM
Why does "Input" sample give a sharp peak around TSS? lee_sh Illumina/Solexa 4 07-05-2011 07:51 AM
PubMed: Sequential DNA methylation changes are associated with DNMT3B overexpression Newsbot! Literature Watch 0 11-12-2010 02:00 AM

Reply
 
Thread Tools
Old 02-08-2014, 06:52 PM   #1
AnushaC
Member
 
Location: San Diego

Join Date: Sep 2013
Posts: 78
Default 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
AnushaC is offline   Reply With Quote
Old 02-10-2014, 01:55 AM   #2
bruce01
Senior Member
 
Location: .

Join Date: Mar 2011
Posts: 157
Default

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.
bruce01 is offline   Reply With Quote
Old 02-10-2014, 02:59 AM   #3
rhinoceros
Senior Member
 
Location: sub-surface moon base

Join Date: Apr 2013
Posts: 372
Default

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
__________________
savetherhino.org

Last edited by rhinoceros; 02-10-2014 at 03:29 AM.
rhinoceros is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:24 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO