Skip to content
Snippets Groups Projects
Commit da94c9ce authored by Blaise Li's avatar Blaise Li
Browse files

Added scripts to run and parse fastqc.

parent efeff4cd
No related branches found
No related tags found
No related merge requests found
do_qc.sh 0 → 100755
#!/bin/bash
# http://linuxcommand.org/wss0150.php
PROGNAME=$(basename $0)
function error_exit
{
# ----------------------------------------------------------------
# Function for exit due to fatal program error
# Accepts 1 argument:
# string containing descriptive error message
# ----------------------------------------------------------------
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
exit 1
}
lib=${1}
report_dir="${lib}_fastqc"
if [ ! -e ${report_dir}.zip -a ! -e ${report_dir} ]
then
cmd="fastqc ${lib}.fastq.gz"
nice -n 19 ionice -c2 -n7 ${cmd} || error_exit "${cmd} failed"
fi
if [ ! -e ${report_dir} ]
then
unzip ${report_dir}.zip
fi
parse_fastqc.py ${report_dir}/fastqc_data.txt \
> ${report_dir}/${lib}_overrepresented.fasta \
|| error_exit "fastqc result parsing failed for ${lib}"
exit 0
#!/usr/bin/env python3
import sys
with open(sys.argv[1], "r") as fqc:
line = fqc.readline()
assert line.startswith("##FastQC")
while not line.startswith(">>Overrepresented sequences"):
line = fqc.readline()
seq, count, percent, source = fqc.readline().strip().split("\t")
assert seq == "#Sequence"
#cumul_percent = 0
line = fqc.readline()
order = 0
while not line.startswith(">>END_MODULE"):
seq, _, percent, _ = line.strip().split("\t")
order += 1
#cumul_percent += float(percent)
print(">Over_represented_%d (%s)\n%s" % (order, percent, seq))
line = fqc.readline()
sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment