4.9 Exercise 4 - Singularity running and building
- Example running BLAST commands in different ways
Answer
Compare with the previous Docker examples
First of all, let’s generate a blast.sif
image. We have plenty of ways to do this. One example below:
4.9.1 Blast command-line (1)
# If not there create a DB dir
mkdir $HOME/db
cp blast.sif $HOME/db
cd $HOME/db
curl -L https://www.uniprot.org/uniprot/O75976.fasta -o O75976.fasta
curl -L https://www.uniprot.org/uniprot/Q90240.fasta -o Q90240.fasta
singularity exec blast.sif blastp -query O75976.fasta -subject Q90240.fasta
# We can mount if we prefer (as we did with Docker), but it's not strictly necessary
singularity exec -B /home/ec2-user/db:/blastdb blast.sif blastp -query /blastdb/O75976.fasta -subject /blastdb/Q90240.fasta > out.blast
singularity exec -B /home/ec2-user/db:/blastdb blast.sif blastp -query /blastdb/O75976.fasta -subject /blastdb/Q90240.fasta -out /blastdb/output.blast
4.9.2 Blast command-line (2)
# If not there create a DB dir
mkdir $HOME/db
cp blast.sif $HOME/db
cd $HOME/db
# Let's download Swissprot DB
curl -L https://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/swissprot.gz -o swissprot.gz
gunzip swissprot.gz
# Let format the Swissprot DB
singularity exec blast.sif makeblastdb -dbtype prot -parse_seqids -in swissprot
We can retrieve a FASTA sequence by ID