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

Fix s3 output #73

Merged
merged 4 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 7 additions & 3 deletions bTB-WGS_process.nf
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ FirstFile = file( params.reads ).first()
params.DataDir = TopDir.last()
params.today = new Date().format('ddMMMYY')

seqplate = "${params.DataDir}"

publishDir = "$params.outdir/Results_${params.DataDir}_${params.today}/"

commitId = "${workflow.commitId}"

/* remove duplicates from raw data
This process removes potential duplicate data (sequencing and optical replcaites from the raw data set */
process Deduplicate {
Expand Down Expand Up @@ -334,14 +338,14 @@ process CombineOutput {
publishDir "$params.outdir/Results_${params.DataDir}_${params.today}", mode: 'copy', pattern: '*.csv'

input:
file('Assigned.csv') from Assigned
file('Qbovis.csv') from Qbovis
file('assigned_csv') from Assigned
file('qbovis_csv') from Qbovis

output:
file('*.csv') into FinalOut

"""
combineCsv.py Assigned.csv Qbovis.csv ${params.DataDir}
combineCsv.py assigned_csv qbovis_csv $seqplate $commitId
"""
}

Expand Down
7 changes: 4 additions & 3 deletions bin/combineCsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import os
from datetime import datetime, date

def combine(assigned_csv, bovis_csv, seq_run, read_threshold, abundance_threshold):
def combine(assigned_csv, bovis_csv, seq_run, commitId, read_threshold, abundance_threshold):

date_out = date.today().strftime('%d%b%y')
user = getpass.getuser()
scriptpath = os.path.dirname(os.path.abspath(__file__))
repo = git.Repo(scriptpath, search_parent_directories=True)
commit = repo.head.object.__str__()
#commit = repo.head.object.__str__()
Copy link
Member

Choose a reason for hiding this comment

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

remove the commented line?


#Read Assigned Clade csv and replace blank cells with 'NA'
assigned_df = pd.read_csv(assigned_csv)
Expand Down Expand Up @@ -51,14 +51,15 @@ def combine(assigned_csv, bovis_csv, seq_run, read_threshold, abundance_threshol

#Append log info
with open("{}_FinalOut_{}.csv".format(seq_run, date_out), "a") as outFile:
outFile.write("# Operator: " +user +"\n" +"# BovTB-nf commit: " +commit)
outFile.write("# Operator: " +user +"\n" +"# BovTB-nf commit: " +commitId)
outFile.close

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('assigned_csv', help='path to AssignedWGSClade.csv')
parser.add_argument('bovis_csv', help='path to Bovis.csv')
parser.add_argument('seq_run', help='Unique sequencer run number')
parser.add_argument('commitId', help='Nextflow capture of git commit')
parser.add_argument('--read_threshold', type=int, default=500, help='threshold for number of M.bovis reads')
parser.add_argument('--abundance_threshold', type=int, default=1, help='threshold for M.bovis abundance')

Expand Down