Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bvk
    Member
    • May 2015
    • 65

    #1

    python error in cuffdiff script

    I used this in command line:

    cuffdiff -o diff_out4 -b ../genome/ce10.fa -p 2 -L larval,early -u merged_asm/merged.gtf ../tophat/em/SRR493359_60_61_thout/accepted_hits.bam ../tophat/em/SRR493363_64_65_thout/accepted_hits.bam

    here SRR493359_60_61 is one group and SRR493363_64_65 is the other group. This worked for me.

    Now I want to run this from a python script. So, I gave a call in this way.

    do.call([cfg.tool_cmd("cuffdiff"), "-p", str(cfg.project["analysis"]["threads"]), "-b", str(cfg.project["genome"]["fasta"]), "-u", cfg.project["samples"][0]["files"]["merging_gtf"], "-L", str(cfg.project["phenotype"][0]), str(cfg.project["phenotype"][1]), "-o", output_folder] + [cfg.project["samples"][0]["files"]["bam"] cfg.project["samples"][1]["files"]["bam"]], cfg.project["analysis"]["log_file"])

    here
    str(cfg.project["phenotype"][0]) is larval
    str(cfg.project["phenotype"][1]) is early

    I get an error: invalid syntax. Can anyone please help in this. Thanks in Advance
  • rflrob
    Member
    • May 2010
    • 50

    #2
    It looks to me like you're perhaps missing a comma after cfg.project["samples"][0]["files"]["bam"]. As a general debugging strategy, when you have massive blocks of code like that, it's often easier to break it up into component parts, so those could be debugged individually. So something like:

    Code:
    base_options = [cfg.tool_cmd("cuffdiff"),
                            "-p", str(cfg.project["analysis"]),
                            "etc etc"]
    
    files = [
        cfg.project["samples"][0]["files"]["bam"],
        cfg.project["samples"][1]["files"]["bam"],
        cfg.project["analysis"]["log_file"]
    ]
    
    do.call(base_options + files)

    Comment

    • bvk
      Member
      • May 2015
      • 65

      #3
      Originally posted by rflrob View Post
      It looks to me like you're perhaps missing a comma after cfg.project["samples"][0]["files"]["bam"]. As a general debugging strategy, when you have massive blocks of code like that, it's often easier to break it up into component parts, so those could be debugged individually. So something like:

      Code:
      base_options = [cfg.tool_cmd("cuffdiff"),
                              "-p", str(cfg.project["analysis"]),
                              "etc etc"]
      
      files = [
          cfg.project["samples"][0]["files"]["bam"],
          cfg.project["samples"][1]["files"]["bam"],
          cfg.project["analysis"]["log_file"]
      ]
      
      do.call(base_options + files)
      Thanks for the reply. You may be right in one case. But I want to run this for groups.

      cfg.project["samples"][0]["files"]["bam"] is group1
      cfg.project["samples"][1]["files"]["bam"] is group2

      so it should be group1 vs group2. So, the bam files should be separated with space. And If I run this with space its giving an error. Please tell me how to run this with space between the bam files.

      Comment

      • rflrob
        Member
        • May 2010
        • 50

        #4
        I'm not familiar with this "do" module you seem to be using, but I'm pretty sure that passing a list is the equivalent of spaces on the command line. For instance, in the original cuffdiff call, it's not "cuffdiff, -o, diff_out4, ...". So you can see that the syntax in python isn't exactly the same as the command that gets generated. Thus, you really do want that comma there.

        More generally, Python doesn't know how to combine the two variables if there's no comma between them. Depending on the type (which the syntax parser doesn't know in advance), you could want to concatenate them (if strings), multiply them (if they're numbers), or do something else entirely. Recall the Zen of Python: "In the face of ambiguity, refuse the temptation to guess." Since the syntax could be ambiguous, it instead throws a syntax error.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
          by SEQadmin2



          Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

          Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
          ...
          10-14-2026, 09:55 AM
        • SEQadmin2
          New Genomics Technologies Take Aim at Long-Standing Limits
          by SEQadmin2


          Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

          We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
          ...
          09-28-2026, 10:25 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-15-2026, 10:52 AM
        0 responses
        26 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-14-2026, 05:39 AM
        0 responses
        33 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-13-2026, 09:56 AM
        0 responses
        31 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-09-2026, 11:14 AM
        0 responses
        28 views
        0 reactions
        Last Post SEQadmin2  
        Working...