Skip to content

Commit

Permalink
Merge pull request #5 from theiagen/smw-coverage-file-fix
Browse files Browse the repository at this point in the history
Check if files exist and update the coverage value to be the correct one
  • Loading branch information
kapsakcj authored Oct 25, 2024
2 parents 0b70211 + 486b744 commit bd20199
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG MERCURY_VER="1.0.8"
ARG MERCURY_VER="1.0.9"

FROM google/cloud-sdk:480.0.0-slim

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ Default databases by organism:
We highly recommend using the following Docker image to run Mercury:

```bash
docker pull us-docker.pkg.dev/general-theiagen/theiagen/mercury:1.0.8
docker pull us-docker.pkg.dev/general-theiagen/theiagen/mercury:1.0.9
```

The entrypoint for this Docker image is the Mercury help message. To run this container interactively, use the following command:

```bash
docker run -it --entrypoint=/bin/bash us-docker.pkg.dev/general-theiagen/theiagen/mercury:1.0.8
docker run -it --entrypoint=/bin/bash us-docker.pkg.dev/general-theiagen/theiagen/mercury:1.0.9
# Once inside the container interactively, you can run the mercury tool
python3 /mercury/mercury/mercury.py -v
# v1.0.8
# v1.0.9
```

### Locally with Python
Expand Down
2 changes: 1 addition & 1 deletion mercury/Runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, options):
if self.clearlabs_data:
self.read1_column_name = "clearlabs_fastq_gz"
self.assembly_fasta_column_name = "clearlabs_fasta"
self.assembly_mean_coverage_column_name = "clearlabs_assembly_coverage"
self.assembly_mean_coverage_column_name = "clearlabs_sequencing_depth"

if self.reads_dehosted:
self.read1_column_name = "reads_dehosted"
Expand Down
18 changes: 13 additions & 5 deletions mercury/Table.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,21 @@ def make_sra_csv(self):

self.logger.info("TABLE:Copying over SRA files to the indicated GCP bucket ({})".format(self.gcp_bucket_uri))
for oldname, newname in read_tuples:
transfer_command = "gcloud storage cp " + oldname + " " + self.gcp_bucket_uri + "/" + newname
self.logger.debug("TABLE:Running command: " + transfer_command)
check_if_transferred_command = "gcloud storage ls " + self.gcp_bucket_uri + "/" + newname
self.logger.debug("TABLE:Running command: " + check_if_transferred_command)
try:
subprocess.run(transfer_command, shell=True, check=True)
subprocess.run(check_if_transferred_command, shell=True, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
self.logger.warning("TABLE:Warning: A file with an identical name was found in the destination Google bucket; data transfer will be skipped.")
except:
self.logger.error("TABLE:Error: non-zero exit code when copying files to GCP bucket ({})".format(self.gcp_bucket_uri))
sys.exit(1)
self.logger.debug("TABLE:The data did not appear in the bucket; now attempting to transfer the data")

transfer_command = "gcloud storage cp " + oldname + " " + self.gcp_bucket_uri + "/" + newname
self.logger.debug("TABLE:Running command: " + transfer_command)
try:
subprocess.run(transfer_command, shell=True, check=True)
except:
self.logger.error("TABLE:Error: non-zero exit code when copying files to GCP bucket ({})".format(self.gcp_bucket_uri))
sys.exit(1)

self.logger.info("TABLE:Files copied to the indicated GCP bucket ({})".format(self.gcp_bucket_uri))
self.logger.debug("TABLE:SRA metadata file created and data transferred")
Expand Down
2 changes: 1 addition & 1 deletion mercury/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "v1.0.8"
__VERSION__ = "v1.0.9"

0 comments on commit bd20199

Please sign in to comment.