-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from BU-ISCIII/develop
Release 2.1.0 from develop.
- Loading branch information
Showing
30 changed files
with
299 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,13 +262,34 @@ def create_structure(self): | |
return | ||
|
||
def post_delivery_info(self): | ||
delivery_notes = bu_isciii.utils.ask_for_some_text( | ||
msg="Write some delivery notes:" | ||
) | ||
if bu_isciii.utils.prompt_yn_question( | ||
msg="Do you wish to provide a text file for delivery notes?", dflt=False | ||
): | ||
for i in range(3, -1, -1): | ||
self.provided_txt = bu_isciii.utils.prompt_path( | ||
msg="Write the path to the file with RAW text as delivery notes" | ||
) | ||
if not os.path.isfile(os.path.expanduser(self.provided_txt)): | ||
stderr.print(f"Provided file doesn't exist. Attempts left: {i}") | ||
else: | ||
stderr.print(f"File selected: {self.provided_txt}") | ||
break | ||
else: | ||
stderr.print("No more attempts. Delivery notes will be given by prompt") | ||
self.provided_txt = None | ||
else: | ||
self.provided_txt = None | ||
|
||
if self.provided_txt: | ||
with open(os.path.expanduser(self.provided_txt)) as f: | ||
self.delivery_notes = " ".join([x.strip() for x in f.readlines()]) | ||
else: | ||
self.delivery_notes = bu_isciii.utils.ask_for_some_text( | ||
msg="Write some delivery notes:" | ||
) | ||
delivery_dict = { | ||
"resolution_number": self.resolution_id, | ||
"delivery_notes": delivery_notes, | ||
"delivery_notes": self.delivery_notes, | ||
} | ||
|
||
# How json should be fully formatted: | ||
|
@@ -568,9 +589,15 @@ def email_creation(self): | |
if bu_isciii.utils.prompt_yn_question( | ||
"Do you want to add some delivery notes to the e-mail?", dflt=False | ||
): | ||
email_data["email_notes"] = bu_isciii.utils.ask_for_some_text( | ||
msg="Write email notes" | ||
) | ||
if self.provided_txt: | ||
if bu_isciii.utils.prompt_yn_question( | ||
f"Do you want to use notes from {self.provided_txt}?", dflt=False | ||
): | ||
email_data["email_notes"] = self.delivery_notes | ||
else: | ||
email_data["email_notes"] = bu_isciii.utils.ask_for_some_text( | ||
msg="Write email notes" | ||
) | ||
|
||
email_data["user_data"] = self.resolution_info["service_user_id"] | ||
email_data["service_id"] = self.service_name.split("_", 5)[0] | ||
|
@@ -604,7 +631,7 @@ def send_email(self, html_text, results_pdf_file): | |
server.login(user=email_host_user, password=email_host_password) | ||
except Exception as e: | ||
stderr.print("[red] Unable to send e-mail" + e) | ||
|
||
default_cc = "[email protected]" | ||
msg = MIMEMultipart("alternative") | ||
msg["To"] = self.resolution_info["service_user_id"]["email"] | ||
msg["From"] = email_host_user | ||
|
@@ -617,18 +644,21 @@ def send_email(self, html_text, results_pdf_file): | |
+ self.service_name.split("_", 5)[2] | ||
) | ||
if bu_isciii.utils.prompt_yn_question( | ||
"Do you want to add any other sender? appart from " | ||
+ self.resolution_info["service_user_id"]["email"], | ||
"Do you want to add any other sender? apart from %s. Note: %s is the default CC." | ||
% (self.resolution_info["service_user_id"]["email"], default_cc), | ||
dflt=False, | ||
): | ||
stderr.print( | ||
"[red] Write emails to be added in semicolon separated format: bioinformatica@isciii.es;icuesta@isciii.es" | ||
"[red] Write emails to be added in semicolon separated format: icuesta@isciii.es;user2@isciii.es" | ||
) | ||
msg["CC"] = bu_isciii.utils.ask_for_some_text(msg="E-mails:") | ||
rcpt = msg["CC"].split(";") + [msg["To"]] | ||
cc_address = bu_isciii.utils.ask_for_some_text(msg="E-mails:") | ||
else: | ||
rcpt = self.resolution_info["service_user_id"]["email"] | ||
|
||
cc_address = str() | ||
if cc_address: | ||
msg["CC"] = str(default_cc + ";" + str(cc_address)) | ||
else: | ||
msg["CC"] = default_cc | ||
rcpt = msg["CC"].split(";") + [msg["To"]] | ||
html = MIMEText(html_text, "html") | ||
msg.attach(html) | ||
with open(results_pdf_file, "rb") as f: | ||
|
@@ -639,7 +669,6 @@ def send_email(self, html_text, results_pdf_file): | |
filename=str(os.path.basename(results_pdf_file)), | ||
) | ||
msg.attach(attach) | ||
|
||
server.sendmail( | ||
email_host_user, | ||
rcpt, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...i/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/01-preprocessing/lablog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
...sciii/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/02-ariba/run/lablog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
# conda activate ariba | ||
# ARIBA runs local assembli/processing_Data/bioinformatics/services_and_colaborations/CNM/bacteriologia/20190821_QCASSEMBLT_s.gonzalez_T/RAW/fastqc_2/. | ||
|
||
mkdir logs | ||
scratch_dir=$(echo $PWD | sed 's/\/data\/bi\/scratch_tmp/\/scratch/g') | ||
downloaded_ref=$(find ../../../../REFERENCES/ -type d -name 'ref_db') | ||
|
||
# Cartesian product of the two files to avoid double looping | ||
join -j 2 ../../samples_id.txt ../databases.txt | sed 's/^ //g' > sample_database.txt | ||
|
||
# col 1 (arr[0]): sample | ||
# col 2 (arr[1]): database | ||
cat sample_database.txt | while read in; do arr=($in); echo "mkdir -p ${arr[0]}; srun --chdir $scratch_dir --output logs/ARIBA${arr[0]}_${arr[1]}.%j.log --job-name ARIBA_${arr[0]}_${arr[1]} --cpus-per-task 5 --mem 5G --partition short_idx --time 02:00:00 ariba run /data/bi/references/ariba/20211216/${arr[1]}/out.${arr[1]}.prepareref ../../../*ASSEMBLY/01-preprocessing/trimmed_sequences/${arr[0]}_1.trim.fastq.gz ../../../*ASSEMBLY/01-preprocessing/trimmed_sequences/${arr[0]}_2.trim.fastq.gz ${arr[0]}/out_${arr[1]}_${arr[0]}_run &"; done > _01_ariba.sh | ||
cat sample_database.txt | while read in; do arr=($in); echo "mv ${arr[0]}/out_${arr[1]}_${arr[0]}_run/report.tsv ${arr[0]}/out_${arr[1]}_${arr[0]}_run/${arr[0]}_${arr[1]}_report.tsv"; done > _02_fix_tsvreport.sh | ||
cat sample_database.txt | grep -v 'pubmlst' | while read in; do arr=($in); echo "mkdir -p ${arr[0]}; srun --chdir $scratch_dir --output logs/ARIBA_${arr[0]}_${arr[1]}.%j.log --job-name ARIBA_${arr[0]}_${arr[1]} --cpus-per-task 5 --mem 5G --partition short_idx --time 02:00:00 ariba run /data/bi/references/ariba/20211216/${arr[1]}/out.${arr[1]}.prepareref ../../01-preprocessing/${arr[0]}/${arr[0]}_R1_filtered.fastq.gz ../../01-preprocessing/${arr[0]}/${arr[0]}_R2_filtered.fastq.gz ${arr[0]}/out_${arr[1]}_${arr[0]}_run &"; done > _01_ariba.sh | ||
|
||
cat ../samples_id.txt | while read in; echo "mkdir -p ${arr[0]}; srun --chdir $scratch_dir --output logs/ARIBA_${in}_pubmlst.%j.log --job-name ARIBA_${in}_pubmlst --cpus-per-task 5 --mem 5G --partition short_idx --time 02:00:00 ariba run ${downloaded_ref} ../../01-preprocessing/${in}/${in}_R1_filtered.fastq.gz ../../01-preprocessing/${in}/${in}_R2_filtered.fastq.gz ${in}/out_pubmlst_${in}_run &"; done > _01_ariba.sh | ||
|
||
cat sample_database.txt | while read in; do arr=($in); echo "mv ${arr[0]}/out_${arr[1]}_${arr[0]}_run/report.tsv ${arr[0]}/out_${arr[1]}_${arr[0]}_run/${arr[0]}_${arr[1]}_report.tsv"; done > _02_fix_tsvreport.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
bu_isciii/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/lablog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
ln -s ../samples_id.txt . | ||
ln -s ../00-reads . | ||
mkdir 01-preprocessing | ||
mkdir 02-srst2 | ||
mkdir 03-ariba | ||
mkdir 99-stats |
File renamed without changes.
Oops, something went wrong.