-
Notifications
You must be signed in to change notification settings - Fork 1
/
sra2fastq.sh
executable file
·59 lines (52 loc) · 1.37 KB
/
sra2fastq.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
#!/bin/bash
#### usage ####
usage() {
echo Program: "sra2fastq.sh (convert reads from SRA to FAST[Q/A] format)"
echo Author: BRIC, University of Copenhagen, Denmark
echo Version: 1.0
echo Contact: pundhir@binf.ku.dk
echo "Usage: sra2fastq.sh -i <file> [OPTIONS]"
echo " -i <file> [reads in SRA format]"
echo "[OPTIONS]"
echo " -f [convert to FASTA. Default is FASTQ]"
echo " -c [reads are in color space format (SOLID sequencing)]"
echo " -p [reads are from paired-end sequencing]"
echo " -h help"
echo
exit 0
}
#### parse options ####
while getopts i:fcph ARG; do
case "$ARG" in
i) INFILE=$OPTARG;;
f) TOFASTA=1;;
c) COLORSPACE=1;;
p) PAIREDEND=1;;
h) HELP=1;;
esac
done
if [ ! $INFILE ]; then
echo
usage
fi
ID=`echo $INFILE | sed 's/\..*//g' | sed 's/^.*\///g'`;
## convert SRA to FASTQ
if [ -z "$COLORSPACE" ]; then
if [ -z "$PAIREDEND" ]; then
fastq-dump $INFILE
else
fastq-dump --split-3 $INFILE
fi
else
abi-dump.2.3.5.2 -A $ID $INFILE
/home/users/sachin/software/bfast-0.7.0a/scripts/solid2fastq -o $ID $ID"_F3.csfasta" $ID"_F3_QV.qual"
#fastq-dump $INFILE
#fastqutils csencode $ID.fastq > $ID.fastq.tmp
#mv $ID.fastq.tmp $ID.fastq
fi
## convert FASTQ to FASTA
if [ ! -z "$TOFASTA" ]; then
fastqutils tofasta $ID.fastq > $ID.fasta
rm $ID.fastq
fi
exit