Last active
July 17, 2017 17:07
-
-
Save mgalardini/2050681 to your computer and use it in GitHub Desktop.
Bioinformatics one-liners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
blastn -query 1 -subject 2 -outfmt 6 -task megablast -evalue 1e-10 | awk '{if ($4 > 4999) print $3" "$3" "$9" "$10" "$2" "$7" "$8" "$1}' > 1-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
complete=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria/ -l -s | grep -c "uid") | |
today=$(date +"%d/%m/%Y") | |
echo "\033[1;32m"$complete"\033[0m complete bacterial genomes on \033[1;34m"$today"\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
draft=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria_DRAFT/ -l -s | grep -c "uid") | |
today=$(date +"%d/%m/%Y") | |
echo "\033[1;32m"$draft"\033[0m draft bacterial genomes on \033[1;34m"$today"\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$#" -lt 2 ]; then | |
echo 'getGenbank GENUS SPECIES' | |
exit 65 | |
fi | |
genus=$1 | |
species=$2 | |
complete=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria/ -l -s | grep $genus"_"$species) | |
draft=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria_DRAFT/ -l -s | grep $genus"_"$species) | |
for genome in $complete | |
do | |
echo "Downloading "$genome", complete" | |
mkdir $genome | |
files=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria/$genome/ -l -s | grep '.gbk') | |
for file in $files | |
do | |
echo $file | |
curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria/$genome/$file > $genome/$file | |
done | |
echo "-------------------------" | |
done | |
for genome in $draft | |
do | |
echo "Downloading "$genome", draft" | |
mkdir $genome | |
files=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria_DRAFT/$genome/ -l -s | grep '.gbk') | |
for file in $files | |
do | |
echo $file | |
curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria_DRAFT/$genome/$file > $genome/$file | |
done | |
echo "-------------------------" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "\033[1;32mDownloading NCBI taxonomy dump\033[0m" | |
curl ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz > taxdump.tar.gz | |
echo "\033[1;32mUnpacking\033[0m" | |
gunzip -c taxdump.tar.gz | tar xf - | |
rm taxdump.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$#" -lt 2 ]; then | |
echo 'specific_genomes GENUS SPECIES' | |
exit 65 | |
fi | |
genus=$1 | |
species=$2 | |
complete=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria/ -l -s | grep -c $genus"_"$species) | |
draft=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria_DRAFT/ -l -s | grep -c $genus"_"$species) | |
total=$(($complete + $draft)) | |
today=$(date +"%d/%m/%Y") | |
echo "\033[1;32m"$total"\033[0m "$genus"_"$species" genomes on \033[1;34m"$today"\033[0m" | |
echo "\033[1;32m"$complete"\033[0m complete "$genus"_"$species" genomes on \033[1;34m"$today"\033[0m" | |
echo "\033[1;32m"$draft"\033[0m draft "$genus"_"$species" genomes on \033[1;34m"$today"\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
complete=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria/ -l -s | grep -c "uid") | |
draft=$(curl ftp://ftp.ncbi.nih.gov/genomes/Bacteria_DRAFT/ -l -s | grep -c "uid") | |
total=$(($complete + $draft)) | |
today=$(date +"%d/%m/%Y") | |
echo "\033[1;32m"$total"\033[0m bacterial genomes on \033[1;34m"$today"\033[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment