Esempio n. 1
0
def processBlock(tf_basecaller_bam_filename, BASECALLER_RESULTS, tfkey,
                 floworder, analysis_dir):

    try:

        # These files will be created
        tfstatsjson_path = os.path.join(BASECALLER_RESULTS, "TFStats.json")
        tfbam_filename = os.path.join(BASECALLER_RESULTS, "rawtf.bam")
        tfref_filename = os.path.join(BASECALLER_RESULTS, "DefaultTFs.fasta")
        ionstats_tf_filename = os.path.join(BASECALLER_RESULTS,
                                            "ionstats_tf.json")

        # TF analysis in 5 simple steps

        buildTFReference(tfref_filename, analysis_dir, tfkey)

        alignTFs(tf_basecaller_bam_filename, tfbam_filename, tfref_filename)

        ionstats.generate_ionstats_tf(tfbam_filename, tfref_filename,
                                      ionstats_tf_filename)

        ionstats_plots.tf_length_histograms(ionstats_tf_filename, '.')

        ionstats.generate_legacy_tf_files(ionstats_tf_filename,
                                          tfstatsjson_path)

    except NoTFDataException as e:
        printtime("No data to analyze Test Fragments (%s)" % e.msg)
        f = open(os.path.join(BASECALLER_RESULTS, 'TFStats.json'), 'w')
        f.write(json.dumps({}))
        f.close()

    except:
        traceback.print_exc()
Esempio n. 2
0
def processBlock(tf_basecaller_bam_filename, BASECALLER_RESULTS, tfkey, floworder, analysis_dir):

    try:

        # These files will be created
        tfstatsjson_path = os.path.join(BASECALLER_RESULTS, "TFStats.json")
        tfbam_filename = os.path.join(BASECALLER_RESULTS, "rawtf.bam")
        tfref_filename = os.path.join(BASECALLER_RESULTS, "DefaultTFs.fasta")
        ionstats_tf_filename = os.path.join(BASECALLER_RESULTS, "ionstats_tf.json")

        # TF analysis in 5 simple steps

        buildTFReference(tfref_filename, analysis_dir, tfkey)

        alignTFs(tf_basecaller_bam_filename, tfbam_filename, tfref_filename)

        ionstats.generate_ionstats_tf(tfbam_filename, tfref_filename, ionstats_tf_filename)

        ionstats_plots.tf_length_histograms(ionstats_tf_filename, ".")

        ionstats.generate_legacy_tf_files(ionstats_tf_filename, tfstatsjson_path)

    except NoTFDataException as e:
        printtime("No data to analyze Test Fragments (%s)" % e.msg)
        f = open(os.path.join(BASECALLER_RESULTS, "TFStats.json"), "w")
        f.write(json.dumps({}))
        f.close()

    except:
        traceback.print_exc()
Esempio n. 3
0
            # TODO basecaller_results/datasets_tf.json might contain read_count : 0
            if os.path.exists(os.path.join(env['BASECALLER_RESULTS'], 'rawtf.basecaller.bam')):

                # input
                tf_basecaller_bam_filename = os.path.join(env['BASECALLER_RESULTS'], 'rawtf.basecaller.bam')
                tf_reference_filename = os.path.join("/results/referenceLibrary/TestFragment", env['tfKey'], "DefaultTFs.fasta")

                # These files will be created
                tfbam_filename = os.path.join(env['BASECALLER_RESULTS'],"rawtf.bam")
                ionstats_tf_filename = os.path.join(env['BASECALLER_RESULTS'],"ionstats_tf.json")
                tfstatsjson_path = os.path.join(env['BASECALLER_RESULTS'],"TFStats.json")

                printtime("TF: Mapping '%s'" % tf_basecaller_bam_filename)
                alignment.alignTFs(tf_basecaller_bam_filename, tfbam_filename, tf_reference_filename)

                ionstats.generate_ionstats_tf(tfbam_filename,tf_reference_filename,ionstats_tf_filename)

                ionstats_plots.tf_length_histograms(ionstats_tf_filename, '.')

                ionstats.generate_legacy_tf_files(ionstats_tf_filename,tfstatsjson_path)

        except:
            traceback.print_exc()
            printtime("No data to analyze Test Fragments")
            f = open(os.path.join(env['BASECALLER_RESULTS'],'TFStats.json'),'w')
            f.write(json.dumps({}))
            f.close()


        # Process unfiltered reads
