Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #7

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
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
12 changes: 6 additions & 6 deletions descriptions/ascat.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ hints:
baseCommand: [run_ascat.sh]

inputs:
- id: tumor_file
- id: input_tumor_bam
type: File
inputBinding:
prefix: "--tumor_file"
prefix: "--input_tumor_bam"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this expected to be changed right? just checking is not a unintended search and replace results

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is looking at the rest of the code, but just to double check I am leaving this comment here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these variable names match the expected variable names to create metaworkflows runs through magma

secondaryFiles:
- .bai
doc: tumor sample BAM file

- id: normal_file
- id: input_normal_bam
type: File
inputBinding:
prefix: "--normal_file"
prefix: "--input_normal_bam"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

secondaryFiles:
- .bai
doc: normal sample BAM file

- id: gender
type: string
inputBinding:
prefix: "--gender"
doc: gender
prefix: "--gender"
doc: Gender. Possible values are XX, F, XY, M

- id: nthreads
type: int
Expand Down
2 changes: 2 additions & 0 deletions dockerfiles/ascat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ WORKDIR /usr/local/bin
RUN conda install -c bioconda -y r-base==4.1.0 ascat==3.0.0 cancerit-allelecount==4.3.0 && \
conda clean -a -y -f

RUN conda install -c conda-forge pkg-config

## other R packages
RUN R -e "install.packages('optparse', repos='http://cran.rstudio.com/')"
RUN R -e "install.packages('tidyverse', repos='http://cran.rstudio.com/')"
Expand Down
21 changes: 16 additions & 5 deletions dockerfiles/ascat/run_ascat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ WORKDIR="/usr/local/bin"

while [ "$1" != "" ]; do
case $1 in
--tumor_file)
--input_tumor_bam)
shift
tumor_file=$1
input_tumor_bam=$1
;;
--normal_file)
--input_normal_bam)
shift
normal_file=$1
input_normal_bam=$1
;;
--gender)
shift
Expand All @@ -30,6 +30,17 @@ done

tar -xzf $reference_data

Rscript $WORKDIR/ascat.R --tumor_file $tumor_file --normal_file $normal_file --gender $gender --nthreads $nthreads || exit 1
if [ $gender == "M" ]
then
gender="XY"
fi

if [ $gender == "F" ]
then
gender="XX"
fi


Rscript $WORKDIR/ascat.R --input_tumor_bam $input_tumor_bam --input_normal_bam $input_normal_bam --gender $gender --nthreads $nthreads || exit 1
gzip cnv_ascat.tsv || exit 1
gzip BAF_LogR_tumor_germline.tsv || exit 1
18 changes: 9 additions & 9 deletions dockerfiles/ascat/scripts/ascat.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ measures_file_name <- "BAF_LogR_tumor_germline.tsv"

option_list <- list(
make_option(
c("--tumor_file"),
c("--input_tumor_bam"),
action = "store",
type = "character",
help = "Tumor sample in BAM"
),

make_option(
c("--normal_file"),
c("--input_normal_bam"),
action = "store",
type = "character",
help = "Normal sample in BAM"
Expand All @@ -33,7 +33,7 @@ option_list <- list(
c("--gender"),
type = "character",
action = "store",
help = "Gender"
help = "gender"
),
make_option(
c("--nthreads"),
Expand All @@ -46,14 +46,14 @@ option_list <- list(


REQUIRED_PARAMS <-
c("tumor_file",
"normal_file",
c("input_tumor_bam",
"input_normal_bam",
"gender")

opt = parse_args(OptionParser(option_list = option_list))

if (is.null(opt$tumor_file) |
is.null(opt$normal_file) | is.null(opt$gender)) {
if (is.null(opt$input_tumor_bam) |
is.null(opt$input_normal_bam) | is.null(opt$gender)) {
stop(paste(
c("Specify all required parameters: ", REQUIRED_PARAMS),
collapse = " "
Expand All @@ -70,8 +70,8 @@ library(tidyverse)
library(tidyr)

ascat.prepareHTS(
tumourseqfile = opt$tumor_file,
normalseqfile = opt$normal_file,
tumourseqfile = opt$input_tumor_bam,
normalseqfile = opt$input_normal_bam,
tumourname = tumor_name,
normalname = normal_name,
allelecounter_exe = "/miniconda3/bin/alleleCounter",
Expand Down
19 changes: 12 additions & 7 deletions dockerfiles/genomic_ranges/scripts/postprocess_ascat.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ gene_table <- read.table(gzfile(opt$cgap_genes),
sep = '\t',
header = TRUE)

#calculating mid point and storing it under pos as it will be the position of drivers displayed on Chromoscope
gene_table["pos"] = gene_table["start"] + round(((gene_table["end"] - gene_table["start"])/2))


# create genes genomic ranges obj
genes.gr <- GRanges(
seqnames = Rle(paste0('chr', gene_table$chr)),
Expand Down Expand Up @@ -150,28 +154,29 @@ final$deletion <-
TRUE,
FALSE)


final$top_category <- "CNV"
#select only relevant fields
final <-
final %>% select(
gene,
chr,
start,
end,
pos,
max_subjectHits,
min_subjectHits,
amplification,
partial_amplification,
deletion,
top_category
) %>% filter(amplification==TRUE | partial_amplification==TRUE | deletion==TRUE)

final$category[final$amplification == TRUE | final$partial_amplification == TRUE ] <- "amplification"

final$category[final$amplification == TRUE | final$partial_amplification == TRUE] <- "amplification"
final$category[final$deletion==TRUE] <- "deletion"

final <- final %>% select(gene,
chr,
start,
end,
category) %>% rename(chrom = chr) #rename it for GosCan
pos,
category,
top_category) %>% rename(chrom = chr) #rename it for Chromoscope

write.table(final, file=opt$output, sep='\t',row.names = FALSE, quote=FALSE)
13 changes: 7 additions & 6 deletions portal_objects/metaworkflows/WGS_CNV_somatic_ascat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ description: Call CNVs on tumor-normal samples with ASCAT. |
#############################################################
input:

tumor_file:
input_tumor_bam:
argument_type: file.bam
dimensionality: 1

normal_file:
input_normal_bam:
argument_type: file.bam
dimensionality: 1

gender:
sex:
argument_type: parameter.string

nthreads:
argument_type: parameter.integer
value: "23"

reference_data:
argument_type: file.tar_gz
Expand Down Expand Up @@ -54,20 +55,20 @@ workflows:
####################################
input:

tumor_file:
input_tumor_bam:
argument_type: file.bam
input_dimension: 1

normal_file:
input_normal_bam:
argument_type: file.bam
input_dimension: 1

gender:
argument_type: parameter.string
source_argument_name: sex

nthreads:
argument_type: parameter.integer
value: "23"

reference_data:
argument_type: file.tar_gz
Expand Down
4 changes: 2 additions & 2 deletions portal_objects/workflows/ascat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ software:
#############################################################
input:

tumor_file:
input_tumor_bam:
argument_type: file.bam

normal_file:
input_normal_bam:
argument_type: file.bam

gender:
Expand Down