@@ -59,72 +59,4 @@ process GENERATE_NEXUS {
5959
6060 """
6161
62- }
63-
64- /*
65- # create the output and temporary directories
66- mkdir -p nexus/ fasta/ positions/
67-
68- # create the list of genomes within the cluster
69- grep "${clusterID}" ${pairwise_clusters} \\
70- | cut -f1 > ${clusterID}.genomes.list
71-
72- #·················································································#
73-
74- # create cluster directory and split up fasta file in cluster fastas
75- while IFS=";" read -r genome; do
76- seqkit grep -w 0 -n -p \${genome} ${snp_fasta} >> ${clusterID}.fasta
77- done < ${clusterID}.genomes.list
78-
79- # run snp-sites on the fastas
80- snp-sites ${clusterID}.fasta > ${clusterID}.snpsites.fasta
81- snp-sites ${clusterID}.fasta -v | cut -f2 \\
82- | sed '1,4d' > positions/${clusterID}_positions.tab
83-
84- #·················································································#
85-
86- # H37Rv variance positions
87- for i in `cat positions/${clusterID}_positions.tab`; do
88- sed -n \$((i+2))'p' ${snp_tab} | cut -f3
89- done > ${clusterID}_tmp_refseq
90-
91- # convert column into fasta
92- paste -s -d "" ${clusterID}_tmp_refseq \\
93- | sed '1i >H37Rv' > ${clusterID}_H37Rv.fasta
94-
95- #·················································································#
96-
97- # Get genomic positions
98- while read -r position; do
99- sed -n \$((position+2))'p' ${snp_tab} | cut -f 1;
100- done < positions/${clusterID}_positions.tab > positions/${clusterID}_genomic_positions.tab
101-
102- #·················································································#
103-
104- # Valencian ancestor (MTB_anc) variance positions
105- cp ${params.mtbc_ancestor_path} ${lineage}.tmp.MTB_anc.pos.gz
106- gunzip ${lineage}.tmp.MTB_anc.pos.gz
107-
108- for i in `cat positions/${clusterID}_genomic_positions.tab`; do
109- sed -n \${i}'p' ${lineage}.tmp.MTB_anc.pos | cut -f3
110- done > ${clusterID}_tmp_MTB_anc
111-
112- # convert the column in fasta
113- paste -s -d "" ${clusterID}_tmp_MTB_anc \\
114- | sed '1i >MTB_anc' > ${clusterID}_MTB_anc.fasta
115-
116- # remove the large tab file
117- rm -rf ${lineage}.tmp.MTB_anc.pos.gz
118-
119- #·················································································#
120-
121- # Create final FASTA file
122- cat ${clusterID}.snpsites.fasta \\
123- ${clusterID}_H37Rv.fasta \\
124- ${clusterID}_MTB_anc.fasta \\
125- > fasta/${clusterID}_refseq.fasta
126-
127- # convert to nexus for visualisation
128- seqret -osformat2 nexus -sequence fasta/${clusterID}_refseq.fasta \\
129- -outseq nexus/${clusterID}_refseq.nex
130- */
62+ }
0 commit comments