@@ -19,9 +19,9 @@ mkdir -p Phylogeny/
1919 /^>/ {next} # Skip header lines
2020 {
2121 # Process sequence lines
22- for (i = 1; i <= length(\ $0); i++) {
22+ for (i = 1; i <= length($0); i++) {
2323 position++
24- print position "\t" substr(\ $0, i, 1) >> "' " ${lineage} .tmp.fasta_positions.tab" ' "
24+ print position "\t" substr($0, i, 1) >> "' " ${lineage} .tmp.fasta_positions.tab" ' "
2525 }
2626 }' " ${lineage} .tmp.fasta"
2727
@@ -30,22 +30,22 @@ mkdir -p Phylogeny/
3030
3131# 3. obtain the reference positions (H37Rv) for the cluster positions
3232 for i in ` cat ${lineage} .tmp.fasta_positions` ; do
33- sed -n \ $(( i+ 2 )) ' p' ${tab} | cut -f3
33+ sed -n $(( i+ 2 )) ' p' ${tab} | cut -f3
3434 done > ${lineage} .tmp_refseq
3535
3636# 4. convert column into fasta
3737 paste -s -d " " ${lineage} .tmp_refseq | sed ' 1i >H37Rv' > Phylogeny/${lineage} .ref-H37Rv.fasta
3838
3939# 5. get the genomic positions of the SNPs
4040 while read -r position; do
41- sed -n \ $(( position+ 2 )) ' p' ${tab} | cut -f 1;
41+ sed -n $(( position+ 2 )) ' p' ${tab} | cut -f 1;
4242 done < ${lineage} .tmp.fasta_positions > Phylogeny/${lineage} _genomic_positions.tab
4343
4444 cp ${mtbc_ancestor_path} ${lineage} .tmp.MTB_anc.pos.gz; gunzip ${lineage} .tmp.MTB_anc.pos.gz
4545
4646# 6. Get the same SNPs for the 'ancestor' genomes
4747 for i in ` cat Phylogeny/${lineage} _genomic_positions.tab` ; do
48- sed -n \ $ {i}' p' ${lineage} .tmp.MTB_anc.pos | cut -f3 # doesnt need to +2 as the tsv file has no header
48+ sed -n ${i} ' p' ${lineage} .tmp.MTB_anc.pos | cut -f3 # doesnt need to +2 as the tsv file has no header
4949 done > ${lineage} .tmp.MTB_anc
5050
5151# 7. convert the column in fasta
0 commit comments