So i just asked a question : for loop over a list
This works perfectly now and outputs what i need. Now i want to link this to a makefile which should be called per variable in my list like this:
#!/bin/bash
mylist=(
'$(call list_samples,AON_9,NT_1,SC_17)'
'$(call list_samples,AON_10,NT_2,SC_18)'
'$(call list_samples,AON_11,NT_3,SC_19)'
'$(call list_samples,AON_12,NT_4,SC_20)'
'$(call list_samples,AON_13,NT_5,SC_21)'
'$(call list_samples,AON_14,NT_6,SC_22)'
'$(call list_samples,AON_15,NT_7,SC_23)'
'$(call list_samples,AON_16,NT_8,SC_24)'
)
for SAMPLES_out in "${mylist[@]}";
do
make -f make_gene_read_count.mk -n SAMPLES_OUT=\'${SAMPLES_out}\'
done
This give me a make error: make_gene_read_count.mk:5: *** unterminated call to function `call': missing `)'. Stop.
While if i put echo in front of the call to make in my bash script it prints them out like this:
make -f make_gene_read_count.mk -n SAMPLES_OUT='$(call list_samples,AON_9,NT_1,SC_17)'
make -f make_gene_read_count.mk -n SAMPLES_OUT='$(call list_samples,AON_10,NT_2,SC_18)'
make -f make_gene_read_count.mk -n SAMPLES_OUT='$(call list_samples,AON_11,NT_3,SC_19)'
make -f make_gene_read_count.mk -n SAMPLES_OUT='$(call list_samples,AON_12,NT_4,SC_20)'
If i add one of those echos to the commandline the makefile works perfectly. What am i missing?
This is the makefile:
IN_DIR = /data/DIV5/SASC/project-013-motor/analysis/runs/BWA_chipcap/BAMS/namesorted_bams
list_samples = $(shell ls $(IN_DIR)/*$(1)* $(IN_DIR)/*$(2)* $(IN_DIR)/*$(3)* | sed 's/\.namesorted\.bam/\.gene\.read\.count/g')
#SAMPLES_OUT := $(call list_samples,AON_9,NT_1,SC_17)
all: $(SAMPLES_OUT)
GFF := /data/DIV5/SASC/project-013-motor/analysis/runs/BWA_chipcap/BAMS/GFF/H3K4me1.gff
GFF_TEMP := $(GFF).temp.gff
$(GFF_TEMP): $(GFF)
sed 's/\*/./g' $< > $@
%.gene.read.count: %.namesorted.bam $(GFF_TEMP)
htseq-count -t exon -m intersection-strict -f bam -r name -s no $^ > $@
I am also trying to pass 2 variables to my makefile but this does not seem to work properly as well if I do it like this in my bash scripts list:
'$(call list_samples,AON_9,NT_1,SC_17) GFF=/data/DIV5/SASC/project-013-motor/analysis/runs/BWA_chipcap/BAMS/GFF/H3K4me1.gff'
This is the error i'm getting:
qmake: *** No rule to make target `GFF=/data/DIV5/SASC/project-013-motor/analysis/runs/BWA_chipcap/BAMS/GFF/H3K4me1.gff', needed by `all'. Stop.