Entering edit mode
4.5 years ago
dorra.fass
•
0
Hello,
I'm a beginner in writing script bash. I need your help to execute the featurecounts command for counting purposes for 10 mapped files corresponding to 10 samples located in 10 different directories. Please help me to get a right script. bash start code
#!/bin/bash
SOURCE_DIR_1=$/scratch/mapping_results/1
SOURCE_DIR_2=$/scratch/mapping_results/2
SOURCE_DIR_3=$/scratch/mapping_results/3
SOURCE_DIR_4=$/scratch/mapping_results/4
SOURCE_DIR_5=$/scratch/mapping_results/5
SOURCE_DIR_6=$/scratch/mapping_results/6
SOURCE_DIR_7=$/scratch/mapping_results/7
SOURCE_DIR_8=$/scratch/mapping_results/8
SOURCE_DIR_9=$/scratch/mapping_results/9
SOURCE_DIR_10=$/scratch/mapping_results/10
TARGET_DIR=$/scratch/counting
echo 'Going to $SOURCE_DIR'
cd $SOURCE_DIR
FILE_ARRAY=/$(locate Alignment.sam)
for file in $FILE_ARRAY; do
featureCounts -t $SOURCE_DIR/$file -a /scratch/human/hg19.gtf -o $TARGET_DIR$....
done
If you want to write counts for each sam file, into corresponding count file:
.
Probably you would not need a loop, as featurecounts writes each sample in a separate column. For all the samples (.sam), you can generate one single counts files where in each sample is represented one column with sample name.
thank you so much for your help the script was executed with success
Dear all,
Thank you so much for your responses and for your help I tried the following script
Unfortunaltely i obtained only the counting results of sample 10 not all the samples. What can i do to resolve this problem in order to obtain counting results for each sample? Thanks a lot
How many samples do you have? Are all /scratch/mapping_results/NN? The example only listed 1-10 ...