Skip to content

Commit 536833b

Browse files
author
Jon Palmer
committed
add pseudopooling option to dada2
1 parent af0520b commit 536833b

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

amptk/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VERSION = (1, 4, 1)
1+
VERSION = (1, 4, 2)
22

33
__version__ = '.'.join(map(str, VERSION))

amptk/dada2.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def main(args):
7474
parser.add_argument('--chimera_method', default='consensus', choices=['consensus', 'pooled', 'per-sample'], help='bimera removal method')
7575
parser.add_argument('--uchime_ref', help='Run UCHIME REF [ITS,16S,LSU,COI,custom]')
7676
parser.add_argument('--pool', action='store_true', help='Pool all sequences together for DADA2')
77+
parser.add_argument('--pseudopool', action='store_true', help='Use DADA2 pseudopooling')
7778
parser.add_argument('--debug', action='store_true', help='Keep all intermediate files')
7879
parser.add_argument('-u','--usearch', dest="usearch", default='usearch9', help='USEARCH9 EXE')
7980
parser.add_argument('--cpus', type=int, help="Number of CPUs. Default: auto")
@@ -172,16 +173,23 @@ def main(args):
172173
os.remove(os.path.join(filtfolder, y))
173174

174175
#now run DADA2 on filtered folder
175-
amptklib.log.info("Running DADA2 pipeline")
176-
dada2log = base+'.dada2.Rscript.log'
177-
dada2out = base+'.dada2.csv'
178-
#check pooling vs notpooled, default is not pooled.
176+
#check pooling pseudopooling or notpooled, default is not pooled.
179177
if args.pool:
180178
POOL = 'TRUE'
179+
amptklib.log.info("Running DADA2 pipeline using pooling of samples")
180+
elif args.pseudopool:
181+
POOL = 'PSEUDO'
182+
amptklib.log.info("Running DADA2 pipeline using pseudopooling of samples")
181183
else:
182184
POOL = 'FALSE'
185+
amptklib.log.info("Running DADA2 pipeline on each sample")
186+
dada2log = base+'.dada2.Rscript.log'
187+
dada2out = base+'.dada2.csv'
188+
189+
dada2cmd = ['Rscript', '--vanilla', dada2script, filtfolder, dada2out, args.platform, POOL, CORES, args.chimera_method]
190+
amptklib.log.debug(' '.join(dada2cmd))
183191
with open(dada2log, 'w') as logfile:
184-
subprocess.call(['Rscript', '--vanilla', dada2script, filtfolder, dada2out, args.platform, POOL, CORES, args.chimera_method], stdout = logfile, stderr = logfile)
192+
subprocess.call(dada2cmd, stdout = logfile, stderr = logfile)
185193

186194
#check for results
187195
if not os.path.isfile(dada2out):

amptk/dada2_pipeline_nofilt.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,28 @@ names(derepSeqs) <- sample.names
4747
#Sample inference
4848
print("-------------")
4949
print("Sample inference")
50+
print(args[4])
5051
if (args[3] == 'illumina') {
5152
if (args[4] == 'TRUE') {
5253
dadaSeqs <- dada(derepSeqs, err=NULL, selfConsist=TRUE, pool=TRUE, BAND_SIZE=32, USE_QUALS=TRUE, multithread=CORES)
54+
} else if (args[4] == 'PSEUDO') {
55+
dadaSeqs <- dada(derepSeqs, err=NULL, selfConsist=TRUE, pool="pseudo", BAND_SIZE=32, USE_QUALS=TRUE, multithread=CORES)
5356
} else {
5457
dadaSeqs <- dada(derepSeqs, err=NULL, selfConsist=TRUE, pool=FALSE, BAND_SIZE=32, USE_QUALS=TRUE, multithread=CORES)
5558
}
5659
} else if (args[3] == 'ion') {
5760
if (args[4] == 'TRUE') {
5861
dadaSeqs <- dada(derepSeqs, err=NULL, selfConsist=TRUE, pool=TRUE, HOMOPOLYMER_GAP_PENALTY=-1, BAND_SIZE=32, USE_QUALS=TRUE, multithread=CORES)
62+
} else if (args[4] == 'PSEUDO') {
63+
dadaSeqs <- dada(derepSeqs, err=NULL, selfConsist=TRUE, pool="pseudo", HOMOPOLYMER_GAP_PENALTY=-1, BAND_SIZE=32, USE_QUALS=TRUE, multithread=CORES)
5964
} else {
6065
dadaSeqs <- dada(derepSeqs, err=NULL, selfConsist=TRUE, pool=FALSE, HOMOPOLYMER_GAP_PENALTY=-1, BAND_SIZE=32, USE_QUALS=TRUE, multithread=CORES)
6166
}
6267
}
6368

69+
features <- attributes(dadaSeqs)
70+
print(features)
71+
6472
#make sequence table
6573
seqtab <- makeSequenceTable(dadaSeqs, orderBy = "abundance")
6674

scripts/amptk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ Arguments: -i, --fastq Input FASTQ file (Required)
303303
--platform Sequencing platform. [ion, illumina, 454]. Default: ion
304304
--chimera_method DADA2 de novo chimera method. Default: consensus [consensus,pooled,per-sample]
305305
--pool Pool all samples together for DADA2. Default: off
306+
--pseudopool Pseudopooling samples for DADA2. Default: off
306307
--uchime_ref Run Ref Chimera filtering. Default: off [ITS, LSU, COI, 16S, custom path]
307308
--cpus Number of CPUs to use. Default: all
308309
--debug Keep intermediate files.

0 commit comments

Comments
 (0)