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

Packaging and csv export #3

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Packaging and csv export #3

wants to merge 12 commits into from

Conversation

NithinMathewJosephAston

I have formatted the tool to take in input file via the argparse module and at the same time generate output csv files containing Barcodes, Features and Annotations. The build was meant to be used like a n executable hence was made in this format. To execute the code : --> Python3 ./cloupe.py <input_file path>

Once the script is executed it will generate .csv files in the current working directory.

@prete
Copy link
Contributor

prete commented Nov 22, 2024

Add gitignore to the root of the repo:
https://github.com/github/gitignore/blob/main/Python.gitignore

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated
name = "cloupe_package_nj9"
version = "0.0.1"
authors = [
{ name="Nithin", email="[email protected]" },
Copy link
Contributor

Choose a reason for hiding this comment

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

{ name="Martin Prete", email="[email protected]" },
{ name="Nithin Mathew Joseph", email="[email protected]" }

don't foget about me!

Copy link
Author

Choose a reason for hiding this comment

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

Done. Wait shdn't the email be [email protected] and [email protected]?

Copy link
Contributor

Choose a reason for hiding this comment

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

Aliases to full names will also work. But you're right, let's do short usernames only.

pyproject.toml Outdated Show resolved Hide resolved
description = "Cloupe Parser"
readme = "README.md"
requires-python = ">=3.9.6"
classifiers = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Add classifiers:

  • Development Status :: 4 - Beta
  • Topic :: Scientific/Engineering :: Bio-Informatics
  • License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)

Choose a reason for hiding this comment

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

Done. Quick query were these stuff something I needed to know before hand. If so where can I find these info?

Copy link
Contributor

Choose a reason for hiding this comment

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

a) You're missing a comma in the list, between "License" and "Programming Language" classifiers.
b) The list of cannonical classifiers are avaiable at https://pypi.org/classifiers/ this is more a legacy thing and not very important as it has fallen out of use, still a nice thing to do properly.

dist/cloupe_package_nj9-0.0.1.tar.gz Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved

# Final csv addition
with open(barcode_clusters, 'w') as barcode_clusters_file:
barcode_clusters_file.write("Barcodes,{},{}\n".format(cloupe.celltracks[0]["Name"],cloupe.celltracks[1]["Name"]))
Copy link
Contributor

Choose a reason for hiding this comment

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

This code ONLY works if there are two celltracks.
What if there are none? What if there's only one? What if there are 99?

barcode_clusters_file.write(
"\n".join(
[
re.sub(r"[()' ]", "", str(pair)) # Remove parentheses, single quotes, and spaces
Copy link
Contributor

Choose a reason for hiding this comment

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

This is also fixed to only support 2 celltracks.
Should be dynamic based on the number of items in cloupe.celltracks.

re.sub(r"[()' ]", "", str(pair)) is very odd


collection = []
# writing the barcodes to the csv files
with open(barcodes, 'w') as barcodes_file:
Copy link
Contributor

@prete prete Nov 22, 2024

Choose a reason for hiding this comment

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

Could each one of the writes (barcodes, features, and annotations) be an individual function. If so, should they be inside Cloupe class?

Have a look at https://docs.python.org/3.9/library/csv.html for writing CSVs with quoting and all that fun.

Copy link
Author

Choose a reason for hiding this comment

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

I had been trying various combination of csv writter with the data that we have. I was finding it difficult to dump out the csv properly even when i was using the quoting and quotechar features along with the delimiter. I was thinking if i cud stick without using csv module. Let me know ur thoughts.

Regarding moving the writes as methods. My query would be do i remove the main function entirely and the cloupe.py will remain a class?

@prete
Copy link
Contributor

prete commented Nov 22, 2024

Related to #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants