LoadError: MethodError: no method matching open(::Nothing, ::String)

I’m new to Julia.
Here, some problems really puzzled me.
here is my pipeline, and I think a mistake occurs in line 38:
I don’t know how to modify it.

The mistake is:

ERROR: LoadError: MethodError: no method matching open(::Nothing, ::String)
Closest candidates are:
  open(!Matched::AbstractString, ::AbstractString) at iostream.jl:339
  open(!Matched::Function, ::Any...; kwargs...) at iostream.jl:367
  open(!Matched::Base.AbstractCmd, ::AbstractString) at process.jl:562
  ...
Stacktrace:
 [1] top-level scope at none:0
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1044
 [4] include(::Module, ::String) at ./sysimg.jl:29
 [5] exec_options(::Base.JLOptions) at ./client.jl:266
 [6] _start() at ./client.jl:425
in expression starting at /data/caozhr/bin/ccontigs/ccontigs-1.0.0/ccontigs.jl:

The pipeline is:

! /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin/julia
# Geoffrey Hannigan
# University of Michigan

# Setting dependencies
using BioAlignments
using BioSequences
using ArgParse

# Setup ArgParse
argx = ArgParseSettings()
@add_arg_table! argx begin
    "--input", "-i"
        help = "Input fasta file for identifying circular contigs."
    "--output", "-o"
        help = "Output file to write reults."
    "--length", "-l"
        help = "Length of sequence window for detecting repeats."
        default = 100
    "--thresh", "-t"
        help = "Threshold (percent of length) for circular contig."
        default = 0.97
end

parsed_args = parse_args(ARGS, argx)

problem = LocalAlignment()

scoremodel = AffineGapScoreModel(
    match=5,
    mismatch=-4,
    gap_open=-4,
    gap_extend=-1
)

filepath = parsed_args["input"]
fileout = parsed_args["output"]
outputfile = open(fileout, "w")
hitlength = parsed_args["length"]
threshold = hitlength * 5 * parsed_args["thresh"]
maxscore = hitlength * 5
print("Perfect alignment score is $maxscore\n")

for s in open( filepath, FASTA )
    alignment_result = pairalign(problem, s.seq[1:hitlength], s.seq[hitlength:e
    scorestring = score(alignment_result)
    seqname = s.name
    if scorestring > threshold
        write(outputfile, "$seqname\t$scorestring\n")
    end
end

I don’t know how to solve it. Waiting for help.

1 Like

Check, e.g. with a print, if fileout and filepath are defined and are set to what you expect.