-
Notifications
You must be signed in to change notification settings - Fork 2
/
mageck.sh
165 lines (113 loc) · 3.76 KB
/
mageck.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
#Description: Runs the MAGeCK analysis on raw fastq files.
# The following modules are offered:
# 1. MAGeCK count - inuput: fastq files, output: count matrix.
# 2. Remove batch effects (if required) using R package 'sva'. Input: count matrix,
# Output: count matrix with batch effects removed.
# 3. MAGeCK mle
# 4. MAGeCK rra
#
#Author: Lucy Liu
#########################################################
# Arguments
#
# Change these arguments for each new project
#
#########################################################
# Directory path of file where the compressed fastq files are:
gzfastqfile="/Volumes/bioinf_pipeline/Runs/NextSeq/180917_NB501056_0192_AH3NYHBGX9/ProjectFolders/Project_Iva-Nikolic"
# Directory path of the file where you want the uncompressed fastq files to go -
# this location will be the 'working directory'
workdir="/Volumes/Users/Lucy/CRISPR/Iva20180921"
# Name of the file where the sgRNA annotation file is
# sgRNAfile=""
# # Sample labels, comma separated
# samlabels=""
#######################################
# Unzip fastq files to choosen directory
#######################################
# cd ${gzfastqfile}
# for file in $(ls */*.gz);
# do
# echo ${file}
# bname=$(basename ${file} .fastq.gz)
# # get the base name of the file and also remove the '.fastq.gz' at the end
# echo $bname
# gzip -d -c ${file} > ${workdir}${bname}.fastq
# # -decompress = unzip, send output to location as specified, add fastq to end of file name
# done
###############################
# Cutadapt to trim adapters
###############################
# Use 'cutadapt' to trim adaptors
# cd ${workdir}
# Change to working directory
# module load cutadapt
# Use only if on cluster
# for file in $(ls *1.fastq);
# do
# echo ${file}
# bname=$(basename ${file} .fastq)
# echo $bname
# cutadapt -g TGTGGAAAGGACGAAACACCG -o ${bname}.trimmed_P5.fastq ${file} > trimP5_${bname}_log.txt
# #trim 5' adaptor
# cutadapt -a GTTTTAGAGCTAGAAATAGCAAG -o ${bname}.trimmed_P7.fastq ${bname}.trimmed_P5.fastq > trimP7_${bname}_log.txt
# #trim 3' adaptor
# done
########################
# MAGeCK count
########################
# mkdir Count
# cd Count/
# mageck count -l ../Data/Annotations/${sgRNAfile} \
# -n "all" \
# --pdf-report \
# --norm "median" \
# --fastq `ls ../Data/Reads/*/*.fastq | tr '\n' ' '` \
# --sample-label ${samlabels}
# --control-sgrna ../Data/Annotations/negControl.txt \
#Note tr gets rid of the newline character at the end of each line of output
#and replaces with space
#################################
# Remove batch effect with 'sva'
#################################
# cd ..
# Rscript removeBatch.R Count/all.count_normalized.txt Data/Annotations/batchmatrix.txt
########################
# MAGeCK mle
########################
# mkdir mle
# cd mle/
# mageck mle -k all.count_normalized.txt \
# --design-matrix Data/Annotations/design_mat.txt \
# -n "Results" \
# --control-sgrna Data/Annotations/negControl.txt \
# --update-efficiency \
# --norm-method "none"
########################
# MAGeCK rra
########################
# mkdir ../rra
# cd rra/
# mageck test -k all.count_normalized_remove_batch.txt \
# -t EV21B1,EV21B2 \
# -c EV0B1,EV0B2 \
# -n "EVT0vsT21" \
# --norm-method "none" \
# --pdf-report \
# --normcounts-to-file \
# --gene-lfc-method "alphamedian" \
# --control-sgrna Data/Annotations/negControl.txt
# #--day0-label EV0
# #
# #-c EV0 \
# #--variance-from-all-samples \
# mageck test -k all.count_normalized_remove_batch.txt \
# -t SG1221B1,SG1221B2 \
# -c SG120B1,SG1221B2 \
# -n "SG12T0vsT21" \
# --norm-method "none" \
# --pdf-report \
# --normcounts-to-file \
# --gene-lfc-method "alphamedian" \
# --control-sgrna Data/Annotations/negControl.txt