Esempio n. 4
0
                )

                # These files will be created
                tfbam_filename = os.path.join(env["BASECALLER_RESULTS"],
                                              "rawtf.bam")
                ionstats_tf_filename = os.path.join(env["BASECALLER_RESULTS"],
                                                    "ionstats_tf.json")
                tfstatsjson_path = os.path.join(env["BASECALLER_RESULTS"],
                                                "TFStats.json")

                printtime("TF: Mapping '%s'" % tf_basecaller_bam_filename)
                alignment.alignTFs(tf_basecaller_bam_filename, tfbam_filename,
                                   tf_reference_filename)

                ionstats.generate_ionstats_tf(tfbam_filename,
                                              tf_reference_filename,
                                              ionstats_tf_filename)

                ionstats_plots.tf_length_histograms(ionstats_tf_filename, ".")

                ionstats.generate_legacy_tf_files(ionstats_tf_filename,
                                                  tfstatsjson_path)

        except Exception:
            traceback.print_exc()
            printtime("No data to analyze Test Fragments")
            f = open(os.path.join(env["BASECALLER_RESULTS"], "TFStats.json"),
                     "w")
            f.write(json.dumps({}))
            f.close()
Esempio n. 5
0
        '-d',
        '--dir',
        dest='analysis_dir',
        default='.',
        help=
        'Directory searched for DefaultTFs.conf (Default: current directory)')
    args = parser.parse_args()
    print "TFPipeline args :", args

    # Step 2. If reference fasta file not specified, build one

    try:
        if args.ref == None:
            args.ref = 'DefaultTFs.fasta'
            buildTFReference(args.ref, args.analysis_dir, args.key)

        # Step 3. Perform alignment and generate bam file

        alignTFs(args.basecaller_bam, args.bam, args.ref)

        # Step 4. Post-processing. Run alignStats and TFMapper

        ionstats.generate_ionstats_tf(args.bam, args.ref, 'ionstats_tf.json')

        ionstats_plots.tf_length_histograms('ionstats_tf.json', '.')

        ionstats.generate_legacy_tf_files('ionstats_tf.json', 'TFStats.json')

    except:
        traceback.print_exc()
Esempio n. 6
0
        "-d",
        "--dir",
        dest="analysis_dir",
        default=".",
        help="Directory searched for DefaultTFs.conf (Default: current directory)",
    )
    args = parser.parse_args()
    print "TFPipeline args :", args

    # Step 2. If reference fasta file not specified, build one

    try:
        if args.ref == None:
            args.ref = "DefaultTFs.fasta"
            buildTFReference(args.ref, args.analysis_dir, args.key)

        # Step 3. Perform alignment and generate bam file

        alignTFs(args.basecaller_bam, args.bam, args.ref)

        # Step 4. Post-processing. Run alignStats and TFMapper

        ionstats.generate_ionstats_tf(args.bam, args.ref, "ionstats_tf.json")

        ionstats_plots.tf_length_histograms("ionstats_tf.json", ".")

        ionstats.generate_legacy_tf_files("ionstats_tf.json", "TFStats.json")

    except:
        traceback.print_exc()
Esempio n. 7
0
    args = parser.parse_args()
    print "TFPipeline args :",args

    # Step 2. If reference fasta file not specified, build one

    try:
        if args.ref == None:
            args.ref = 'DefaultTFs.fasta'
            buildTFReference(args.ref,args.analysis_dir,args.key)

        # Step 3. Perform alignment and generate bam file

        alignTFs(args.basecaller_bam, args.bam, args.ref)

        # Step 4. Post-processing. Run alignStats and TFMapper


        ionstats.generate_ionstats_tf(args.bam,args.ref,'ionstats_tf.json')

        ionstats_plots.tf_length_histograms('ionstats_tf.json', '.')
        
        ionstats.generate_legacy_tf_files('ionstats_tf.json','TFStats.json')
        

    except:
        traceback.print_exc()