#!/usr/bin/sh ######################################################################################################### #The shell script explains how to detect P-element insertions from paired-end reads of hemi-specific PCR #Shuo Zhang (shuozhang23@gmail.com) #Erin Kelleher lab #Program in Ecology and Evolution, Departement of Biology and Biochemistry, University of Houston ######################################################################################################### #To run this script, put you paired-end reads from each degenerate primer into seperate directories. #Then, create a directory and move your direacotories with sequencing data into this created directory, run the shell script after you change to this directory module add bowtie2/2.1.0 module add samtools/0.1.19 #The 1st step: align read1 from the paired-end sequencing data to the P-element consensus reference for i in {1..15} do cd Sample_lib_R$i #change to directory containing paired-end reads of a degenerate primer #align read1 from the paired-end sequencing data to the P-element consensus reference #p_element.ref is the basename of the index for the P-element consensus. For more details, please refer bowtie2 manual # read1.fastq is the read1 of paired-end reads bowtie2 --local -q --no-unal -x p_element.ref -U read1.fastq -S read1.sam #select reads that align to plus strand of P-element samtools view -SXF 0x10 read1.sam > plus_strand_mapped_read1.sam #pick read pairs that aligned to 3' end of P-element perl pick_p_reads.pl plus_strand_mapped_read1.sam read1.fq r1.fq lib*R2_001.fastq read2.fq r2.fq cat read1.fq r1.fq > p_read1.fq cat read2.fq r2.fq > p_read2.fq rm read1.fq r1.fq read2.fq r2.fq #cut adapter at 3' end and remove 3' end sequence of P element and filter low quality nucleotides cutadapt -a CTGTCTCTTATACACATCTCCGAGCCCAC -A CTGTCTCTTATACACATCTGACGCTGCC -o cut_p_read1.fq -p cut_p_read2.fq p_read1.fq p_read2.fq cutadapt -q 20,20 -g CGACGGGACCACCTTATGTTATTTCATCATG -A CATGATGAAATAACATAAGGTGGTCCCGTCG --minimum-length 20 -o trimmed_p_read1.fq -p trimmed_p_read2.fq cut_p_read1.fq cut_p_read2.fq rm cut_p_read1.fq cut_p_read2.fq #align trimmed read paired to dm6 bowtie2 -q -a --no-unal -x dm6.ref -1 trimmed_p_read1.fq trimmed_p_read2.fq -S trimmed_read_all.sam samtools view -XSf 0x2 trimmed_read_all.sam > proper_trimmed_read_all.sam #pick uniquely mapping reads and their alignments cut -f 1 proper_trimmed_read_all.sam | uniq -c > alignment.txt perl pickUniqMulti.pl alignment.txt proper_trimmed_read_all.sam uniq.sam multi.sam rm alignment.txt #detect the P-element insertions according to uniquely mapping reads perl get_insertion_unique.pl -read1_len 30 -read2_len 30 -i uniq.sam -o insertion.out cd .. done