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
# Port forwarding using miniUPNP client | |
# Use crontab to automate upon reboot | |
# https://superuser.com/questions/634628/is-there-a-script-to-add-port-forwarding-rule-in-home-router | |
upnpc -a `ifconfig wlan0 | grep "inet addr" | cut -d : -f 2 | cut -d " " -f 1` 22 22 TCP | |
upnpc -a `ifconfig wlan0 | grep "inet addr" | cut -d : -f 2 | cut -d " " -f 1` 5900 5900 TCP | |
upnpc -a `ifconfig wlan0 | grep "inet addr" | cut -d : -f 2 | cut -d " " -f 1` 9091 9091 TCP |
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
# Run me first to count the lengths of sequences in FASTQ files in the directory. | |
# This script is linebreak dependent, therefore no interleaving is allowed. | |
# NR%4==2 means print every 4th line starting from 2nd | |
# NR%2==0 means print every 2nd line starting from 2st (note the 0) | |
for i in *.fastq; do | |
cat $i | awk '{if(NR%4==2) print length($1)}' > ${i}.readslength.txt | |
done | |
for i in *.fasta; do |
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
for i in *.fastq; do | |
echo $(cat $i| wc -l)/4 | bc >> count.txt # can use zcat for gzipped files | |
done | |
calc `paste -sd+ count.txt` |
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
paste Short.name.txt Proper.name.txt | while read n k; do sed -i "s/$n/$k/g" tree.nwk; 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
# https://stackoverflow.com/questions/21908809/grep-f-file-to-print-in-order-as-a-file | |
# You can pipe patt.grep (pattern) to xargs, which will pass the patterns to grep one at a time. | |
# By default xargs appends arguments at the end of the command. But in this case, grep needs myfile.log to be the last argument. So use the -I{} option to tell xargs to replace {} with the arguments. | |
# foobar here is the placeholder | |
# This is useful as grep | |
cat patt.grep | xargs -Ifoobar grep foobar myfile.log |
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
# If, for some crazy reason, you want to know how many individual bases you have in your dataset. | |
for i in *.fastq; do | |
cat $i | paste - - - - | cut -f 2 | tr -d '\n' | wc -c >> char.txt | |
done | |
R -e 'sum(read.csv("char.txt"))' | |
# You can replace *.fastq with *.fastq.gz and cat with zcat if your data is compressed |
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
awk -v seq="header_id" -v RS='>' '$1 == seq {print RS $0}' file |
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/bash | |
infile=$1 | |
if [ "$infile" == "" ] ; then | |
echo "Usage: prokkagff2gtf.sh <PROKKA gff file>" | |
exit 0 | |
fi | |
grep -v "#" $infile | grep "ID=" | cut -f1 -d ';' | sed 's/ID=//g' | cut -f1,4,5,7,9 | awk -v OFS='\t' '{print $1,"PROKKA","CDS",$2,$3,".",$4,".","gene_id " $5}' |
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
import_biom2 <- function(x, | |
treefilename=NULL, refseqfilename=NULL, refseqFunction=readDNAStringSet, refseqArgs=NULL, | |
parseFunction=parse_taxonomy_default, parallel=FALSE, version=1.0, ...){ | |
# initialize the argument-list for phyloseq. Start empty. | |
argumentlist <- list() | |
x = read_biom(x) | |
b_data = biom_data(x) | |
b_data_mat = as(b_data, "matrix") |
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
# https://www.biostars.org/p/49820/ | |
# https://github.com/mdshw5/pyfaidx can be used as a drop-in replacement | |
xargs samtools faidx test.fa < names.txt |
NewerOlder