Coder Social home page Coder Social logo

Comments (5)

Wang-Lin-boop avatar Wang-Lin-boop commented on May 24, 2024 1
    for domain_ddd in readlines("$index_dir/$pdb_name-$model_num-$chain_id-domain.info")
        domain_id = split(domain_ddd,":")[1]
        domain_vec = split(domain_ddd,":")[2]
        com_id = 0
        domain_selection = []
        for domain_range in split(domain_vec,",")
            frag_N = parse(Int64,split(domain_range,"-")[1])
            frag_C = parse(Int64,split(domain_range,"-")[2])
            for resi in frag_N:frag_C
                push!(domain_selection, resi)
            end
        end
        domain_str = collectresidues(chain, res -> resnumber(res) in domain_selection , allselector)
        writepdb("$output_dir/$pdb_name-$model_num-$chain_id-$domain_id.pdb", domain_str)
    end

It works now! Thanks, Greener~

from biostructures.jl.

jgreener64 avatar jgreener64 commented on May 24, 2024

Yes you can do it as you have by using || in the selector. You can merge selections by defining them as functions:

selector1(res) = 13  <= resnumber(res) <= 436
selector2(res) = 504 <= resnumber(res) <= 534
combinedselector(res) = selector1(res) || selector2(res)
domain = collectresidues(chain, combinedselector)

I deleted the allselector as it doesn't do anything here.

from biostructures.jl.

Wang-Lin-boop avatar Wang-Lin-boop commented on May 24, 2024

yeah, I have found this method about || .

and I wanna select many fragments and merge them into one domain.

firstly, I test it in REPL:

image

        for domain_range in split(domain_vec,",")
            frag_N = parse(Int64,split(domain_range,"-")[1])
            frag_C = parse(Int64,split(domain_range,"-")[2])
            ( length(domain_selection) == 0 ) && (domain_selection = "($frag_N <= resnumber(res) <= $frag_C)" )
            ( length(domain_selection) == 0 ) || (domain_selection = "$(domain_selection) || ( $frag_N <= resnumber(res) <= $frag_C)" )
        end
        println(domain_selection)
# (13 <= resnumber(res) <= 436) || ( 13 <= resnumber(res) <= 436) || ( 504 <= resnumber(res) <= 534) || ( 655 <= resnumber(res) <= 682)
        domain_str = collectresidues(chain, res -> ("$(domain_selection)"), allselector)
        writepdb("$output_dir/$pdb_name-$model_num-$chain_id-$domain_id.pdb", domain_str)

however, an error occured that:
nested task error: TypeError: non-boolean (var"#12#13") used in boolean context

image

I think that it may be caused by the inappropriate statement construction. Even after I replace the res -> ("$(domain_selection)") to Meta.parse("res -> (\"$(domain_selection)\")") |> eval or res -> ( eval(domain_selection) ), it still doesn't work....

from biostructures.jl.

jgreener64 avatar jgreener64 commented on May 24, 2024

I would just form a Vector or Set of all residue numbers in the domain (domain_res) and then do:

domain_selector(res) = resnumber(res) in domain_res

from biostructures.jl.

Wang-Lin-boop avatar Wang-Lin-boop commented on May 24, 2024

wow, a great idea!

from biostructures.jl.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.