Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 13 additions & 7 deletions referenceC/new.c → reference_C/new.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define PACKAGE "ICECap"
#define VERSION "0.01"
#define CHROMOSOMES 22
#define CHROMOSOMES 25
#define WIN_SHIFT1 1
#define RESOLUTION 1000

Expand Down Expand Up @@ -245,7 +245,7 @@ number_for_key(char *key)
}
sprintf(zom,"%d",SCALE);
sprintf(wind,"%d",window);
sprintf(stamp,concat(concat(concat("/NewAnalysis_Z",zom),"_W"),wind));
sprintf(stamp,concat(concat(concat("/Analysis_Z",zom),"_W"),wind));


init(lane,folder,folderN,PATHBOWTIE,chrom_start,chrom_end,stamp,stamp2,stats);
Expand Down Expand Up @@ -335,7 +335,7 @@ printf("\n %d Chromosomes will be considered \n",chrom_end);

if(strlen(folderN)==0){folderN=folder; }else{ sprintf(zom,"%d",SCALE);

sprintf(stamp,concat(concat(concat("/NewAnalysis_Z",zom),"_W"),wind));
sprintf(stamp,concat(concat(concat("/Analysis_Z",zom),"_W"),wind));
mkdir(concat(concat(folder,lane),stamp),0777); mkdir(concat(concat(concat(concat(folder,lane),stamp),"/weights"),stamp2),0777);
mkdir(concat(concat(concat(concat(concat(folder,lane),stamp),"/"),stats),stamp2),0777);
mkdir(concat(concat(concat(concat(concat(concat(folder,lane),stamp),"/"),stats),stamp2),"/fdr"),0777);
Expand Down Expand Up @@ -691,8 +691,10 @@ fclose(fout6);
FILE *tads= fopen(concat(concat(concat(concat(outdir,lane),"_Z"),zom),".tad"), "w+");
FILE *peakY = fopen(concat(concat(concat(concat(outdir,lane),"_Z"),zom),".pkY"), "w+");
FILE *peakY2 = fopen(concat(concat(concat(concat(outdir,lane),"_Z"),zom),".cool"), "w+");

FILE *gff;
FILE *peakC;
FILE *peakC;

FILE *wig= fopen(concat(concat(concat(concat(outdir,lane),"_Z"),zom),".wig"), "w+");

pchic=0;
Expand All @@ -708,7 +710,8 @@ sprintf(sbait,"%d",i);
if(strcasecmp(stringarray[i],"")!=0){sprintf(sbait,"%s",stringarray[i]);}

FILE *peakC = fopen(concat(concat(concat(concat(concat(concat(outdir2,lane),"_BAIT_"),sbait),"_Z"),zom),".pkC"), "w+");
FILE *gff = fopen(concat(concat(concat(concat(concat(concat(outdir2,lane),"_BAIT_"),sbait),"_Z"),zom),".gff"), "w+");
FILE *gff = fopen(concat(concat(concat(concat(concat(outdir2,lane),"_BAIT_"),sbait),"_Z1"),".gff"), "w+");


if(pchic==1){
}else{
Expand Down Expand Up @@ -750,7 +753,7 @@ fprintf(tads,"%d\t",hic[i][j]);
fdist=100000000;}
if(hic[i][j]>0){
if(j>=i){fprintf(peakY2,"%d\t%d\t%d\n",i,j,hic[i][j]);}
printf("BOH: %d\t%d\t%d\t%d\n",i,j,chrombait[i],chrombait[j]);
/* printf("BOH: %d\t%d\t%d\t%d\n",i,j,chrombait[i],chrombait[j]); */
if(chrombait[i]!=chromgrid[j]){
fprintf(peakY,"%d\t%d\t%d\t%f\t%f\t%f\n",totfragments[chrombait[i]-1]+cgrid(chrombait[i],baitpoints[chrombait[i]][i-totbaits[chrombait[i]-1]]+(1-pchic)*RESOLUTION,gp,gridpoints),j,hic[i][j],fdist,1,1);
}else{
Expand All @@ -763,6 +766,9 @@ fprintf(peakY,"%d\t%d\t%d\t%f\t%f\t%f\n",totfragments[chrombait[i]-1]+cgrid(chro
}
}
}
if(pchic==1){
if(hic[i][j]!=0){fprintf(gff,"%s\tICE\t%s\t%d\t%d\t%d\t+\t0\t.\n",record[chromgrid[j]].name_chromosome,sbait,gridpoints[chromgrid[j]][j-(totfragments[chromgrid[j]-1]+1)],gridpoints[chromgrid[j]][j-(totfragments[chromgrid[j]-1])],hic[i][j]);}
}
}

fclose(peakC);
Expand Down Expand Up @@ -818,7 +824,7 @@ sprintf(command,"sed -i 's/chr//' %s",concat(concat(outdir,lane),".tsv"));
system(command);
printf("%s\n",command);

sprintf(command,"R --vanilla < %sPEAKY.R --args %s %s %s %s %d ",folderrefC,outdir,concat(concat(concat(concat(outdir,lane),"_Z"),zom),".pkY"),concat(outdir,"/bins/"),concat(concat(outdir,lane),".tsv"),window);
sprintf(command,"R --no-save < %sPEAKY.R --args %s %s %s %s %d ",folderrefC,outdir,concat(concat(concat(concat(outdir,lane),"_Z"),zom),".pkY"),concat(outdir,"/bins/"),concat(concat(outdir,lane),".tsv"),window);
printf("%s\n",command);
system(command);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions referenceC/shiftrev.c → reference_C/shiftrev.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define LINE_MAX 0x4000

Expand Down Expand Up @@ -76,9 +77,9 @@ if(strncmp(vflag[i],"16",2)==0){
while(*c!=0)
{
char* p2;
if(!isdigit(*c)) { fprintf(stderr,"bad cigar string: %s\n",*cigar); return 0; }
if(!isdigit(*c)) { fprintf(stderr,"bad cigar string: %s\n",cigar); return 0; }
int n=strtol(c,&p2,10);
if(n<1){ fprintf(stderr,"bad cigar string: %s\n",*cigar); return 0; }
if(n<1){ fprintf(stderr,"bad cigar string: %s\n",cigar); return 0; }
switch(*p2)
{
case 'M':{ while(n>0) { icount++; --n; } break; }
Expand All @@ -97,9 +98,9 @@ if(strncmp(vflag[j],"16",2)==0){
while(*c!=0)
{
char* p2;
if(!isdigit(*c)) { fprintf(stderr,"bad cigar string: %s\n",*cigar); return 0; }
if(!isdigit(*c)) { fprintf(stderr,"bad cigar string: %s\n",cigar); return 0; }
int n=strtol(c,&p2,10);
if(n<1){ fprintf(stderr,"bad cigar string: %s\n",*cigar); return 0; }
if(n<1){ fprintf(stderr,"bad cigar string: %s\n",cigar); return 0; }
switch(*p2)
{
case 'M':{ while(n>0) { jcount++; --n; } break; }
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions referenceC/trim_galore → reference_C/trim_galore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ file_sanity_check($filenames[0]);

########################################################################

my $path_to_fastqc = '/usr/bin/fastqc';
my $path_to_fastqc = '/well/jknight/software/rescomp/bin/fastqc';

# Before we start let's have quick look if Cutadapt seems to be working with the path information provided
# To change the path to Cutadapt use --path_to_cutadapt /full/path/to/the/Cutadapt/executable
Expand All @@ -54,7 +54,7 @@ if(defined $path_to_cutadapt){
# we'll simply use this
}
else{
$path_to_cutadapt = '/usr/people/whgu0738/.local/bin/cutadapt'; # default, assuming it is in the PATH
$path_to_cutadapt = '/apps/well/python/2.7.11/bin/cutadapt'; # default, assuming it is in the PATH
warn "Path to Cutadapt set as: '$path_to_cutadapt' (default)\n";
}
my $cutadapt_version;
Expand Down Expand Up @@ -338,7 +338,7 @@ sub trim{
warn " >>> Now performing adaptive quality trimming with a Phred-score cutoff of: $cutoff <<<\n\n";
sleep (1);

open (QUAL,"$path_to_cutadapt -e $error_rate -q $cutoff -a X $filename |") or die "Can't open pipe to Cutadapt: $!";
open (QUAL,"$path_to_cutadapt -f fastq -e $error_rate -q $cutoff -a X $filename |") or die "Can't open pipe to Cutadapt: $!";

my $qual_count = 0;

Expand Down Expand Up @@ -417,19 +417,19 @@ sub trim{
if ( scalar(@filenames)%2 == 0){ # this is read 1 of a pair
warn "\n >>> Now performing adapter trimming for the adapter sequence: '$adapter' from file $temp <<< \n";
sleep (1);
$pid = open3 (\*WRITER, \*TRIM, \*ERROR,"$path_to_cutadapt -e $error_rate -O $stringency -a $adapter $output_dir$temp") or die "Failed to launch Cutadapt: $!\n";
$pid = open3 (\*WRITER, \*TRIM, \*ERROR,"$path_to_cutadapt -f fastq -e $error_rate -O $stringency -a $adapter $output_dir$temp") or die "Failed to launch Cutadapt: $!\n";
}
else{ # this is read 2 of a pair
warn "\n >>> Now performing adapter trimming for the adapter sequence: '$a2' from file $temp <<< \n";
sleep (1);
$pid = open3 (\*WRITER, \*TRIM, \*ERROR,"$path_to_cutadapt -e $error_rate -O $stringency -a $a2 $output_dir$temp") or die "Failed to launch Cutadapt: $!\n";
$pid = open3 (\*WRITER, \*TRIM, \*ERROR,"$path_to_cutadapt -f fastq -e $error_rate -O $stringency -a $a2 $output_dir$temp") or die "Failed to launch Cutadapt: $!\n";
}
}
### Using the same adapter for both read 1 and read 2
else{
warn "\n >>> Now performing adapter trimming for the adapter sequence: '$adapter' from file $temp <<< \n";
sleep (3);
$pid = open3 (\*WRITER, \*TRIM, \*ERROR,"$path_to_cutadapt -e $error_rate -O $stringency -a $adapter $output_dir$temp") or die "Failed to launch Cutadapt: $!\n";
$pid = open3 (\*WRITER, \*TRIM, \*ERROR,"$path_to_cutadapt -f fastq -e $error_rate -O $stringency -a $adapter $output_dir$temp") or die "Failed to launch Cutadapt: $!\n";
}

close WRITER or die $!; # not needed
Expand Down Expand Up @@ -587,19 +587,19 @@ sub trim{
if ( scalar(@filenames)%2 == 0){ # this is read 1 of a pair
warn "\n >>> Now performing quality (cutoff $cutoff) and adapter trimming in a single pass for the adapter sequence: '$adapter' from file $filename <<< \n";
sleep (1);
$pid = open3 (\*WRITER, \*TRIM, \*ERROR, "$path_to_cutadapt -e $error_rate -q $cutoff -O $stringency $trim_n -a $adapter $filename") or die "Failed to launch Cutadapt: $!";
$pid = open3 (\*WRITER, \*TRIM, \*ERROR, "$path_to_cutadapt -f fastq -e $error_rate -q $cutoff -O $stringency $trim_n -a $adapter $filename") or die "Failed to launch Cutadapt: $!";
}
else{ # this is read 2 of a pair
warn "\n >>> Now performing quality (cutoff $cutoff) and adapter trimming in a single pass for the adapter sequence: '$a2' from file $filename <<< \n";
sleep (1);
$pid = open3 (\*WRITER, \*TRIM, \*ERROR, "$path_to_cutadapt -e $error_rate -q $cutoff -O $stringency $trim_n -a $a2 $filename") or die "Failed to launch Cutadapt: $!";
$pid = open3 (\*WRITER, \*TRIM, \*ERROR, "$path_to_cutadapt -f fastq -e $error_rate -q $cutoff -O $stringency $trim_n -a $a2 $filename") or die "Failed to launch Cutadapt: $!";
}
}
### Using the same adapter for both read 1 and read 2
else{
warn "\n >>> Now performing quality (cutoff $cutoff) and adapter trimming in a single pass for the adapter sequence: '$adapter' from file $filename <<< \n";
sleep (1);
$pid = open3 (\*WRITER, \*TRIM, \*ERROR, "$path_to_cutadapt -e $error_rate -q $cutoff -O $stringency $trim_n -a $adapter $filename") or die "Failed to launch Cutadapt: $!";
$pid = open3 (\*WRITER, \*TRIM, \*ERROR, "$path_to_cutadapt -f fastq -e $error_rate -q $cutoff -O $stringency $trim_n -a $adapter $filename") or die "Failed to launch Cutadapt: $!";
}

close WRITER or die $!; # not needed
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.