logo
Tags down

shadow

How to call a list style parameter in snakemake


By : NIHAR
Date : October 18 2020, 06:10 PM
like below fixes the issue I think in python/snakemake you can use OrderedDict to represent an R list. So:
code :
params:
    fam=list(A=c('a','b','c'),B=c('d','e'),C=c('f','g','h'))
params:
    fam= collections.OrderedDict([('A', ['a', 'b', 'c']), 
                                  ('B', ['d', 'e', 'f']),
                                  ('C', ['h', 'g'])])


Share : facebook icon twitter icon

How to overwrite a parameter from the configfile that is not at the first level in a snakemake call?


By : Ravindra Kumar
Date : March 29 2020, 07:55 AM
will help you This is currently not possible. A general remark: Note that --config should be used as little as possible, because it defeats the goal of reproducibility and data provenance (you would have to remember the command line with which you invoked snakemake).

snakemake both shell I/O redirection and accessing snakemake variable using script


By : Lee
Date : March 29 2020, 07:55 AM
may help you . If possible, I suggest you use the argparse module to parse the input of your script, so that it can parse a list of arguments as such, using the nargs="*" option:
code :
def main():
    """Main function of the program."""
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument(
        "-g", "--genes_file",
        required=True,
        help="Path to a file containing the genes.")
    parser.add_argument(
        "-o", "--output_file",
        required=True,
        help="Path to the output file.")
    parser.add_argument(
        "-f", "--frequencies",
        nargs="*",
        help="Space-separated list of frequencies.")
    parser.add_argument(
        "-t", "--threads",
        type=int,
        default=1,
        help="Number of threads to use.")
    args = parser.parse_args()
    # then use args.gene_file as a file name and args.frequencies as a list, etc.
shell:
    """
    python scripts/create_hdf5.py \\
        -g {input.genes_file} -f {params.frequencies} \\
        -o {output} -t {threads} 2> {log.err} 1> {log.out}
    """

Snakemake rule to write a new text file from input variables (Snakemake syntax)


By : user2499508
Date : March 29 2020, 07:55 AM
it helps some times You need to use wildcard sample in params instead of variable SAMPLEID. This will use proper sample id specific for that rule when executed.
code :
params:
    sample = '{sample}'
shell:
    """
    echo "{params.sample},{input.loc_r1},forward" >> {output}
    echo "{params.sample},{input.loc_r2},reverse" >> {output}
    """

snakemake cluster script ImportError snakemake.utils


By : user3531634
Date : March 29 2020, 07:55 AM
it helps some times Following @Manavalan Gajapathy's advice, I added print(sys.version) commands both to the snakefile and the cluster script, and in both cases got a python version (2.7.5) different than the one indicated in the activated environment (3.7.5).
To cut a long story short - for some reason when I activate the environment within a PBS job, the environment path is added to the $PATH only after /usr/bin, which results in /usr/bin/python being used (which does not have the snakemake package). When the env is activated locally, the env path is added to the beginning of the $PATH, so the right python is used.

snakemake parameter function lambda


By : Bongani
Date : March 29 2020, 07:55 AM
hope this fix your issue {sample} in your lambda function is just a string and not wildcard. This is how to use wildcard in lambda
code :
lambda wildcards: mitico(wildcards.sample)
Related Posts Related Posts :
  • R group_by return number of largest unique type
  • Different ways of selecting columns inside function resulting in different results, why?
  • How do I join a Y variable to each X variable in a dataframe?
  • World map: filtering by 'subregion' removes many regions
  • Generate data frame with parameters
  • Star (*) notation in R session Information
  • Why does formals function return NULL on functions defined with arguments?
  • as_tibble only returns a single variable
  • Can't create design matrix from user input
  • R - how to sum each columns from df
  • R devtools::check LICENSE is not mentioned and other issues in DESCRIPTION FILE
  • Simple arithmetic leads to floating point difference in R
  • why does the data I input into R plot function change?
  • How can I import my data.frame as an igraph object?
  • Join each row with each other row
  • Join complementary dataframes, no NAs where a value is available
  • How to restart R and continue a benchmark script from previous line (on Windows)?
  • using dplyr to calculate consecutive days with a particular value
  • When and how to use as.name() vs.get() in data.table (ex. in looping over columns)?
  • How to combine similar strings showing most common characters
  • Adjust spacing between text and chunk output in a R Markdown PDF document
  • Transform data to use lubridate on it
  • I need to know why I get the error 'unexpected input in "p<-ggplot(data=mov2, aes(x=Genre,y=Gross % US))" '
  • ggplot different lm formulas
  • change border color of a county in ggplot in R
  • position_dodgev causes error in order of connecting points in geom_line
  • How can I delete lines in which the name appears only once?
  • mutate_if, summarize_at etc coerce data.table to data.frame
  • How to get different values for same ID in dataframe. And replace any of that different value for the same ID
  • Lagging data based on condition (non-fix lag)
  • How to use 'sparklyr::replace.na()' for replacing NaN on one column?
  • How to create lollipop graph
  • R: Why is pmap not working while map2 does?
  • How to have different legends and colour schemes for different geom_*(aes(col= ) in ggplot?
  • How to check if a value under condition is within an interval under other condition in R?
  • Remove character string from multiple columns in R
  • subset a data frame with dplyr and conditions
  • R: How to show forecast and actual data in a single plot?
  • Calculate Grouped mean and populate in new column in R
  • Creating a new data set with same attributes (mean, skew, kurt, product) as old one in R
  • How to get series highlight on hover in highcharter?
  • cross validation predictions from H2O autoML model
  • Hack in R Markdown or Bookdown for including LaTeX environments which appear in html or docx output?
  • In R Shiny, can one interactively highlight cells using DT::dataframe?
  • Does the Sandwich Package work for Robust Standard Errors for Logistic Regression with basic Survey Weights
  • how to average rows based on two duplicated rows?
  • For loop help (R)
  • Is there a way around casting large integers as string when querying data from BigQuery through R?
  • Formatting datetime in Highcharter tooltip
  • R - How do I draw a radius around a point and use that result to filter other points?
  • How to order the coefficients in LM summary?
  • R: reordering columns based on order of different column
  • Find the maximum of a variable by overlapping time intervals
  • Vectorize function operating on a two-argument function
  • How to load rJava into RStudio?
  • Joining duplicate columns in single dataframe
  • I have some question about predicting new data in random forest
  • Overlaying a histogram with normal distribution
  • Warning message that giant component of disconnected graph is itself disconnected
  • How to sum categorical variable across variables
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk