annotate runLinkYX.sh @ 11:4b7740f6305f

toolshed10
author biomonika <biomonika@psu.edu>
date Wed, 10 Sep 2014 10:32:35 -0400
parents 1955f03f092e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
1 #!/bin/bash
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
2 set -e; mkdir -p vcf; mkdir -p bam; mkdir -p references; mkdir -p scripts;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
3
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
4 email_address_of_user=$1;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
5 name_of_user_computer=$2;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
6
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
7 #read config variables
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
8 echo "Reading config...." >&2
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
9 #echo `ls -l`
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
10 computer_name=`hostname`;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
11 if [ $computer_name == $name_of_user_computer ]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
12 #local_computer
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
13 source config_devel;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
14 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
15 #metacentrum machine
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
16 source config_meta;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
17 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
18
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
19 #initally we believe that all files are present
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
20 ok=true;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
21
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
22 #we get to know if files are provided and if they are in .fasta or .fastq format
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
23 #first, rename files to shorter versions (fastq->fq, fasta->fa)
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
24 rename 's/fasta$/fa/' input/*.fasta 2>/dev/null
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
25 rename 's/fastq$/fq/' input/*.fastq 2>/dev/null
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
26
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
27 check_if_exists ()
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
28 {
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
29 for ARG in "$@";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
30 do
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
31 if [[ -e "input/${ARG}_1.fq" ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
32 eval ${ARG}_ext=fq
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
33 elif [[ -e "input/${ARG}_1.fa" ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
34 eval ${ARG}_ext=fa
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
35 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
36 ok=false;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
37 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
38 done;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
39 }
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
40
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
41 check_if_paired_end ()
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
42 {
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
43 for ARG in "$@";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
44 do
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
45 extension=$(eval "echo \$${ARG}_ext"); #echo $extension;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
46
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
47 if [[ (-e "input/${ARG}_1.${extension}") && (-e "input/${ARG}_2.${extension}") ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
48 eval ${ARG}_paired=paired;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
49 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
50 eval ${ARG}_paired=single;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
51 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
52 done;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
53 }
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
54
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
55 #check if file with reads exist
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
56 check_if_exists mother father daughter son;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
57 #and determine whether they are single or paired-end reads
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
58 check_if_paired_end mother father daughter son;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
59
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
60 if [ $ok == true ]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
61 echo "mother reads names:" $mother_ext $mother_paired;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
62 echo "father reads names:" $father_ext $father_paired;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
63 echo "daughter reads names:" $daughter_ext $daughter_paired;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
64 echo "son reads names:" $son_ext $son_paired;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
65
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
66 if [[ $father_ext =~ (fq) ]] && [[ $son_ext =~ (fq) ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
67 #no conversion needed, both fastq files
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
68 male_ext=fq;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
69 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
70 #convert to fasta (we need to merge father and son reads in order to build male reference contigs)
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
71 #father OR son is fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
72 echo "converting..";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
73 male_ext=fa;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
74
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
75 if [[ father_1.$father_ext =~ (fq) ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
76 #father is fastq and must be converted to fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
77 fastq_to_fasta -n -Q33 -i input/father_1.$father_ext -o input/father_1.$male_ext;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
78 fastq_to_fasta -n -Q33 -i input/father_2.$father_ext -o input/father_2.$male_ext;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
79 father_ext=fa;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
80
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
81 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
82 #son is fastq and must be converted to fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
83 fastq_to_fasta -n -Q33 -i input/son_1.$father_ext -o input/son_1.$male_ext;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
84 fastq_to_fasta -n -Q33 -i input/son_2.$father_ext -o input/son_2.$male_ext;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
85 son_ext=fa;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
86 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
87 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
88 #merging of father and son files
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
89 echo "concatenating..";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
90 cat input/father_1.$father_ext input/son_1.$son_ext >input/father_and_sons_1.$male_ext;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
91
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
92 if [[ $father_paired =~ (paired) ]] && [[ $son_paired =~ (paired) ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
93 cat input/father_2.$father_ext input/son_2.$son_ext >input/father_and_sons_2.$male_ext;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
94 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
95
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
96
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
97 #NOW run Trinity to assemble mother contigs
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
98 #in: mother reads out: reference.fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
99 PBS_NUM_PPN_used=$(($PBS_NUM_PPN_used - 2));
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
100 echo "processors used:" $PBS_NUM_PPN_used;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
101
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
102 #<<PREVENT_TRINITY_MOTHER
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
103 #assemble mother reads in single or paired-end mode
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
104 if [[ $mother_paired =~ (paired) ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
105 $trinity --CPU $PBS_NUM_PPN_used --seqType $mother_ext --JM 20G --left input/mother_1.$mother_ext --right input/mother_2.$mother_ext --output trinity_out_dir_mother 1>$trinity_stdout 2>&1
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
106 echo "$trinity --CPU $PBS_NUM_PPN_used --seqType $mother_ext --JM 20G --left input/mother_1.$mother_ext --right input/mother_2.$mother_ext --output trinity_out_dir_mother 1>$trinity_stdout 2>&1";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
107 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
108 $trinity --CPU $PBS_NUM_PPN_used --seqType $mother_ext --JM 20G --single input/mother_1.$mother_ext --output trinity_out_dir_mother 1>$trinity_stdout 2>&1
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
109 echo "$trinity --CPU $PBS_NUM_PPN_used --seqType $mother_ext --JM 20G --single input/mother_1.$mother_ext --output trinity_out_dir_mother 1>$trinity_stdout 2>&1";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
110 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
111
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
112 #retrieve assembled contigs and name them as reference.fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
113 mv trinity_out_dir_mother/Trinity.fasta reference_pro.fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
114 perl -pe 's/(>[\S]+).+/$1/' reference_pro.fasta >references/reference.fasta; rm reference_pro.fasta;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
115 #PREVENT_TRINITY_MOTHER
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
116
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
117 grep ">" references/reference.fasta | sed 's/>//g' >references/reference_contig_names
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
118
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
119 #now call to_get_vcf_files.sh to map reads to reference contigs
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
120 ./scripts/to_get_vcf_files.sh references/reference.fasta mother_1.$mother_ext mother_2.$mother_ext mother $mother_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
121 echo "Mother mapping successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
122 ./scripts/to_get_vcf_files.sh references/reference.fasta father_1.$mother_ext father_2.$mother_ext father $father_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
123 echo "Father mapping successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
124 ./scripts/to_get_vcf_files.sh references/reference.fasta daughter_1.$mother_ext daughter_2.$mother_ext daughter $daughter_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
125 echo "Daughter mapping successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
126 ./scripts/to_get_vcf_files.sh references/reference.fasta son_1.$mother_ext son_2.$mother_ext son $son_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
127 echo "Son mapping successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
128
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
129 wait;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
130
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
131 #NOW run Trinity to assemble male contigs
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
132 #in: male reads out: reference_male.fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
133 #<<PREVENT_TRINITY_MALES
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
134 if [[ $father_paired =~ (paired) ]] && [[ $son_paired =~ (paired) ]]; then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
135 $trinity --CPU $PBS_NUM_PPN_used --seqType $male_ext --JM 20G --left input/father_and_sons_1.$male_ext --right input/father_and_sons_2.$male_ext --output trinity_out_dir_male 1>$trinity_stdout 2>&1
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
136 echo "$trinity --CPU $PBS_NUM_PPN_used --seqType $male_ext --JM 20G --left input/father_and_sons_1.$male_ext --right input/father_and_sons_2.$male_ext --output trinity_out_dir_male 1>$trinity_stdout 2>&1";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
137 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
138 $trinity --CPU $PBS_NUM_PPN_used --seqType $male_ext --JM 20G --single input/father_and_sons_1.$male_ext --output trinity_out_dir_male 1>$trinity_stdout 2>&1
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
139 echo "$trinity --CPU $PBS_NUM_PPN_used --seqType $male_ext --JM 20G --single input/father_and_sons_1.$male_ext --output trinity_out_dir_male 1>$trinity_stdout 2>&1";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
140 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
141
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
142 #retrieve assembled contigs and name them as reference_male.fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
143 mv trinity_out_dir_male/Trinity.fasta reference_male_pro.fasta
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
144 perl -pe 's/(>[\S]+).+/$1/' reference_male_pro.fasta >references/reference_male.fasta; rm reference_male_pro.fasta;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
145 #PREVENT_TRINITY_MALES
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
146
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
147 grep ">" references/reference_male.fasta | sed 's/>//g' >references/male_contig_names
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
148
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
149 #now call to_get_vcf_files.sh to map reads to reference contigs
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
150 ./scripts/to_get_Y_variants.sh references/reference_male.fasta mother_1.$mother_ext mother_2.$mother_ext mother $mother_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
151 echo "Mother mapping to males successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
152 ./scripts/to_get_Y_variants.sh references/reference_male.fasta father_1.$mother_ext father_2.$mother_ext father $father_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
153 echo "Father mapping to males successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
154 ./scripts/to_get_Y_variants.sh references/reference_male.fasta daughter_1.$mother_ext daughter_2.$mother_ext daughter $daughter_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
155 echo "Daughter mapping to males successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
156 ./scripts/to_get_Y_variants.sh references/reference_male.fasta son_1.$mother_ext son_2.$mother_ext son $son_paired
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
157 echo "Son mapping to males successful.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
158
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
159 #index bam files
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
160
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
161 index_bam_file ()
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
162 {
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
163 for ARG in "$@";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
164 do
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
165 if [ -e "bam/aln_cleaned_sorted_deduplicated_${ARG}.bam.bai" ];
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
166 then
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
167 echo "Index already exists. Not being created again.";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
168 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
169 samtools index bam/aln_cleaned_sorted_deduplicated_${ARG}.bam &
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
170 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
171 done;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
172 }
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
173
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
174 #index bam files
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
175 index_bam_file mother father daughter son mother_male father_male daughter_male son_male;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
176 wait;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
177 echo "Indexes successfully created."
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
178
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
179 echo -e "Starting analysis";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
180
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
181 #A variant X1X1 X2Y
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
182 dir="A/";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
183 bash -x ./A.sh $email_address_of_user;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
184 perl scripts/sorting.pl A/;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
185
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
186 #Y variant
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
187 dir="Y/";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
188 bash -x ./Y.sh $email_address_of_user;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
189
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
190 wait;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
191
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
192 #sending results (not BAM files)
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
193 mutt -s "LINKYX: Results of computation for Y-linked genes" $email_address_of_user -a Y_results_sequences.txt < messages_to_user/message_results_sentY;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
194 mutt -s "LINKYX: Results of computation for X-linked genes" $email_address_of_user -a X_results_sequences.txt < messages_to_user/message_results_sentX;
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
195
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
196
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
197 echo -e "Done."
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
198 else
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
199 echo "not all input files are present in proper form";
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
200 mutt -s "LINKYX: Not all input files are present in proper form." $email_address_of_user < messages_to_user/message_input_files_error
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
201 fi
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
202
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
203
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
204
1955f03f092e initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
205