Wednesday, March 23, 2011

Split fastq mates

Here is code in perl to split a single paired interleaved FASTQ file into a pair of FASTQ files:


#!/usr/local/bin/perl -w
# Daniel Brami
# Util to split interlaced FASTQ files into pairs

use strict;

# Standard lib
use IO::File;
use File::Basename;

my $INPUT=shift;

if (!(defined ($INPUT)) || ($INPUT =~ '^\-')){
die "Usage: $0 <interleaved paired FASTQ file>\n";
}

my ($name,$path,$suffix) = fileparse($INPUT, qw/fastq FASTQ txt TXT/);

my $FH_IN = new IO::File($INPUT, "r") or die "could not open $INPUT: $!\n";
my $FH_OUT1 = new IO::File($name."split1.$suffix", "w") or die "could not open $name.split1$suffix for writing: $!\n";
my $FH_OUT2 = new IO::File($name."split2.$suffix", "w") or die "could not open $name.split2$suffix for writing: $!\n";

my ($recs1, $recs2)= (0,0);
my $flipflop = 1;
my $counter = 0;
my ($line, $TXT);
while($line = $FH_IN->getline()){
$TXT .= $line;
$counter++;
if($counter == 4){
if($flipflop == 1){
print $FH_OUT1 $TXT;
++$recs1;
}else{
print $FH_OUT2 $TXT;
++$recs2;
}
$counter = 0;
$TXT = '';
$flipflop *= -1;
}
}
$FH_IN->close();
$FH_OUT1->close();
$FH_OUT2->close();

print STDERR "Processed $recs1 records for pair file 1 and $recs2 records for pair file 2.\n";
if($recs1 != $recs2){
print STDERR "The number of processed records does not match - check input data!";
}exit;

Quality trimming fastq files using CLC Bio cell

  1. copy the mandatory license.properties file to your working directory
  2. /usr/local/packages/clc-ngs-cell/quality_trim -o -p -c -l -m -r -i &
  3. Optional: Split the resulting interleaved paired file into two components:
    ~/workspace/meta_scripts/splitMatedFastq.pl

Monday, July 19, 2010

modify a genbank file for mapping

Insert between the following tags at the tail of your Genbank file the nucleotide FASTA sequence only:
ORIGIN
(sequence goes here)
//

Thursday, June 10, 2010

CLC mapping

At ths point, the most current version of the CLC command-line utils is located here:

/usr/local/packages/clc-ngs-cell/

with the mapper for 454 / Sanger reads being clc_ref_assemble_long.

As usual, you need to copy the license.properties file from that folder to your working directory to perform any sort of analysis.

Here are some of the pitfalls:
- making a soft link to the mapping executable will throw a missing license error. forget the soft link, you need to use the fully qualified path of the executable.

- mapping to a Genbank file didn't work. However mapping to a FASTA file completed with blazing quickness.


Once the mapping has producea CAS output, you need to process it to get it in table format:
/usr/local/packages/clc-ngs-cell/assembly_table -n -s input.cas > output.table


Thursday, May 13, 2010

SVN stuff

This is how you create a repository (usually done by IT):
svnadmin create (repo_name)

This is how you add content to a repository:
svn import (files | folder) (repo_name) -m "initial import"

This is how you checkout the latest version of something existing in SVN into the current working directory:
svn checkout (repo_name/path)

This is how you check something into it to update the svn with a more current version:
from within the root folder when doing svn checkout (ie: /workspace/genomeQC):
svn commit -m "update to ver 1.5"


Wednesday, May 12, 2010

FASTQ tools

Here are my favorite FASTQ processing utils:

FASTQC:
To run a QC on your data.

To run in batch mode with zipped output:
java* -Xmx250m -cp <> uk.ac.bbsrc.babraham.FastQC.FastQCApplication <>

*: make sure that java is at least version 1.6

FASTX Toolkit:
Bunch of scripts for processing the fastq files and qc, but fastqc is better for qc'ing.