Skip to content

Instantly share code, notes, and snippets.

for B in `ls -1 *fastq* | perl -ne 'm#^(.+?)_#;print "$1\n"' | sort | uniq`; do
echo $B;
java -jar ~/bin/picard.jar FastqToSam F1=$(ls -1 ${B}_*R1*.fastq.gz) F2=$(ls -1 ${B}_*R2*fastq.gz) O=$B.bam SAMPLE_NAME=$B;
#in case of a failure, we'll get a file of zero bytes
touch $B.bam
done;
ls -l | grep -w 0
-rw-r--r-- 1 root root 0 Feb 4 08:25 Black84.bam
-rw-r--r-- 1 root root 0 Feb 4 08:25 C4SCC.bam
-rw-r--r-- 1 root root 0 Feb 4 08:25 DutchHaze.bam
-rw-r--r-- 1 root root 0 Feb 4 08:30 GrandDaddyPurpleSCC.bam
-rw-r--r-- 1 root root 0 Feb 4 09:01 NorthernLightAutoFeminizedSeed.bam
-rw-r--r-- 1 root root 0 Feb 4 09:04 OGKushXBubbaKushSCC.bam
-rw-r--r-- 1 root root 0 Feb 4 09:10 OGXPurpleBubbleGumXC4SCC.bam
-rw-r--r-- 1 root root 0 Feb 4 09:50 SuperCritical.bam
-rw-r--r-- 1 root root 0 Feb 4 09:52 SuperSilverHaze.bam
for B in $(find * -size 0); do
C=${B/.bam/};
echo $C;
java -jar ~/bin/picard.jar FastqToSam F1=$(ls -1 ${C}_*R1*.fastq.gz) O=$C.bam SAMPLE_NAME=$C;
done
gsutil -m cp *.bam gs://$BUCKET/kannapedia/
#get the build specification file
git clone git@github.com:allenday/bfx.git
cd bfx/bfx-bwa
#do whatever you need to do
vim Dockerfile
#build it with tag bfx-bwa. you probably want to rename.
docker build -t bfx-bwa .
# Set according to your working enviroment
BUCKET=gs://your-bucket-name
WORKSPACE=$BUCKET/some/subdirectory
BASE_FASTA=some.fa
INPUT_FASTA=$BUCKET/$BASE_FASTA
# probably you want this to be the same as input.fasta.
# this is the default behavior for BWA.
OUTPUT_INDEX_PREFIX=$BASE_FASTA
OUTPUT_PATH=$WORKSPACE/out
OP_ID=operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl
CMD="gcloud --format='value(done)' alpha genomics operations describe $OP_ID"
while [[ $(eval ${CMD}) != "True" ]]; do
echo -n "$OP_ID not done, sleeping 30s. ";
date;
sleep 30;
done
Running [operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl]
operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl not done, sleeping 30s. Sun Feb 5 17:59:53 PST 2017
operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl not done, sleeping 30s. Sun Feb 5 18:00:25 PST 2017
operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl not done, sleeping 30s. Sun Feb 5 18:00:58 PST 2017
operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl not done, sleeping 30s. Sun Feb 5 18:01:30 PST 2017
operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl not done, sleeping 30s. Sun Feb 5 18:02:01 PST 2017
operations/ENr3tYihKxjl8vvhnZvjmrsBIM29ta6GEioPcHJvZHVjdGlvblF1ZXVl not done, sleeping 30s. Sun Feb 5 18:02:32 PST 2017
gsutil ls -l $OUTPUT_PATH
18 2017-02-06T02:04:33Z gs://.../MNPR01.fa.amb
1576040 2017-02-06T02:04:34Z gs://.../MNPR01.fa.ann
585823748 2017-02-06T02:04:47Z gs://.../MNPR01.fa.bwt
146455918 2017-02-06T02:04:40Z gs://.../MNPR01.fa.pac
292911888 2017-02-06T02:04:38Z gs://.../MNPR01.fa.sa
TOTAL: 5 objects, 1026767612 bytes (979.2 MiB)