Skip to main content

Blind files

Generates a mapping from file names to blind but memorable file names. This script assumes that you have a directory that contains files and / or subdirectories with samples from an experiment. The names of these files and directories reveal which group the samples belong to, but the contents of the files do not.

The script will move these files to a new directory, renaming them so that the new file names do not reveal which group the samples belong to. It will also generate a mapping file to indicate how the new files map to the original files.

Installing

Using pipx

pipx install blind_files

Running

This script takes an input dir, and generates a directory containing a script, blind.sh, that can be used to blind the files in the input dir. It also generates a mapping csv, mapping.csv, that can be used after the user has done the analysis to see how the original names map to blinded names.

The script has two modes of operation:

Using a delimiter

In the first mode of operation, you can specify a delimiter to use such that all the text before the delimiter in each file name will be replaced. For example:

blind-files \
   --mode delimiter \
   --delimiter _foo \
   --input-dir input_dir \
   --output-dir output_dir \
   --mapping-dir mapping_dir

In this case, if input_dir contains the following files:

sample_1_foo.txt
sample_1_foo-bar.csv
sample_2_foo.txt
hello.txt

Then after running mapping_dir/blind.sh, output_dir will contain

golf_elbow_foo.txt
golf_elbow_foo-bar.csv
co-producer_reputation_foo.txt
hello.txt

In mapping_dir you will also find a file mapping.csv with the contents:

original,blinded
sample_1,golf_elbow
sample_2,co-producer_reputation

Limitations

This will only replace names at the top level of the input directory. If you have a more complex nested directory structure, where the identifer names may be buried in the directory tree, use identifier list approach described below.

Using a list of identifiers

In the second mode of operation, you can specify list of identifiers that should be blinded whenever they are encountered in the input directory tree. For example, if identifiers.txt contains the following:

group_a_1
group_b_1

then running

blind-files \
   --mode identifiers \
   --identifiers identifiers.txt \
   --input-dir input_dir \
   --output-dir output_dir \
   --mapping-dir mapping_dir

In this case, if input_dir contains the following files:

group_a_1/group_a_1/foo.txt
group_b_1/group_b_1/foo.txt
hello.txt

Then after running mapping_dir/blind.sh, output_dir will contain

head_bottle/head_bottle/foo.txt
eponym_curtain/eponym_curtain/foo.txt
hello.txt

In mapping_dir you will also find a file mapping.csv with the contents:

original,blinded
group_a_1,head_bottle
group_b_1,eponym_curtain

Limitations

No identifier can be a substring of any other identifier. For example, it is not allowed to have identifiers sample_1 and sample_11. However, sample_01 and sample_11 would be fine.

General limitations

  • This script should work on any platform, but has only been tested on Mac OS.
  • This script should handle symlinks by simply moving the symlink, without following it, but this behavior has not been tested.

Credits

This package was created with Cookiecutter.

nounlist from here.

Metadata

Release files for blind-files 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blind-files 0.2.6
File Size Uploaded Provenance Actions
blind_files-0.2.6.tar.gz 23.0 kB Without provenance Details for blind_files-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blind-files 0.2.6
File Interpreter ABI Platform Actions
blind_files-0.2.6-py3-none-any.whl Python 3 none any Details for blind_files-0.2.6-py3-none-any.whl

Total release size: 45.3 kB

Release files / blind_files-0.2.6.tar.gz

Download URL blind_files-0.2.6.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f8bd59698a729553f78ee648fef42e52bcb6707b60e07fbc08b94011fa468f78
BLAKE2b-256 checksum
How to use checksums
ef374e0d95482577e43862fbd20b7b5dfa03cd3c10c245a12d896615faea264f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.3 Darwin/21.4.0

Release files / blind_files-0.2.6-py3-none-any.whl

Download URL blind_files-0.2.6-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c38b8cf21f7abd72ff41e88374fb685b69458f44cbd131d802003975770e5f52
BLAKE2b-256 checksum
How to use checksums
7eabff68d9a66d46609a267dc742a59cbdfb5f898b8e70a9fc30a71c86deb1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.3 Darwin/21.4.0

Security for blind-files 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page