idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
11,800 | def fromaligns ( args ) : p = OptionParser ( fromaligns . __doc__ ) p . set_outfile ( ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) alignsfile , = args fp = must_open ( alignsfile ) fw = must_open ( opts . outfile , "w" ) for row in fp : if row . startswith ( "## A... | %prog fromaligns out . aligns |
11,801 | def mcscanq ( args ) : p = OptionParser ( mcscanq . __doc__ ) p . add_option ( "--color" , help = "Add color highlight, used in plotting" ) p . add_option ( "--invert" , default = False , action = "store_true" , help = "Invert query and subject [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ... | %prog mcscanq query . ids blocksfile |
11,802 | def spa ( args ) : from jcvi . algorithms . graph import merge_paths from jcvi . utils . cbook import uniqify p = OptionParser ( spa . __doc__ ) p . add_option ( "--unmapped" , default = False , action = "store_true" , help = "Include unmapped scaffolds in the list [default: %default]" ) opts , args = p . parse_args ( ... | %prog spa spafiles |
11,803 | def rebuild ( args ) : p = OptionParser ( rebuild . __doc__ ) p . add_option ( "--header" , default = False , action = "store_true" , help = "First line is header [default: %default]" ) p . add_option ( "--write_blast" , default = False , action = "store_true" , help = "Get blast records of rebuilt anchors [default: %d... | %prog rebuild blocksfile blastfile |
11,804 | def coge ( args ) : p = OptionParser ( coge . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) cogefile , = args fp = must_open ( cogefile ) cogefile = cogefile . replace ( ".gz" , "" ) ksfile = cogefile + ".ks" anchorsfile = cogefile + ".anchors" fw_ks = must... | %prog coge cogefile |
11,805 | def matrix ( args ) : p = OptionParser ( matrix . __doc__ ) p . add_option ( "--seqids" , help = "File with seqids [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 3 : sys . exit ( not p . print_help ( ) ) bedfile , anchorfile , matrixfile = args ac = AnchorFile ( anchorfile ) seqidsfile ... | %prog matrix all . bed anchorfile matrixfile |
11,806 | def summary ( args ) : from jcvi . utils . cbook import SummaryStats p = OptionParser ( summary . __doc__ ) p . add_option ( "--prefix" , help = "Generate per block stats [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) anchorfile , = args ac = An... | %prog summary anchorfile |
11,807 | def stats ( args ) : from jcvi . utils . cbook import percentage p = OptionParser ( stats . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) blocksfile , = args fp = open ( blocksfile ) counts = defaultdict ( int ) total = orthologous = 0 for row in fp : atoms... | %prog stats blocksfile |
11,808 | def write_details ( fw , details , bed ) : for a , b , depth in details : for i in xrange ( a , b ) : gi = bed [ i ] . accn print ( "\t" . join ( ( gi , str ( depth ) ) ) , file = fw ) | Write per gene depth to file |
11,809 | def blast ( self , blastfile = None , outfile = None ) : from jcvi . formats . blast import BlastSlow , BlastLineByConversion if not outfile : outfile = self . filename + ".blast" if blastfile is not None : blasts = BlastSlow ( blastfile ) . to_dict ( ) else : blasts = None fw = must_open ( outfile , "w" , checkexists ... | convert anchor file to 12 col blast file |
11,810 | def filter ( args ) : p = OptionParser ( filter . __doc__ ) p . add_option ( "--score" , dest = "score" , default = 0 , type = "int" , help = "Score cutoff" ) p . set_align ( pctid = 95 , hitlen = 100 , evalue = .01 ) p . add_option ( "--noself" , default = False , action = "store_true" , help = "Remove self-self hits"... | %prog filter test . blast |
11,811 | def collect_gaps ( blast , use_subject = False ) : key = lambda x : x . sstart if use_subject else x . qstart blast . sort ( key = key ) for a , b in zip ( blast , blast [ 1 : ] ) : if use_subject : if a . sstop < b . sstart : yield b . sstart - a . sstop else : if a . qstop < b . qstart : yield b . qstart - a . qstop | Collect the gaps between adjacent HSPs in the BLAST file . |
11,812 | def gaps ( args ) : p = OptionParser ( gaps . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) blastfile , = args blast = BlastSlow ( blastfile ) logging . debug ( "A total of {} records imported" . format ( len ( blast ) ) ) query_gaps = list ( collect_gaps (... | %prog gaps A_vs_B . blast |
11,813 | def rbbh ( args ) : p = OptionParser ( rbbh . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) abfile , bafile , = args ab = Blast ( abfile ) ba = Blast ( bafile ) ab_hits = ab . best_hits ba_hits = ba . best_hits for aquery in ab_hits : ahit = ab_hits [ aquer... | %prog rbbh A_vs_B . blast B_vs_A . blast |
11,814 | def score ( args ) : from jcvi . formats . base import SetFile from jcvi . formats . fasta import Fasta p = OptionParser ( score . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 3 : sys . exit ( not p . print_help ( ) ) blastfile , fastafile , idsfile = args ids = SetFile ( idsfile ) blast = Blast (... | %prog score blastfile query . fasta A . ids |
11,815 | def annotation ( args ) : from jcvi . formats . base import DictFile p = OptionParser ( annotation . __doc__ ) p . add_option ( "--queryids" , help = "Query IDS file to switch [default: %default]" ) p . add_option ( "--subjectids" , help = "Subject IDS file to switch [default: %default]" ) opts , args = p . parse_args ... | %prog annotation blastfile > annotations |
11,816 | def completeness ( args ) : from jcvi . utils . range import range_minmax from jcvi . utils . cbook import SummaryStats p = OptionParser ( completeness . __doc__ ) p . add_option ( "--ids" , help = "Save ids that are over 50% complete [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : s... | %prog completeness blastfile ref . fasta > outfile |
11,817 | def annotate ( args ) : from jcvi . assembly . goldenpath import Cutoff , Overlap , Overlap_types p = OptionParser ( annotate . __doc__ ) p . set_align ( pctid = 94 , hitlen = 500 ) p . add_option ( "--hang" , default = 500 , type = "int" , help = "Maximum overhang length" ) opts , args = p . parse_args ( args ) if len... | %prog annotate blastfile query . fasta subject . fasta |
11,818 | def top10 ( args ) : from jcvi . formats . base import DictFile p = OptionParser ( top10 . __doc__ ) p . add_option ( "--top" , default = 10 , type = "int" , help = "Top N taxa to extract [default: %default]" ) p . add_option ( "--ids" , default = None , help = "Two column ids file to query seqid [default: %default]" )... | %prog top10 blastfile . best |
11,819 | def cscore ( args ) : from jcvi . utils . cbook import gene_name p = OptionParser ( cscore . __doc__ ) p . add_option ( "--cutoff" , default = .9999 , type = "float" , help = "Minimum C-score to report [default: %default]" ) p . add_option ( "--pct" , default = False , action = "store_true" , help = "Also include pct a... | %prog cscore blastfile > cscoreOut |
11,820 | def get_distance ( a , b , xaxis = True ) : if xaxis : arange = ( "0" , a . qstart , a . qstop , a . orientation ) brange = ( "0" , b . qstart , b . qstop , b . orientation ) else : arange = ( "0" , a . sstart , a . sstop , a . orientation ) brange = ( "0" , b . sstart , b . sstop , b . orientation ) dist , oo = range_... | Returns the distance between two blast HSPs . |
11,821 | def combine_HSPs ( a ) : m = a [ 0 ] if len ( a ) == 1 : return m for b in a [ 1 : ] : assert m . query == b . query assert m . subject == b . subject m . hitlen += b . hitlen m . nmismatch += b . nmismatch m . ngaps += b . ngaps m . qstart = min ( m . qstart , b . qstart ) m . qstop = max ( m . qstop , b . qstop ) m .... | Combine HSPs into a single BlastLine . |
11,822 | def chain ( args ) : p = OptionParser ( chain . __doc__ ) p . add_option ( "--dist" , dest = "dist" , default = 100 , type = "int" , help = "extent of flanking regions to search [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) blastfile , = args d... | %prog chain blastfile |
11,823 | def condense ( args ) : p = OptionParser ( condense . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) blastfile , = args blast = BlastSlow ( blastfile ) key = lambda x : x . query blast . sort ( key = key ) clusters = [ ] for q , lines in groupby ( blast , ke... | %prog condense blastfile > blastfile . condensed |
11,824 | def mismatches ( args ) : from jcvi . utils . cbook import percentage from jcvi . graphics . histogram import stem_leaf_plot p = OptionParser ( mismatches . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) blastfile , = args data = [ ] matches = 0 b = Blast ( ... | %prog mismatches blastfile |
11,825 | def swap ( args ) : p = OptionParser ( swap . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) < 1 : sys . exit ( not p . print_help ( ) ) blastfile , = args swappedblastfile = blastfile + ".swapped" fp = must_open ( blastfile ) fw = must_open ( swappedblastfile , "w" ) for row in fp : b = BlastLine ( ro... | %prog swap blastfile |
11,826 | def bed ( args ) : from jcvi . formats . bed import sort as bed_sort p = OptionParser ( bed . __doc__ ) p . add_option ( "--swap" , default = False , action = "store_true" , help = "Write query positions [default: %default]" ) p . add_option ( "--both" , default = False , action = "store_true" , help = "Generate one li... | %prog bed blastfile |
11,827 | def best ( args ) : p = OptionParser ( best . __doc__ ) p . add_option ( "-n" , default = 1 , type = "int" , help = "get best N hits [default: %default]" ) p . add_option ( "--nosort" , default = False , action = "store_true" , help = "assume BLAST is already sorted [default: %default]" ) p . add_option ( "--hsps" , de... | %prog best blastfile |
11,828 | def summary ( args ) : p = OptionParser ( summary . __doc__ ) p . add_option ( "--strict" , default = False , action = "store_true" , help = "Strict 'gapless' mode. Exclude gaps from covered base." ) p . add_option ( "--tabular" , default = False , action = "store_true" , help = "Print succint tabular output" ) opts , ... | %prog summary blastfile |
11,829 | def subset ( args ) : p = OptionParser ( subset . __doc__ ) p . add_option ( "--qchrs" , default = None , help = "query chrs to extract, comma sep [default: %default]" ) p . add_option ( "--schrs" , default = None , help = "subject chrs to extract, comma sep [default: %default]" ) p . add_option ( "--convert" , default... | %prog subset blastfile qbedfile sbedfile |
11,830 | def flanking ( args ) : p = OptionParser ( flanking . __doc__ ) p . add_option ( "-N" , default = 50 , type = "int" , help = "How many genes on both directions" ) opts , args = p . parse_args ( args ) if len ( args ) != 4 : sys . exit ( not p . print_help ( ) ) SI , liftover , master , te = args N = opts . N SI = SetFi... | %prog flanking SI . ids liftover . bed master . txt master - removed . txt |
11,831 | def geneinfo ( args ) : p = OptionParser ( geneinfo . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 5 : sys . exit ( not p . print_help ( ) ) scfbed , liftoverbed , lgbed , note , ipr = args note = DictFile ( note , delimiter = "\t" ) scfbed = Bed ( scfbed ) lgorder = Bed ( lgbed ) . order liftover... | %prog geneinfo pineapple . 20141004 . bed liftover . bed pineapple . 20150413 . bed \ note . txt interproscan . txt |
11,832 | def ploidy ( args ) : p = OptionParser ( ploidy . __doc__ ) p . add_option ( "--switch" , help = "Rename the seqid with two-column file" ) opts , args , iopts = p . set_image_options ( args , figsize = "9x7" ) if len ( args ) != 5 : sys . exit ( not p . print_help ( ) ) seqidsfile , klayout , datafile , bedfile , slayo... | %prog ploidy seqids karyotype . layout mcscan . out all . bed synteny . layout |
11,833 | def node_to_edge ( edges , directed = True ) : outgoing = defaultdict ( set ) incoming = defaultdict ( set ) if directed else outgoing nodes = set ( ) for i , edge in enumerate ( edges ) : a , b , = edge [ : 2 ] outgoing [ a ] . add ( i ) incoming [ b ] . add ( i ) nodes . add ( a ) nodes . add ( b ) nodes = sorted ( n... | From list of edges record per node incoming and outgoing edges |
11,834 | def resample ( args ) : p = OptionParser ( resample . __doc__ ) opts , args , iopts = p . set_image_options ( args , figsize = "8x4" , dpi = 300 ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) dataA , dataB = args fig = plt . figure ( 1 , ( iopts . w , iopts . h ) ) root = fig . add_axes ( [ 0 , 0 , 1 , ... | %prog resample yellow - catfish - resample . txt medicago - resample . txt |
11,835 | def resamplestats ( args ) : p = OptionParser ( resamplestats . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) pf , runlog = args fp = open ( runlog ) Real = "real" times = [ ] for row in fp : if not row . startswith ( Real ) : continue tag , time = row . sp... | %prog resamplestats prefix run . log |
11,836 | def comparebed ( args ) : p = OptionParser ( comparebed . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) abed , bbed = args abed = Bed ( abed ) bbed = Bed ( bbed ) query_links ( abed , bbed ) query_links ( bbed , abed ) | %prog comparebed AP . chr . bed infer . bed |
11,837 | def simulation ( args ) : p = OptionParser ( simulation . __doc__ ) opts , args , iopts = p . set_image_options ( args , dpi = 300 ) if len ( args ) != 4 : sys . exit ( not p . print_help ( ) ) dataA , dataB , dataC , dataD = args fig = plt . figure ( 1 , ( iopts . w , iopts . h ) ) root = fig . add_axes ( [ 0 , 0 , 1 ... | %prog simulation inversion . txt translocation . txt maps . txt multimaps . txt |
11,838 | def digest ( args ) : p = OptionParser ( digest . __doc__ ) p . set_outfile ( ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) fastafile , enzymes = args enzymes = enzymes . split ( "," ) enzymes = [ x for x in AllEnzymes if str ( x ) in enzymes ] f = Fasta ( fastafil... | %prog digest fastafile NspI BfuCI |
11,839 | def extract_full ( rec , sites , flank , fw ) : for s in sites : newid = "{0}:{1}" . format ( rec . name , s ) left = max ( s - flank , 0 ) right = min ( s + flank , len ( rec ) ) frag = rec . seq [ left : right ] . strip ( "Nn" ) newrec = SeqRecord ( frag , id = newid , description = "" ) SeqIO . write ( [ newrec ] , ... | Full extraction of seq flanking the sites . |
11,840 | def extract_ends ( rec , sites , flank , fw , maxfragsize = 800 ) : nsites = len ( sites ) size = len ( rec ) for i , s in enumerate ( sites ) : newid = "{0}:{1}" . format ( rec . name , s ) recs = [ ] if i == 0 or s - sites [ i - 1 ] <= maxfragsize : newidL = newid + "L" left = max ( s - flank , 0 ) right = s frag = r... | Extraction of ends of fragments above certain size . |
11,841 | def fragment ( args ) : p = OptionParser ( fragment . __doc__ ) p . add_option ( "--flank" , default = 150 , type = "int" , help = "Extract flanking bases of the cut sites [default: %default]" ) p . add_option ( "--full" , default = False , action = "store_true" , help = "The full extraction mode [default: %default]" )... | %prog fragment fastafile enzyme |
11,842 | def calculate_A50 ( ctgsizes , cutoff = 0 , percent = 50 ) : ctgsizes = np . array ( ctgsizes , dtype = "int" ) ctgsizes = np . sort ( ctgsizes ) [ : : - 1 ] ctgsizes = ctgsizes [ ctgsizes >= cutoff ] a50 = np . cumsum ( ctgsizes ) total = np . sum ( ctgsizes ) idx = bisect ( a50 , total * percent / 100. ) l50 = ctgsiz... | Given an array of contig sizes produce A50 N50 and L50 values |
11,843 | def n50 ( args ) : from jcvi . graphics . histogram import loghistogram p = OptionParser ( n50 . __doc__ ) p . add_option ( "--print0" , default = False , action = "store_true" , help = "Print size and L50 to stdout [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) < 1 : sys . exit ( not p . ... | %prog n50 filename |
11,844 | def fromovl ( args ) : p = OptionParser ( fromovl . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) ovlfile , fastafile = args ovl = OVL ( ovlfile ) g = ovl . graph fw = open ( "contained.ids" , "w" ) print ( "\n" . join ( sorted ( ovl . contained ) ) , file ... | %prog graph nucmer2ovl . ovl fastafile |
11,845 | def bed ( args ) : from collections import defaultdict from jcvi . compara . synteny import AnchorFile , check_beds from jcvi . formats . bed import Bed from jcvi . formats . base import get_number p = OptionParser ( bed . __doc__ ) p . add_option ( "--switch" , default = False , action = "store_true" , help = "Switch ... | %prog bed anchorsfile |
11,846 | def happy_edges ( row , prefix = None ) : trans = maketrans ( "[](){}" , " " ) row = row . strip ( ) . strip ( "+" ) row = row . translate ( trans ) scfs = [ x . strip ( "+" ) for x in row . split ( ":" ) ] for a , b in pairwise ( scfs ) : oa = '<' if a . strip ( ) [ 0 ] == '-' else '>' ob = '<' if b . strip ( ) [... | Convert a row in HAPPY file and yield edges . |
11,847 | def partition ( args ) : allowed_format = ( "png" , "ps" ) p = OptionParser ( partition . __doc__ ) p . add_option ( "--prefix" , help = "Add prefix to the name [default: %default]" ) p . add_option ( "--namestart" , default = 0 , type = "int" , help = "Use a shorter name, starting index [default: %default]" ) p . add_... | %prog partition happy . txt synteny . graph |
11,848 | def merge ( args ) : p = OptionParser ( merge . __doc__ ) p . add_option ( "--colorlist" , default = "black,red,pink,blue,green" , help = "The color palette [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) < 1 : sys . exit ( not p . print_help ( ) ) colorlist = opts . colorlist . split ( ","... | %prog merge graphs |
11,849 | def happy ( args ) : p = OptionParser ( happy . __doc__ ) p . add_option ( "--prefix" , help = "Add prefix to the name [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) happyfile , = args certain = "certain.graph" uncertain = "uncertain.graph" fw1 ... | %prog happy happy . txt |
11,850 | def fromblast ( args ) : from jcvi . formats . blast import sort from jcvi . utils . range import range_distance p = OptionParser ( fromblast . __doc__ ) p . add_option ( "--clique" , default = False , action = "store_true" , help = "Populate clique instead of linear path [default: %default]" ) p . add_option ( "--maxd... | %prog fromblast blastfile subject . fasta |
11,851 | def connect ( args ) : p = OptionParser ( connect . __doc__ ) p . add_option ( "--clip" , default = 2000 , type = "int" , help = "Only consider end of contigs [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) fastafile , blastfile = args clip = opt... | %prog connect assembly . fasta read_mapping . blast |
11,852 | def grasstruth ( args ) : p = OptionParser ( grasstruth . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) james , = args fp = open ( james ) pairs = set ( ) for row in fp : atoms = row . split ( ) genes = [ ] idx = { } for i , a in enumerate ( atoms ) : aa = ... | %prog grasstruth james - pan - grass . txt |
11,853 | def cyntenator ( args ) : p = OptionParser ( cyntenator . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) < 2 : sys . exit ( not p . print_help ( ) ) lastfile = args [ 0 ] fp = open ( lastfile ) filteredlastfile = lastfile + ".blast" fw = open ( filteredlastfile , "w" ) for row in fp : b = BlastLine ( r... | %prog cyntenator athaliana . athaliana . last athaliana . bed |
11,854 | def iadhore ( args ) : p = OptionParser ( iadhore . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) < 2 : sys . exit ( not p . print_help ( ) ) lastfile = args [ 0 ] bedfiles = args [ 1 : ] blast_table = "blast_table.txt" fp = open ( lastfile ) seen = set ( ) for row in fp : c = BlastLine ( row ) a , b ... | %prog iadhore athaliana . athaliana . last athaliana . bed |
11,855 | def athalianatruth ( args ) : p = OptionParser ( athalianatruth . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) atxt , bctxt = args g = Grouper ( ) pairs = set ( ) for txt in ( atxt , bctxt ) : extract_groups ( g , pairs , txt ) fw = open ( "pairs" , "w" ) ... | %prog athalianatruth J_a . txt J_bc . txt |
11,856 | def mcscanx ( args ) : p = OptionParser ( mcscanx . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) < 2 : sys . exit ( not p . print_help ( ) ) blastfile = args [ 0 ] bedfiles = args [ 1 : ] prefix = "_" . join ( op . basename ( x ) [ : 2 ] for x in bedfiles ) symlink ( blastfile , prefix + ".blast" ) a... | %prog mcscanx athaliana . athaliana . last athaliana . bed |
11,857 | def grass ( args ) : p = OptionParser ( grass . _doc__ ) p . set_verbose ( ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) master , james = args fp = open ( master ) next ( fp ) master_store = defaultdict ( set ) for row in fp : atoms = row . split ( ) s = set ( ) fo... | %prog grass coge_master_table . txt james . txt |
11,858 | def ecoli ( args ) : p = OptionParser ( ecoli . __doc__ ) p . set_outfile ( ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) master , querybed = args fp = open ( master ) header = next ( fp ) assert header [ 0 ] == '#' qorg = header . strip ( ) . split ( "\t" ) [ 1 ] ... | %prog ecoli coge_master_table . txt query . bed |
11,859 | def parallel ( args ) : from jcvi . formats . base import split p = OptionParser ( parallel . __doc__ ) p . set_home ( "maker" ) p . set_tmpdir ( tmpdir = "tmp" ) p . set_grid_opts ( array = True ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) genome , NN = args thre... | %prog parallel genome . fasta N |
11,860 | def merge ( args ) : from jcvi . formats . gff import merge as gmerge p = OptionParser ( merge . __doc__ ) p . set_home ( "maker" ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) outdir , outputgff = args fsnames , suffix = get_fsnames ( outdir ) nfs = len ( fsnames )... | %prog merge outdir output . gff |
11,861 | def validate ( args ) : from jcvi . utils . counter import Counter p = OptionParser ( validate . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) outdir , genome = args counter = Counter ( ) fsnames , suffix = get_fsnames ( outdir ) dsfile = "{0}{1}/{0}.maker.... | %prog validate outdir genome . fasta |
11,862 | def batcheval ( args ) : from jcvi . formats . bed import evaluate from jcvi . formats . gff import make_index p = OptionParser ( evaluate . __doc__ ) p . add_option ( "--type" , default = "CDS" , help = "list of features to extract, use comma to separate (e.g." "'five_prime_UTR,CDS,three_prime_UTR') [default: %default... | %prog batcheval model . ids gff_file evidences . bed fastafile |
11,863 | def get_splits ( split_bed , gff_file , stype , key ) : bed_file = get_bed_file ( gff_file , stype , key ) cmd = "intersectBed -a {0} -b {1} -wao" . format ( split_bed , bed_file ) cmd += " | cut -f4,10" p = popen ( cmd ) splits = defaultdict ( set ) for row in p : a , b = row . split ( ) splits [ a ] . add ( b ) retur... | Use intersectBed to find the fused gene = > split genes mappings . |
11,864 | def split ( args ) : from jcvi . formats . bed import Bed p = OptionParser ( split . __doc__ ) p . add_option ( "--key" , default = "Name" , help = "Key in the attributes to extract predictor.gff [default: %default]" ) p . add_option ( "--parents" , default = "match" , help = "list of features to extract, use comma to ... | %prog split split . bed evidences . bed predictor1 . gff predictor2 . gff fastafile |
11,865 | def datastore ( args ) : p = OptionParser ( datastore . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) ds , = args fp = open ( ds ) for row in fp : fn = row . strip ( ) assert op . exists ( fn ) pp , logfile = op . split ( fn ) flog = open ( fn ) for row in ... | %prog datastore datastore . log > gfflist . log |
11,866 | def libsvm ( args ) : from jcvi . formats . base import DictFile p = OptionParser ( libsvm . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) csvfile , prefixids = args d = DictFile ( prefixids ) fp = open ( csvfile ) next ( fp ) for row in fp : atoms = row . ... | %prog libsvm csvfile prefix . ids |
11,867 | def determine_positions ( nodes , edges ) : N = len ( nodes ) E = len ( edges ) A = np . zeros ( ( E , N ) , dtype = int ) for i , ( a , b , distance ) in enumerate ( edges ) : A [ i , a ] = 1 A [ i , b ] = - 1 K = np . eye ( E , dtype = int ) L = np . array ( [ x [ - 1 ] for x in edges ] ) s = spring_system ( A , K , ... | Construct the problem instance to solve the positions of contigs . |
11,868 | def determine_signs ( nodes , edges , cutoff = 1e-10 ) : N = len ( nodes ) M = np . zeros ( ( N , N ) , dtype = float ) for a , b , w in edges : M [ a , b ] += w M = symmetrize ( M ) return get_signs ( M , cutoff = cutoff , validate = False ) | Construct the orientation matrix for the pairs on N molecules . |
11,869 | def fix ( args ) : p = OptionParser ( fix . __doc__ ) p . add_option ( "--ignore_sym_pat" , default = False , action = "store_true" , help = "Do not fix names matching symbol patterns i.e." + " names beginning or ending with gene symbols or a series of numbers." + " e.g. `ARM repeat superfamily protein`, `beta-hexosami... | %prog fix ahrd . csv > ahrd . fixed . csv |
11,870 | def batch ( args ) : p = OptionParser ( batch . __doc__ ) ahrd_weights = { "blastp" : [ 0.5 , 0.3 , 0.2 ] , "blastx" : [ 0.6 , 0.4 , 0.0 ] } blast_progs = tuple ( ahrd_weights . keys ( ) ) p . add_option ( "--path" , default = "~/code/AHRD/" , help = "Path where AHRD is installed [default: %default]" ) p . add_option (... | %prog batch splits output |
11,871 | def to_range ( obj , score = None , id = None , strand = None ) : from jcvi . utils . range import Range if score or id : _score = score if score else obj . score _id = id if id else obj . id return Range ( seqid = obj . seqid , start = obj . start , end = obj . end , score = _score , id = _id ) elif strand : return ( ... | Given a gffutils object convert it to a range object |
11,872 | def sizes ( args ) : p = OptionParser ( sizes . __doc__ ) p . set_outfile ( ) p . add_option ( "--parents" , dest = "parents" , default = "mRNA" , help = "parent feature(s) for which size is to be calculated" ) p . add_option ( "--child" , dest = "child" , default = "CDS" , help = "child feature to use for size calcula... | %prog sizes gffile |
11,873 | def summary ( args ) : from jcvi . formats . base import SetFile from jcvi . formats . bed import BedSummary from jcvi . utils . table import tabulate p = OptionParser ( summary . __doc__ ) p . add_option ( "--isoform" , default = False , action = "store_true" , help = "Find longest isoform of each id" ) p . add_option... | %prog summary gffile |
11,874 | def gb ( args ) : from Bio . Alphabet import generic_dna try : from BCBio import GFF except ImportError : print ( "You need to install dep first: $ easy_install bcbio-gff" , file = sys . stderr ) p = OptionParser ( gb . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_he... | %prog gb gffile fastafile |
11,875 | def orient ( args ) : from jcvi . formats . fasta import longestorf p = OptionParser ( orient . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) ingff3 , fastafile = args idsfile = fastafile . rsplit ( "." , 1 ) [ 0 ] + ".orf.ids" if need_update ( fastafile , ... | %prog orient in . gff3 features . fasta > out . gff3 |
11,876 | def rename ( args ) : p = OptionParser ( rename . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) ingff3 , switch = args switch = DictFile ( switch ) gff = Gff ( ingff3 ) for g in gff : id , = g . attributes [ "ID" ] newname = switch . get ( id , id ) g . att... | %prog rename in . gff3 switch . ids > reindexed . gff3 |
11,877 | def parents ( args ) : p = OptionParser ( parents . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) gff_file , idsfile = args g = make_index ( gff_file ) fp = open ( idsfile ) for row in fp : cid = row . strip ( ) b = next ( g . parents ( cid , 1 ) ) print ( ... | %prog parents gffile models . ids |
11,878 | def liftover ( args ) : p = OptionParser ( liftover . __doc__ ) p . add_option ( "--tilesize" , default = 50000 , type = "int" , help = "The size for each tile [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) gffile , = args gff = Gff ( gffile ) f... | %prog liftover gffile > liftover . gff |
11,879 | def get_piles ( allgenes ) : from jcvi . utils . range import Range , range_piles ranges = [ Range ( a . seqid , a . start , a . end , 0 , i ) for i , a in enumerate ( allgenes ) ] for pile in range_piles ( ranges ) : yield [ allgenes [ x ] for x in pile ] | Before running uniq we need to compute all the piles . The piles are a set of redundant features we want to get rid of . Input are a list of GffLines features . Output are list of list of features distinct piles . |
11,880 | def match_subfeats ( f1 , f2 , dbx1 , dbx2 , featuretype = None , slop = False ) : f1c , f2c = list ( dbx1 . children ( f1 , featuretype = featuretype , order_by = 'start' ) ) , list ( dbx2 . children ( f2 , featuretype = featuretype , order_by = 'start' ) ) lf1c , lf2c = len ( f1c ) , len ( f2c ) if match_nchildren ( ... | Given 2 gffutils features located in 2 separate gffutils databases iterate through all subfeatures of a certain type and check whether they are identical or not |
11,881 | def uniq ( args ) : supported_modes = ( "span" , "score" ) p = OptionParser ( uniq . __doc__ ) p . add_option ( "--type" , default = "gene" , help = "Types of features to non-redundify [default: %default]" ) p . add_option ( "--mode" , default = "span" , choices = supported_modes , help = "Pile mode [default: %default]... | %prog uniq gffile > uniq . gff |
11,882 | def sort ( args ) : valid_sort_methods = ( "unix" , "topo" ) p = OptionParser ( sort . __doc__ ) p . add_option ( "--method" , default = "unix" , choices = valid_sort_methods , help = "Specify sort method [default: %default]" ) p . add_option ( "-i" , dest = "inplace" , default = False , action = "store_true" , help = ... | %prog sort gffile |
11,883 | def fromgtf ( args ) : p = OptionParser ( fromgtf . __doc__ ) p . add_option ( "--transcript_id" , default = "transcript_id" , help = "Field name for transcript [default: %default]" ) p . add_option ( "--gene_id" , default = "gene_id" , help = "Field name for gene [default: %default]" ) p . add_option ( "--augustus" , ... | %prog fromgtf gtffile |
11,884 | def fromsoap ( args ) : p = OptionParser ( fromsoap . __doc__ ) p . add_option ( "--type" , default = "nucleotide_match" , help = "GFF feature type [default: %default]" ) p . add_option ( "--source" , default = "soap" , help = "GFF source qualifier [default: %default]" ) p . set_fixchrnames ( orgn = "maize" ) p . set_o... | %prog fromsoap soapfile > gff_file |
11,885 | def gtf ( args ) : p = OptionParser ( gtf . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) gffile , = args gff = Gff ( gffile ) transcript_info = AutoVivification ( ) for g in gff : if g . type . endswith ( ( "RNA" , "transcript" ) ) : if "ID" in g . attribu... | %prog gtf gffile |
11,886 | def merge ( args ) : p = OptionParser ( merge . __doc__ ) p . add_option ( "--seq" , default = False , action = "store_true" , help = "Print FASTA sequences at the end" ) p . set_outfile ( ) opts , args = p . parse_args ( args ) nargs = len ( args ) if nargs < 1 : sys . exit ( not p . print_help ( ) ) if nargs == 1 : l... | %prog merge gffiles |
11,887 | def extract ( args ) : p = OptionParser ( extract . __doc__ ) p . add_option ( "--contigs" , help = "Extract features from certain contigs [default: %default]" ) p . add_option ( "--names" , help = "Extract features with certain names [default: %default]" ) p . add_option ( "--types" , type = "str" , default = None , h... | %prog extract gffile |
11,888 | def split ( args ) : p = OptionParser ( split . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) gffile , outdir = args mkdir ( outdir ) g = Gff ( gffile ) seqids = g . seqids for s in seqids : outfile = op . join ( outdir , s + ".gff" ) extract ( [ gffile , "... | %prog split gffile outdir |
11,889 | def note ( args ) : p = OptionParser ( note . __doc__ ) p . add_option ( "--type" , default = None , help = "Only process certain types, multiple types allowed with comma" ) p . add_option ( "--attribute" , default = "Parent,Note" , help = "Attribute field to extract, multiple fields allowd with comma" ) p . add_option... | %prog note gffile > tabfile |
11,890 | def make_index ( gff_file ) : import gffutils db_file = gff_file + ".db" if need_update ( gff_file , db_file ) : if op . exists ( db_file ) : os . remove ( db_file ) logging . debug ( "Indexing `{0}`" . format ( gff_file ) ) gffutils . create_db ( gff_file , db_file , merge_strategy = "create_unique" ) else : logging .... | Make a sqlite database for fast retrieval of features . |
11,891 | def children ( args ) : p = OptionParser ( children . __doc__ ) p . add_option ( "--parents" , default = "gene" , help = "list of features to extract, use comma to separate (e.g." "'gene,mRNA') [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) gff_... | %prog children gff_file |
11,892 | def bed12 ( args ) : p = OptionParser ( bed12 . __doc__ ) p . add_option ( "--parent" , default = "mRNA" , help = "Top feature type [default: %default]" ) p . add_option ( "--block" , default = "exon" , help = "Feature type for regular blocks [default: %default]" ) p . add_option ( "--thick" , default = "CDS" , help = ... | %prog bed12 gffile > bedfile |
11,893 | def bed ( args ) : p = OptionParser ( bed . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( p . print_help ( ) ) flist = args prefix = flist [ 0 ] . split ( "." ) [ 0 ] j = 0 for f in flist : reader = Maf ( f ) . reader for rec in reader : a , b = rec . components for a , tag in zip ... | %prog bed maffiles > out . bed |
11,894 | def blast ( args ) : p = OptionParser ( blast . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) == 0 : sys . exit ( p . print_help ( ) ) flist = args for f in flist : maf_to_blast8 ( f ) | %prog blast maffiles > out . blast |
11,895 | def genome_mutation ( candidate ) : size = len ( candidate ) prob = random . random ( ) if prob > .5 : p = random . randint ( 0 , size - 1 ) q = random . randint ( 0 , size - 1 ) if p > q : p , q = q , p q += 1 s = candidate [ p : q ] x = candidate [ : p ] + s [ : : - 1 ] + candidate [ q : ] return creator . Individual... | Return the mutants created by inversion mutation on the candidates . |
11,896 | def frombed ( args ) : from jcvi . formats . fasta import Fasta from jcvi . formats . bed import Bed from jcvi . utils . cbook import fill p = OptionParser ( frombed . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 3 : sys . exit ( not p . print_help ( ) ) bedfile , contigfasta , readfasta = args pr... | %prog frombed bedfile contigfasta readfasta |
11,897 | def bed ( args ) : p = OptionParser ( main . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) contigfile , = args bedfile = contigfile . rsplit ( "." , 1 ) [ 0 ] + ".bed" fw = open ( bedfile , "w" ) c = ContigFile ( contigfile ) for rec in c . iter_records ( )... | %prog bed contigfile |
11,898 | def get_errors ( error_string ) : lines = error_string . splitlines ( ) error_lines = tuple ( line for line in lines if line . find ( 'Error' ) >= 0 ) if len ( error_lines ) > 0 : return '\n' . join ( error_lines ) else : return error_string . strip ( ) | returns all lines in the error_string that start with the string error |
11,899 | def tempnam ( ) : stderr = sys . stderr try : sys . stderr = cStringIO . StringIO ( ) return os . tempnam ( None , 'tess_' ) finally : sys . stderr = stderr | returns a temporary file - name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.