-
Notifications
You must be signed in to change notification settings - Fork 4
07. iRep
rprops edited this page Mar 16, 2019
·
6 revisions
How to:
“Measurement of bacterial replication rates in microbial communities” - Christopher T. Brown, Matthew R. Olm, Brian C. Thomas, Jillian F. Banfield
http://dx.doi.org/10.1038/nbt.3704
#!/bin/bash
for file in `ls *.fa`
do
stub=${file%.fa}
grep ">" $file | sed "s/>//g" > ${stub}_names.tsv
dos2unix ${stub}_names.tsv
python /home/rprops/DESMAN/scripts/Lengths.py -i $file > $stub.len
dos2unix $stub.len
/home/rprops/StrainMetaSim/scripts/AddLengths.pl $stub.len < ${stub}_names.tsv > ${stub}_contigs.tsv
done
#!/bin/bash
set -e
for bin in `ls ./bins/*.tsv`
do
bin_stub1=${bin##*/}
bin_stub=${bin_stub1%-contigs.tsv}
echo $bin_stub
mkdir ./splitBam/${bin_stub}
for sample_sam in `ls /scratch/vdenef_fluxm/rprops/metaG_SCK/data/coassembly/anvio_v2.2.2/map/*.sam`
do
stub1=${sample_sam##*/}
stub=${stub1%.sam}
echo $stub
echo $bin
echo $sample_sam
samtools view -hL $bin $sample_sam > ./splitBam/${bin_stub}/${stub}.sam
done
done
#!/bin/bash
set -e
for bin in `ls ./bins/*.fa`
do
bin_stub1=${bin##*/}
bin_stub=${bin_stub1%-contigs.fa}
mkdir ./results_${bin_stub}
for sample_sam in `ls ./splitBam/${bin_stub}/*.sam`
do
stub1=${sample_sam##*/}
stub=${stub1%.sam}
echo $stub
xvfb-run -e ./xvfb.${PBS_JOBID}.err -f ./xvfb.${PBS_JOBID}.auth -w 10 -s "-screen 0 1600x1200x24" iRep -f ${bin} -s ${sample_sam} -o ./results_${bin_stub}/iRep_${bin_stub}_${stub} -t 20 -ff --sort
done
done
# For sample 17
iRep -f ./bins/Bin_1-contigs.fa -s ./map-DNA-Pieter-17/Bin_1.sam -o ./results-DNA-Pieter-17/iRep-DNA-Pieter-17_bin1 -t 10 -ff --sort
# For sample 16
iRep -f ./bins/Bin_1-contigs.fa -s ./map-DNA-Pieter-16/Bin_1.sam -o ./results-DNA-Pieter-16/iRep-DNA-Pieter-16_bin1 -t 10 -ff --sort
iRep normally tries to connect to a remote display, which requires you to go through VNC. To avoid this run the iRep commands like this in a PBS script:
xvfb-run -e ./xvfb.${PBS_JOBID}.err -f ./xvfb.${PBS_JOBID}.auth -w 10 -s "-screen 0 1600x1200x24" iRep -f ./bins/Bin_1-contigs.fa -s ./map-DNA-Pieter-16/Bin_1.sam -o ./results-DNA-Pieter-16/iRep-DNA-Pieter-16_bin1 -t 10 -ff --sort
To extract the filtered and unfiltered iRep from the output tsv:
sed -n '3p;7p' < ${sample} >> results_irep.tsv