Skip to content

Commit

Permalink
mrcanavar-auto outfile fix for cloud environment
Browse files Browse the repository at this point in the history
  • Loading branch information
calkan committed Mar 18, 2019
1 parent 8af1a47 commit 229c914
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ RUN mkdir /mrcanavar
RUN mkdir /input
RUN mkdir /output
WORKDIR /mrcanavar
RUN wget https://github.com/BilkentCompGen/mrcanavar/archive/v1.2.1.tar.gz
RUN wget https://github.com/BilkentCompGen/mrcanavar/archive/v1.2.2.tar.gz
RUN wget https://github.com/calkan/mrsfast/archive/3.4.8.tar.gz
RUN tar zxf v1.2.1.tar.gz
RUN tar zxf v1.2.2.tar.gz
RUN tar zxf 3.4.8.tar.gz
RUN cd mrcanavar-1.2.1 && make && make install && cd /
RUN cd mrcanavar-1.2.2 && make && make install && cd /
RUN cd mrsfast-3.4.8 && make && cp mrsfast /usr/local/bin && cd /
RUN rm -f v1.2.1.tar.gz 3.4.8.tar.gz
RUN rm -f v1.2.2.tar.gz 3.4.8.tar.gz
VOLUME /input
VOLUME /output
4 changes: 2 additions & 2 deletions globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define MAX_STR 256
#define GC_BIN 1000

#define VERSION "1.2"
#define LAST_UPDATE "March 15, 2019"
#define VERSION "1.2.2"
#define LAST_UPDATE "March 18, 2019"


enum MODETYPE {NONE, PREP, READSAM, CALL, CONC};
Expand Down
21 changes: 13 additions & 8 deletions mrcanavar-auto.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ int parse_command_line( int argc, char** argv)
{"no-gz" , no_argument, &uncompressed, 1},
{"no-sam" , no_argument, &nosam, 1},
{"dry-run" , no_argument, &dry_run, 1},
{"cloud" , no_argument, &do_cloud, 1},
{0 , 0, 0, 0 }
};

Expand Down Expand Up @@ -156,7 +157,8 @@ int main (int argc, char **argv){

char cmd_line[1048576];
char tmp_line[1048576];

char out_file[1024];

int bam_mode;
char outcomp[32];

Expand Down Expand Up @@ -236,7 +238,7 @@ int main (int argc, char **argv){
fprintf(stderr, "[WARNING]: --no-sam option works only one FASTQ or BAM/CRAM file is supplied. Removing the parameter from consideration.\n");
nosam = 0;
}

/* map */
if (!nosam){
for (i=0; i<number_of_fastq; i++){
Expand Down Expand Up @@ -266,14 +268,17 @@ int main (int argc, char **argv){
for (i=0; i<number_of_fastq; i++)
fastq_files[i] = pacman_directories(fastq_files[i]);
}

strcpy(out_file, fastq_files[0]);
fprintf(stderr, "[OUT_FILE] %s\n", out_file);

/* read */

if (number_of_fastq == 1){
if (uncompressed)
sprintf(cmd_line, "mrcanavar --read -conf %s -samlist %s.sam -depth %s.depth", cnvr_conf, fastq_files[0], fastq_files[0]);
sprintf(cmd_line, "mrcanavar --read -conf %s -samlist %s.sam -depth %s.depth", cnvr_conf, fastq_files[0], out_file);
else
sprintf(cmd_line, "mrcanavar --read --gz -conf %s -samlist %s.sam.gz -depth %s.depth", cnvr_conf, fastq_files[0], fastq_files[0]);
sprintf(cmd_line, "mrcanavar --read --gz -conf %s -samlist %s.sam.gz -depth %s.depth", cnvr_conf, fastq_files[0], out_file);
}
else{
tmp_line[0] = 0;
Expand All @@ -291,9 +296,9 @@ int main (int argc, char **argv){
strcat(tmp_line, ".sam.gz");

if (uncompressed)
sprintf(cmd_line, "mrcanavar --read -conf %s -samlist %s -depth %s.depth", cnvr_conf, tmp_line, fastq_files[0]);
sprintf(cmd_line, "mrcanavar --read -conf %s -samlist %s -depth %s.depth", cnvr_conf, tmp_line, out_file);
else
sprintf(cmd_line, "mrcanavar --read --gz -conf %s -samlist %s -depth %s.depth", cnvr_conf, tmp_line, fastq_files[0]);
sprintf(cmd_line, "mrcanavar --read --gz -conf %s -samlist %s -depth %s.depth", cnvr_conf, tmp_line, out_file);

}

Expand All @@ -317,7 +322,7 @@ int main (int argc, char **argv){
sprintf(tmp_line, "samtools view -@ %d -T %s %s | awk '{print \">\"$1\"\\n\"$10}' | mrsfast %s --search %s --seq /dev/stdin -t %d --mem %d --crop %d -e 2 -o /dev/stdout --disable-nohits", num_threads, unmasked_ref_genome, fastq_files[0], is_cloud, ref_genome, num_threads, mem, kmerlen);
}

sprintf(cmd_line, "%s | mrcanavar --read -conf %s -samstdin -depth %s.depth", tmp_line, cnvr_conf, fastq_files[0]);
sprintf(cmd_line, "%s | mrcanavar --read -conf %s -samstdin -depth %s.depth", tmp_line, cnvr_conf, out_file);

fprintf(stderr, "[MAP AND READ] %s\n", cmd_line);
if (!dry_run)
Expand All @@ -327,7 +332,7 @@ int main (int argc, char **argv){

/* call */

sprintf(cmd_line, "mrcanavar --call -conf %s -depth %s.depth -gene %s -o %s-out", cnvr_conf, fastq_files[0], gene_list, fastq_files[0]);
sprintf(cmd_line, "mrcanavar --call -conf %s -depth %s.depth -gene %s -o %s-out", cnvr_conf, out_file, gene_list, out_file);
fprintf(stderr, "[CALL COPY NUMBERS] %s\n", cmd_line);
if (!dry_run)
ret = system(cmd_line);
Expand Down

0 comments on commit 229c914

Please sign in to comment.