cambiotraining / bacterial-genomics

Course materials for "Working with Bacterial Genomes"
https://cambiotraining.github.io/bacterial-genomics/
Other
0 stars 2 forks source link

Renaming `fas` files in 02-pseudogenome_check.sh #4

Closed tavareshugo closed 10 months ago

tavareshugo commented 10 months ago

I'm wondering why is it necessary to rename the files in the script 02-pseudogenome_check.sh?

We have this line:

# rename aligned_pseudogenomes.fas
mv $fasta_dir/aligned_pseudogenomes.fas $fasta_dir/aligned_pseudogenomes.fasta

And then at the end:

# rename aligned_pseudogenomes.fas
mv $fasta_dir/aligned_pseudogenomes.fasta $fasta_dir/aligned_pseudogenomes.fas

The issue is that if the script fails in-between these two lines of code (as it did for me, due to missing the parser python script on my path), then the files will be renamed and the script will fail the second time around.

tavareshugo commented 10 months ago

I've muddled things so much, that I'm having to re-run bactmap, just to be sure I have the right input files downstream. If the file extension change is necessary for one of the tools used, then I would recommend making a symbolic link to the original file in the ${outdir} directory, and then remove the symbolic link at the end. That way we make sure not to corrupt any of the input data necessary for the script.

avantonder commented 10 months ago

It was to stop the file being included in the for loop so not really necessary to change it (seemed like the laziest way to do this!). Happy to go with an alternative suggestion.

tavareshugo commented 10 months ago

I see. In that case maybe we can do:

for filepath in $(ls $fasta_dir/*.fas | grep -v "aligned_genomes")

(I'll test this now)

tavareshugo commented 10 months ago

this latter solution works