wildcard

Using wildcard in Python

Using wildcard in Python Question: I have a df with 3 columns (col1, col2, and col3), and I have a user input that can enter a value for columns, just one, two or three, and of any combination, like (col1 or col1&col2, or col2&col3, etc.). Based on the user input, I need to select rows …

Total answers: 3

how to read specific JSON files using python glob

how to read specific JSON files using python glob Question: i have a set of JSON files in a folder. Sample files: -2022_06_13_07_14_f71cd512135bdab9.json -2022_06_13_07_1421_f71cd512135bdab9.json -2022_06_13_07_12314_f71cd512135bdab9.json -2022_06_14_132_14_f71cd512135bdab9.json -2022_06_14_74647_14_f71cd512135bdab9.json Instead of reading all files at once, I need to read them day-wise. ex:2022_06_13_07_14_f71cd512135bdab9.json corresponding to 2022_06_13. like wise I need to read all the JSON files and …

Total answers: 1

Append wildcard results to a list in python

Append wildcard results to a list in python Question: Please forgive me I am teaching myself and am pretty new to this. I have searched and found nothing that addressed my issue, lots of things dealing with os and file directories but I couldn’t figure out how to implement them here. I also am not …

Total answers: 1

Snakemake scatter-gather with wildcard AmbiguousRuleException

Snakemake scatter-gather with wildcard AmbiguousRuleException Question: My problem is when using Snakemake scatter-gather feature the documentation is basic and i modified my code according to mentioned in this link: rule fastq_fasta: input:rules.trimmomatic.output.out_file output:"data/trimmed/{sample}.fasta" shell:"sed -n ‘1~4s/^@/>/p;2~4p’ {input} > {output}" rule split: input: "data/trimmed/{sample}.fasta" params: scatter_count=config["scatter_count"], scatter_item = lambda wildcards: wildcards.scatteritem output: temp(scatter.split("data/trimmed/{{sample}}_{scatteritem}.fasta")) script: "scripts/split_files.py" rule …

Total answers: 1

how to quickly identify if a rule in Snakemake needs an input function

how to quickly identify if a rule in Snakemake needs an input function Question: I’m following the snakemake tutorial on their documentation page and really got stuck on the concept of input functions https://snakemake.readthedocs.io/en/stable/tutorial/advanced.html#step-3-input-functions Basically they define a config.yaml as follows: samples: A: data/samples/A.fastq B: data/samples/B.fastq and the Snakefile as follows without any input function: …

Total answers: 3

How to use wildcards in keyword wildcard_constraints

How to use wildcards in keyword wildcard_constraints Question: For example, I have the following wildcards. dataset = [‘A1’, ‘A2’, ‘A3’, ‘B1’, ‘B2’, ‘B3’] group = [‘A’, ‘B’] I am trying to contrain my dataset with my group. for example, I want to create A1/file.A.txt A2/file.A.txt A3/file.A.txt B1/file.B.txt … I wrote a following rule hoping to …

Total answers: 1

Compare strings in python like the sql "like" (with "%" and "_")

Compare strings in python like the sql "like" (with "%" and "_") Question: I have a list in python with some strings, and I need to know witch item in the list is like “A1_8301”. This “_” means that can be any char. Is there a quick way to do that? If I was using …

Total answers: 2

Sum all columns with a wildcard name search using Python Pandas

Sum all columns with a wildcard name search using Python Pandas Question: I have a dataframe in python pandas with several columns taken from a CSV file. For instance, data =: Day P1S1 P1S2 P1S3 P2S1 P2S2 P2S3 1 1 2 2 3 1 2 2 2 2 3 5 4 2 And what I …

Total answers: 3