Package Bio :: Package Sequencing :: Package Applications :: Module _Novoalign
[hide private]
[frames] | no frames]

Source Code for Module Bio.Sequencing.Applications._Novoalign

  1  # Copyright 2009 by Osvaldo Zagordi.  All rights reserved. 
  2  # Revisions copyright 2010 by Peter Cock. 
  3  # This code is part of the Biopython distribution and governed by its 
  4  # license.  Please see the LICENSE file that should have been included 
  5  # as part of this package. 
  6  """Command line wrapper for the short read aligner Novoalign by Novocraft.""" 
  7   
  8  from __future__ import print_function 
  9   
 10  from Bio.Application import _Option, AbstractCommandline 
 11   
 12   
13 -class NovoalignCommandline(AbstractCommandline):
14 """Command line wrapper for novoalign by Novocraft. 15 16 See www.novocraft.com - novoalign is a short read alignment program. 17 18 Example: 19 20 >>> from Bio.Sequencing.Applications import NovoalignCommandline 21 >>> novoalign_cline = NovoalignCommandline(database='some_db', 22 ... readfile='some_seq.txt') 23 >>> print(novoalign_cline) 24 novoalign -d some_db -f some_seq.txt 25 26 As with all the Biopython application wrappers, you can also add or 27 change options after creating the object: 28 29 >>> novoalign_cline.format = 'PRBnSEQ' 30 >>> novoalign_cline.r_method='0.99' # limited valid values 31 >>> novoalign_cline.fragment = '250 20' # must be given as a string 32 >>> novoalign_cline.miRNA = 100 33 >>> print(novoalign_cline) 34 novoalign -d some_db -f some_seq.txt -F PRBnSEQ -r 0.99 -i 250 20 -m 100 35 36 You would typically run the command line with novoalign_cline() or via 37 the Python subprocess module, as described in the Biopython tutorial. 38 39 Last checked against version: 2.05.04 40 """
41 - def __init__(self, cmd="novoalign", **kwargs):
42 43 READ_FORMAT = ['FA', 'SLXFQ', 'STDFQ', 'ILMFQ', 'PRB', 'PRBnSEQ'] 44 REPORT_FORMAT = ['Native', 'Pairwise', 'SAM'] 45 REPEAT_METHOD = ['None', 'Random', 'All', 'Exhaustive', '0.99'] 46 47 self.parameters = [ 48 _Option(["-d", "database"], 49 "database filename", 50 filename=True, 51 equate=False), 52 _Option(["-f", "readfile"], 53 "read file", 54 filename=True, 55 equate=False), 56 _Option(["-F", "format"], 57 "Format of read files.\n\nAllowed values: %s" 58 % ", ".join(READ_FORMAT), 59 checker_function=lambda x: x in READ_FORMAT, 60 equate=False), 61 62 # Alignment scoring options 63 _Option(["-t", "threshold"], 64 "Threshold for alignment score", 65 checker_function=lambda x: isinstance(x, int), 66 equate=False), 67 _Option(["-g", "gap_open"], 68 "Gap opening penalty [default: 40]", 69 checker_function=lambda x: isinstance(x, int), 70 equate=False), 71 _Option(["-x", "gap_extend"], 72 "Gap extend penalty [default: 15]", 73 checker_function=lambda x: isinstance(x, int), 74 equate=False), 75 _Option(["-u", "unconverted"], 76 "Experimental: unconverted cytosines penalty in bisulfite mode\n\n" 77 "Default: no penalty", 78 checker_function=lambda x: isinstance(x, int), 79 equate=False), 80 81 # Quality control and read filtering 82 _Option(["-l", "good_bases"], 83 "Minimum number of good quality bases [default: log(N_g, 4) + 5]", 84 checker_function=lambda x: isinstance(x, int), 85 equate=False), 86 _Option(["-h", "homopolymer"], 87 "Homopolymer read filter [default: 20; disable: negative value]", 88 checker_function=lambda x: isinstance(x, int), 89 equate=False), 90 91 # Read preprocessing options 92 _Option(["-a", "adapter3"], 93 "Strips a 3' adapter sequence prior to alignment.\n\n" 94 "With paired ends two adapters can be specified", 95 checker_function=lambda x: isinstance(x, str), 96 equate=False), 97 _Option(["-n", "truncate"], 98 "Truncate to specific length before alignment", 99 checker_function=lambda x: isinstance(x, int), 100 equate=False), 101 _Option(["-s", "trimming"], 102 "If fail to align, trim by s bases until they map or become shorter than l.\n\n" 103 "Ddefault: 2", 104 checker_function=lambda x: isinstance(x, int), 105 equate=False), 106 _Option(["-5", "adapter5"], 107 "Strips a 5' adapter sequence.\n\n" 108 "Similar to -a (adaptor3), but on the 5' end.", 109 checker_function=lambda x: isinstance(x, str), 110 equate=False), 111 # Reporting options 112 _Option(["-o", "report"], 113 "Specifies the report format.\n\nAllowed values: %s\nDefault: Native" 114 % ", ".join(REPORT_FORMAT), 115 checker_function=lambda x: x in REPORT_FORMAT, 116 equate=False), 117 _Option(["-Q", "quality"], 118 "Lower threshold for an alignment to be reported [default: 0]", 119 checker_function=lambda x: isinstance(x, int), 120 equate=False), 121 _Option(["-R", "repeats"], 122 "If score difference is higher, report repeats.\n\n" 123 "Otherwise -r read method applies [default: 5]", 124 checker_function=lambda x: isinstance(x, int), 125 equate=False), 126 _Option(["-r", "r_method"], 127 "Methods to report reads with multiple matches.\n\n" 128 "Allowed values: %s\n" 129 "'All' and 'Exhaustive' accept limits." 130 % ", ".join(REPEAT_METHOD), 131 checker_function=lambda x: x.split()[0] in REPEAT_METHOD, 132 equate=False), 133 _Option(["-e", "recorded"], 134 "Alignments recorded with score equal to the best.\n\n" 135 "Default: 1000 in default read method, otherwise no limit.", 136 checker_function=lambda x: isinstance(x, int), 137 equate=False), 138 _Option(["-q", "qual_digits"], 139 "Decimal digits for quality scores [default: 0]", 140 checker_function=lambda x: isinstance(x, int), 141 equate=False), 142 143 # Paired end options 144 _Option(["-i", "fragment"], 145 "Fragment length (2 reads + insert) and standard deviation [default: 250 30]", 146 checker_function=lambda x: len(x.split()) == 2, 147 equate=False), 148 _Option(["-v", "variation"], 149 "Structural variation penalty [default: 70]", 150 checker_function=lambda x: isinstance(x, int), 151 equate=False), 152 153 # miRNA mode 154 _Option(["-m", "miRNA"], 155 "Sets miRNA mode and optionally sets a value for the region scanned [default: off]", 156 checker_function=lambda x: isinstance(x, int), 157 equate=False), 158 159 # Multithreading 160 _Option(["-c", "cores"], 161 "Number of threads, disabled on free versions [default: number of cores]", 162 checker_function=lambda x: isinstance(x, int), 163 equate=False), 164 165 # Quality calibrations 166 _Option(["-k", "read_cal"], 167 "Read quality calibration from file (mismatch counts)", 168 checker_function=lambda x: isinstance(x, str), 169 equate=False), 170 _Option(["-K", "write_cal"], 171 "Accumulate mismatch counts and write to file", 172 checker_function=lambda x: isinstance(x, str), 173 equate=False), 174 ] 175 AbstractCommandline.__init__(self, cmd, **kwargs)
176 177 178 if __name__ == "__main__": 179 from Bio._utils import run_doctest 180 run_doctest() 181