Skip to content

Try to match int and str when get_puck_barcode_file in rule create_spatial_barcode_file #143

@falsetry1514

Description

@falsetry1514

rule create_spatial_barcode_file:
input: projects/P11_mouse_kidney/processed_data/SR250721M4/illumina/complete_data/out_readcounts_prealigned.txt.gz
output: projects/P11_mouse_kidney/processed_data/SR250721M4/illumina/complete_data/puck_barcode_files/spatial_barcodes_22324.csv, projects/P11_mouse_kidney/processed_data/SR250721M4/illumina/complete_data/puck_barcode_files/spatial_barcodes_summary_22324.csv
jobid: 52
reason: Missing output files: projects/P11_mouse_kidney/processed_data/SR250721M4/illumina/complete_data/puck_barcode_files/spatial_barcodes_22324.csv, projects/P11_mouse_kidney/processed_data/SR250721M4/illumina/complete_data/puck_barcode_files/spatial_barcodes_summary_22324.csv
wildcards: project_id=P11_mouse_kidney, sample_id=SR250721M4, puck_barcode_file_id=22324
resources: tmpdir=/tmp

RuleException in rule create_spatial_barcode_file in file /opt/miniforge3/envs/spacemake/lib/python3.11/site-packages/spacemake/snakemake/main.smk, line 414:
AttributeError: 'InputFiles' object has no attribute 'barcode_file', when formatting the following:
python {spacemake_dir}/snakemake/scripts/n_intersect_sequences.py --query {input.bc_readcounts} --query-plain-skip 1 --query-plain-column 1 --target {input.barcode_file} --target-id {wildcards.puck_barcode_file_id} --target-column 'cell_bc' --output {output[0]} --summary-output {output[1]} --n-jobs {threads} --chunksize 10000000

This error occurs at
def get_puck_barcode_file(
self, project_id: str, sample_id: str, puck_barcode_file_id: str
) -> str:
if (
puck_barcode_file_id
in self.project_df_default_values["puck_barcode_file_id"]
):
# if sample is not spatial, or we request the non-spatial puck
return None
else:
ids = self.get_metadata(
"puck_barcode_file_id", sample_id=sample_id, project_id=project_id
)

        puck_barcode_files = self.get_metadata(
            "puck_barcode_file", sample_id=sample_id, project_id=project_id
        )

        # if no puck_barcode_file is provided, it means that barcode
        # file has to be fetched from the puck itself
        if puck_barcode_files is not None:
            for pid, pbf in zip(ids, puck_barcode_files):
                if pid == puck_barcode_file_id: <-- pid is int type, but puck_barcode_file_id is str type
                    return pbf

            return None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions