 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
22 "Usage: bseq [options] input.seq output.seq",
23 "------------------------------------------",
24 "Manipulates DNA and protein sequences.",
27 "-show Show all DNA and protein sequences after other operations.",
28 "-Mass Show the calculated mass for each sequence.",
29 "-complement Complement all DNA sequences before other operations.",
30 "-translate 1 Translate all DNA sequences with this frame (0,1,2).",
31 "-finddna ggattcga DNA sequence to look for in DNA sequences.",
32 "-findprotein fghwereaas Protein sequence to look for in protein sequences.",
33 "-findcoding aklsdrtv Coding sequence to look for in DNA sequences.",
34 " Can be a file name with a protein sequence.",
37 "-verbose 7 Verbosity of output.",
38 "-nogaps Strip gaps from input sequences.",
39 "-length 1100,1500 Sequence length range to select for.",
40 "-number 10,14 Number of residues on either side to include in output.",
41 "-threshold 50 Threshold percentage to report hits (default only best hit).",
44 "-geneticcode file.star Genetic code file (default = internal values).",
45 "-elements prop.star Calculate elemental composition.",
50 int main(
int argc,
char **argv)
59 int side1(0), side2(0);
62 int seqlenmax(100000);
74 for ( curropt = option; curropt; curropt = curropt->
next ) {
75 if ( curropt->
tag ==
"nogaps" )
76 atom_select =
"nogap";
77 if ( curropt->
tag ==
"show" )
79 if ( curropt->
tag ==
"Mass" )
81 if ( curropt->
tag ==
"complement" )
83 if ( curropt->
tag ==
"translate" ) {
85 cerr <<
"-translate: A frame must be specified!" << endl;
86 while ( frame < 0 ) frame += 3;
87 while ( frame > 2 ) frame -= 3;
90 if ( curropt->
tag ==
"length" ) {
91 if ( curropt->
values(seqlenmin, seqlenmax) < 1 )
92 cerr <<
"-length: Minimum and maximum lengths must be specified!" << endl;
94 if ( seqlenmin < 0 ) seqlenmin = 0;
95 if ( seqlenmax < seqlenmin ) {
97 seqlenmin = seqlenmax;
100 if ( seqlenmax == seqlenmin ) seqlenmax = seqlenmin + 1;
103 if ( curropt->
tag ==
"finddna" ) {
107 if ( curropt->
tag ==
"findprotein" ) {
111 if ( curropt->
tag ==
"findcoding" ) {
115 if ( curropt->
tag ==
"Sequence" ) {
117 if ( seqfile.
length() ) setfind = 3;
119 if ( curropt->
tag ==
"number" )
120 if ( curropt->
values(side1, side2) < 1 )
121 cerr <<
"-number: At least one number must be specified!" << endl;
122 if ( curropt->
tag ==
"threshold" )
123 if ( ( threshold = curropt->
value.
real() ) < 1e-30 )
124 cerr <<
"-threshold: A threshold must be specified!" << endl;
125 if ( curropt->
tag ==
"geneticcode" )
127 if ( curropt->
tag ==
"elements" )
139 seq_request =
read_molecule(seqfile, atom_select, paramfile);
144 seq = seq_request->
mol->
seq;
145 seq_request->
mol->
seq = NULL;
152 threshold = floor(threshold*seq.
length()/100.0);
155 if ( optind >= argc ) {
156 cerr <<
"Error: No input file given!" << endl;
160 if (
verbose && seq.
length() ) cout <<
"Search string: " << seq << endl;
163 seqfile = argv[optind++];
166 cerr <<
"Error: No input file given!" << endl;
A class for a command line input option.
vector< double > seq_elements(Bmolgroup *molgroup, Bstring ¶mfile)
Shows the elemental composition of all molecular sequences.
int molgroup_kill(Bmolgroup *molgroup)
Destroys a molecule group.
int molecule_update_comment(Bmolgroup *molgroup, int n, char **strings)
Puts a set of strings and time in the main comment of a molecule group.
Bstring seq_find_protein_in_dna(Bmolgroup *molgroup, Bstring &seq, int seqlenmin, int seqlenmax, int side1, int side2, double threshold, Bstring &gcfile)
Finds the coding region for an amino acid sequence.
int bexit(int value)
Exit function for cleanup and debugging.
int main(int argc, char **argv)
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
long seq_find_dna(Bmolgroup *molgroup, Bstring &seq)
Finds a nucleotide sequence.
Bmolgroup * read_molecule(const char *filename, const char *select, const char *paramfile)
The generalized function for reading molecular files.
Header file for option handlers.
int seq_translate_all(Bmolgroup *molgroup, int frame, Bstring &gcname)
Translates all nucleotide sequences to protein sequences.
long values(T1 &v1, T2 &v2)
int seq_mass(Bmolgroup *molgroup)
Shows the masses of all molecular sequences.
Header file for reading reflection files.
Header file for reading a genetic code from a file.
int seq_complement_all(Bmolgroup *molgroup)
Complements all nucleotide sequences.
Utilities for timing functions.
long seq_find_protein(Bmolgroup *molgroup, Bstring &seq)
Finds an amino acid sequence.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Header file for sequence utilities.
int write_molecule(char *filename, Bmolgroup *molgroup)
Writes a molecule group.
int seq_show(Bmolgroup *molgroup)
Shows all molecular sequences.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
bool contains(const Bstring &s)