Hi everyone! I have a problem with my bash code, which I added down here. I would like to automatize the my RNA-seq workflow and I tried to write this bash code. (I am pretty new in bash and programming.) I expect several steps from my code. These are;
changing the directory into source directory and give me a notification. (It works fine)
creating a file array with finding all files that is named as accepted_hits.bam in source directory and its sub-folder.(Problem occurs here. My code scans all computer and i have a memory error.)
and run featureCounts.
code starts
#!/bin/bash
SOURCE_DIR=$1
TARGET_DIR=$2
echo 'Going to $SOURCE_DIR'
cd $SOURCE_DIR
FILE_ARRAY=/$(locate accepted_hits.bam)
for file in $FILE_ARRAY; do
serial_number=${file}
echo "Working on $serial_number"
mkdir -p $TARGET_DIR/$serial_number
featureCounts -t $SOURCE_DIR/$file -a /home/cilga/Desktop/VPC/ref/hg19/hg19.gtf -o $TARGET_DIR$serial_number done
There's some tools for building pipelines. snakemake, gnu-parallel...etc.
Here's some code for star alignment using gnu-parallel. It works well for me.
I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
Note that you can also post a link to a GitHub gist here directly and it will be rendered.
If you have a gist then I suggest that you replace the text above with a link to your gist. Biostars will automatically get the code from gist and show it in-line.
On a different note: While this is an alternate it is not a solution to the question that OP was asking originally.
Hello everyone, I was able to solve problem with small touches. I am sharing my working code :) Thanks for everyone for your helps.
Just shows the files, literally does nothing else
The
| xargs echo
part does nothing hereShows the path and literally does nothing else
Also, you should always quote your Bash variables..
hi. thank you, for your explanations. I am pretty new in bash and also programming too. I tried to combine things together :( thank you again!