annotate docs/scripts/txt/MergeTextFilesWithSD.txt @ 3:90ea638ce878 draft default tip

Uploaded
author deepakjadmin
date Wed, 20 Jan 2016 09:11:59 -0500
parents 2abf0d43254d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
1 NAME
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
2 MergeTextFilesWithSD.pl - Merge CSV or TSV TextFile(s) into SDFile
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
3
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
4 SYNOPSIS
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
5 MergeTextFilesWithSD.pl SDFile TextFile(s)...
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
6
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
7 MergeTextFilesWithSD.pl [-h, --help] [--indelim comma | semicolon] [-c,
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
8 --columns colnum,...;... | collabel,...;...] [-k, --keys colkeynum;... |
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
9 colkeylabel;...] [-m, --mode colnum | collabel] [-o, --overwrite] [-r,
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
10 --root rootname] [-s, --sdkey sdfieldname] [-w, --workingdir dirname]
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
11 SDFile TextFile(s)...
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
12
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
13 DESCRIPTION
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
14 Merge multiple CSV or TSV *TextFile(s)* into *SDFile*. Unless -k --keys
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
15 option is used, data rows from all *TextFile(s)* are added to *SDFile*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
16 in a sequential order, and the number of compounds in *SDFile* is used
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
17 to determine how many rows of data are added from *TextFile(s)*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
18
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
19 Multiple *TextFile(s)* names are separated by spaces. The valid file
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
20 extensions are *.csv* and *.tsv* for comma/semicolon and tab delimited
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
21 text files respectively. All other file names are ignored. All the text
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
22 files in a current directory can be specified by **.csv*, **.tsv*, or
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
23 the current directory name. The --indelim option determines the format
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
24 of *TextFile(s)*. Any file which doesn't correspond to the format
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
25 indicated by --indelim option is ignored.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
26
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
27 OPTIONS
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
28 -h, --help
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
29 Print this help message.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
30
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
31 --indelim *comma | semicolon*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
32 Input delimiter for CSV *TextFile(s)*. Possible values: *comma or
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
33 semicolon*. Default value: *comma*. For TSV files, this option is
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
34 ignored and *tab* is used as a delimiter.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
35
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
36 -c, --columns *colnum,...;... | collabel,...;...*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
37 This value is mode specific. It is a list of columns to merge into
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
38 *SDFile* specified by column numbers or labels for each text file
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
39 delimited by ";". All *TextFile(s)* are merged into *SDFile*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
40
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
41 Default value: *all;all;...*. By default, all columns from
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
42 TextFile(s) are merged into *SDFile*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
43
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
44 For *colnum* mode, input value format is:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
45 *colnum,...;colnum,...;...*. Example:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
46
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
47 "1,2;1,3,4;7,8,9"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
48
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
49 For *collabel* mode, input value format is:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
50 *collabel,...;collabel,...;...*. Example:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
51
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
52 "MW,SumNO;SumNHOH,ClogP,PSA;MolName,Mol_Id,Extreg"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
53
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
54 -k, --keys *colkeynum;... | colkeylabel;...*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
55 This value is mode specific. It specifies column keys to use for
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
56 merging *TextFile(s)* into *SDFile*. The column keys, delimited by
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
57 ";", are specified by column numbers or labels for *TextFile(s)*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
58
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
59 By default, data rows from *TextFile(s)* are merged into *SDFile* in
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
60 the order they appear.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
61
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
62 For *colnum* mode, input value format is:*colkeynum, colkeynum;...*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
63 Example:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
64
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
65 "1;3;7"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
66
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
67 For *collabel* mode, input value format is:*colkeylabel,
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
68 colkeylabel;...*. Example:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
69
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
70 "Mol_Id;Mol_Id;Cmpd_Id"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
71
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
72 -m, --mode *colnum | collabel*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
73 Specify how to merge *TextFile(s)* into *SDFile*: using column
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
74 numbers or column labels. Possible values: *colnum or collabel*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
75 Default value: *colnum*.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
76
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
77 -o, --overwrite
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
78 Overwrite existing files.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
79
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
80 -r, --root *rootname*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
81 New SD file name is generated using the root: <Root>.sdf. Default
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
82 file name:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
83 <InitialSDFileName>MergedWith<FirstTextFileName>1To<Count>.sdf.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
84
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
85 -s, --sdkey *sdfieldname*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
86 *SDFile* data field name used as a key to merge data from
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
87 TextFile(s). By default, data rows from *TextFile(s)* are merged
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
88 into *SDFile* in the order they appear.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
89
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
90 -w, --workingdir *dirname*
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
91 Location of working directory. Default: current directory.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
92
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
93 EXAMPLES
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
94 To merge Sample1.csv and Sample2.csv into Sample.sdf and generate
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
95 NewSample.sdf, type:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
96
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
97 % MergeTextFileswithSD.pl -r NewSample -o Sample.sdf
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
98 Sample1.csv Sample2.csv
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
99
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
100 To merge all Sample*.tsv into Sample.sdf and generate NewSample.sdf
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
101 file, type:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
102
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
103 % MergeTextFilesWithSD.pl -r NewSample -o Sample.sdf
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
104 Sample*.tsv
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
105
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
106 To merge column numbers "1,2" and "3,4,5" from Sample2.csv and
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
107 Sample3.csv into Sample.sdf and to generate NewSample.sdf, type:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
108
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
109 % MergeTextFilesWithSD.pl -r NewSample -m colnum -c "1,2;3,4,5"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
110 -o Sample.sdf Sample1.csv Sample2.csv
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
111
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
112 To merge column "Mol_ID,Formula,MolWeight" and "Mol_ID,ChemBankID,NAME"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
113 from Sample1.csv and Sample2.csv into Sample.sdf using "Mol_ID" as SD
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
114 and column keys to generate NewSample.sdf, type:
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
115
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
116 % MergeTextFilesWithSD.pl -r NewSample -s Mol_ID -k "Mol_ID;Mol_ID"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
117 -m collabel -c "Mol_ID,Formula,MolWeight;Mol_ID,ChemBankID,NAME"
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
118 -o Sample1.sdf Sample1.csv Sample2.csv
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
119
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
120 AUTHOR
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
121 Manish Sud <msud@san.rr.com>
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
122
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
123 SEE ALSO
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
124 ExtractFromSDFiles.pl, FilterSDFiles.pl, InfoSDFiles.pl, JoinSDFiles.pl,
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
125 JoinTextFiles.pl, MergeTextFiles.pl, ModifyTextFilesFormat.pl,
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
126 SplitSDFiles.pl, SplitTextFiles.pl
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
127
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
128 COPYRIGHT
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
129 Copyright (C) 2015 Manish Sud. All rights reserved.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
130
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
131 This file is part of MayaChemTools.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
132
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
133 MayaChemTools is free software; you can redistribute it and/or modify it
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
134 under the terms of the GNU Lesser General Public License as published by
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
135 the Free Software Foundation; either version 3 of the License, or (at
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
136 your option) any later version.
2abf0d43254d Uploaded
deepakjadmin
parents:
diff changeset
137