Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Anders Jemt <jemten@users.noreply.github.com>
  • Loading branch information
Lucpen and jemten authored Sep 6, 2023
1 parent 62fb1b8 commit c8db934
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions bin/drop_filter_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
def FilteringResults(samples: list, gene_panel: str, out_drop_ae_rds: str, out_drop_gene_name: str, out_drop_as_tsv: str):
# Read gene panel if it has been provided
if gene_panel != "None":
df_panel = pd.read_csv(gene_panel, sep="\t", skiprows=26)
gene_panel_header = ['chromosome', 'gene_start', 'gene_stop' 'hgnc_id', 'hgnc_symbol']
df_panel = pd.read_csv(gene_panel, sep="\t", names=gene_panel_header, header=None, comment='#')

if out_drop_ae_rds != "None":
rds_AE = pyreadr.read_r(out_drop_ae_rds)
Expand All @@ -18,7 +19,7 @@ def FilteringResults(samples: list, gene_panel: str, out_drop_ae_rds: str, out_d
# Count how many events are significant per provided sample
df_family_AE_top20 = pd.DataFrame()

for id in sample:
for id in samples:
df_id = df_results_family_AE[df_results_family_AE["sampleID"] == id]
if sum(df_id["padjust"] < 0.05) < 20:
df_id = df_id.sort_values(by=["pValue"]).reset_index()
Expand Down
2 changes: 1 addition & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ process {
}

withName: '.*ANALYSE_TRANSCRIPTS:DROP_FILTER_RESULTS' {
ext.when = {params.run_drop_ae|params.run_drop_as}
ext.when = {params.run_drop_ae | params.run_drop_as}
publishDir = [
path: { "${params.outdir}/analyse_transcripts/drop" },
mode: params.publish_dir_mode,
Expand Down
2 changes: 1 addition & 1 deletion modules/local/drop_config_runAE.nf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ process DROP_CONFIG_RUN_AE {
snakemake aberrantExpression --cores ${task.cpus} --rerun-triggers mtime
cp output/processed_results/aberrant_expression/*/outrider/outrider/OUTRIDER_results_all.Rds .
cp output/processed_data/preprocess/*/gene_name_mapping_* .
cp output/processed_data/preprocess/*/gene_name_mapping_*.tsv .
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
2 changes: 1 addition & 1 deletion modules/local/drop_config_runAS.nf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ process DROP_CONFIG_RUN_AS {
snakemake aberrantSplicing --cores ${task.cpus} --rerun-triggers mtime
cp output/html/AberrantSplicing/FRASER_results_fraser--* .
cp output/html/AberrantSplicing/FRASER_results_fraser--*.tsv .
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
3 changes: 2 additions & 1 deletion modules/local/drop_filter_results.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ process DROP_FILTER_RESULTS {

script:
def ids = "${samples.id}".replace("[","").replace("]","").replace(",","")
def gene_panel_filter = gene_panel_clinical_filter ? "--gene_panel ${gene_panel_clinical_filer}" : ''

"""
$baseDir/bin/drop_filter_results.py \\
--sample $ids \\
--gene_panel ${gene_panel_clinical_filter} \\
$gene_panel_filer \\
--drop_ae_rds ${out_drop_ae_rds} \\
--out_drop_gene_name ${out_drop_gene_name} \\
--out_drop_as_tsv ${out_drop_as_tsv}
Expand Down

0 comments on commit c8db934

Please sign in to comment.