FastqPuri
Functions | Variables
trimDS.c File Reference

trim adapters from double stranded data More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "trimDS.h"
#include "Lmer.h"
#include "trim.h"
#include "struct_trimFilter.h"
Include dependency graph for trimDS.c:

Functions

DS_adap init_DSadap (char *ad1, char *ad2, int L1, int L2)
 initialization of a DS_adap structure More...
 
static void pack_reads (DS_adap *ptr_DSad, Fq_read *r1, Fq_read *r2)
 pack reads with process_seq so that we can compute the edit distance between two subsequences. Read 1 will be packed once in the forward direction and Read 2 twice in the reverse direction with a shift of half a byte. More...
 
static int QtrimDS (Fq_read *r1, Fq_read *r2, int L)
 trims both reads reducing them to a length L. More...
 
static double obtain_scoreDS (Fq_read *r1, int pos1, Fq_read *r2, int pos2)
 obtains the score when comparing two subsequences of extended r1 and extended r2, starting in pos1 and pos2 respectively. The score is computed by adding log_10(4) when a match is observed and subtracting Q/10.0 when a mismatch is observed, with Q being the quality value. If there is a mismatch in a region where both read 1 and read 2 have qualities associated to the nucleotide under consideration, then the maximum of the quality values is subtracted. More...
 
static int alignDS_uint64 (Fq_read *r1, Fq_read *r2)
 try to find adapter remnants in the reads r1 and r2 by aligning their extended versions (adapter1 + r1) vs rev_comp(adapter2 + r2). More...
 
int trim_adapterDS (DS_adap *ptr_DSad, Fq_read *r1, Fq_read *r2)
 trim the sequences, discard them or keep them unchanged depending on them having adapters remnants. More...
 

Variables

uint8_t fw_1B [256]
 
uint8_t bw_1B [256]
 
Iparam_trimFilter par_TF
 

Detailed Description

trim adapters from double stranded data

Author
Paula Perez paula.nosp@m.pere.nosp@m.zrubi.nosp@m.o@gm.nosp@m.ail.c.nosp@m.om
Date
05.10.2017

Function Documentation

◆ alignDS_uint64()

static int alignDS_uint64 ( Fq_read r1,
Fq_read r2 
)
static

try to find adapter remnants in the reads r1 and r2 by aligning their extended versions (adapter1 + r1) vs rev_comp(adapter2 + r2).

Parameters
r1pointer to Fq_read for read 1
r2pointer to Fq_read for read 2
Returns
0 if the read is to be discarded, 1 if left as is, 2 if trimmed. Reads are trimmed if 2 is returned.

◆ init_DSadap()

DS_adap init_DSadap ( char *  ad1,
char *  ad2,
int  L1,
int  L2 
)

initialization of a DS_adap structure

Parameters
ad1adapter 1 sequence
ad2adapter 2 sequence
L1adapter 1 sequence length
L2adapter 2 sequence length
Returns
initialized DS_adap structure

◆ obtain_scoreDS()

static double obtain_scoreDS ( Fq_read r1,
int  pos1,
Fq_read r2,
int  pos2 
)
static

obtains the score when comparing two subsequences of extended r1 and extended r2, starting in pos1 and pos2 respectively. The score is computed by adding log_10(4) when a match is observed and subtracting Q/10.0 when a mismatch is observed, with Q being the quality value. If there is a mismatch in a region where both read 1 and read 2 have qualities associated to the nucleotide under consideration, then the maximum of the quality values is subtracted.

Parameters
r1pointer to Fq_read for read 1
pos1position to start comparing in read 1, starting from 5' end of the extended sequence (adapter 1 + read 1)
r2pointer to Fq_read for read 2
pos2position to start comparing in read 2, starting from 3' end of the extended sequence (adapter 2 + read 2)
Returns
score associated to the comparison of the two strings

◆ pack_reads()

static void pack_reads ( DS_adap ptr_DSad,
Fq_read r1,
Fq_read r2 
)
static

pack reads with process_seq so that we can compute the edit distance between two subsequences. Read 1 will be packed once in the forward direction and Read 2 twice in the reverse direction with a shift of half a byte.

Parameters
ptr_DSadpointer to DS_adap structure, contains adapters sequences
r1pointer to Fq_read for read 1, packed sequence stored here.
r2pointer to Fq_read for read 2, packed sequences stored here.

◆ QtrimDS()

static int QtrimDS ( Fq_read r1,
Fq_read r2,
int  L 
)
static

trims both reads reducing them to a length L.

Parameters
r1pointer to Fq_read for read 1
r2pointer to Fq_read for read 2
L
Returns
2 (we are trimming the sequences)

◆ trim_adapterDS()

int trim_adapterDS ( DS_adap ptr_DSad,
Fq_read r1,
Fq_read r2 
)

trim the sequences, discard them or keep them unchanged depending on them having adapters remnants.

Returns
0 if the read is to be discarded, 1 if left as is, 2 if trimmed. Reads are trimmed if 2 is returned.

Variable Documentation

◆ bw_1B

uint8_t bw_1B[256]

global variable. Lookup table.

◆ fw_1B

uint8_t fw_1B[256]

global variable. Lookup table.

◆ par_TF

global variable. Input parameters.

global variable: Input parameters trimFilter.

global variable: Input parameters of makeTree.