Skip to content

Commit

Permalink
fixed check on existing genome
Browse files Browse the repository at this point in the history
  • Loading branch information
ens-ftricomi committed Aug 12, 2024
1 parent 6e3fbd4 commit 8b55ff9
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ process INDEX_GENOME {
script:
def genomeDirPath= new File(genomeDir)
def genomeIndexFile = genomeDirPath.listFiles().find { it.name.endsWith('Genome') }
log.info("${genomeIndexFile}")
if (!genomeIndexFile || genomeIndexFile.length() == 0) {
//new File("${genomeDir}/Genome")
//if (!genomeIndexFile.exists() || genomeIndexFile.length() == 0) {
Expand All @@ -55,7 +56,7 @@ process INDEX_GENOME {
}
}
log.info("numberOfReferences: ${numberOfReferences}")
log.info("genomeLength: ${genomeLength}")
log.info("genomeLength: ${genomeLength.abs()}")
// Read the FASTA file
//def fastaContent = genomefilePath.text

Expand All @@ -69,24 +70,26 @@ process INDEX_GENOME {
def readLength = 100

// Calculate genomeSAindexNbases
def genomeSAindexNbases = min(14, (Math.log(genomeLength as Double) / Math.log(2) / 2 - 1) as int)
def genomeSAindexNbases = min(14, (Math.log(genomeLength.abs() as Double) / Math.log(2) / 2 - 1) as int)

// Calculate genomeChrBinNbits
//def genomeChrBinNbits = min(18, (Math.log(Math.max(genomeLength as Double/ numberOfReferences as Double, readLength as Double)) / Math.log(2)) as int)
def genomeChrBinNbits = min(18, (Math.log(Math.max((genomeLength / numberOfReferences) as Double, readLength as Double)) / Math.log(2)) as int)
def genomeChrBinNbits = min(18, (Math.log(Math.max((genomeLength.abs() / numberOfReferences) as Double, readLength as Double)) / Math.log(2)) as int)

// Print the calculated values for debugging
log.info("genomeSAindexNbases: ${genomeSAindexNbases}")
log.info("genomeChrBinNbits: ${genomeChrBinNbits}")

// Execute STAR command with calculated parameters #if [ ! -s "${genomeDir}/Genome" ]; then \
"""
if [ ! -s "${genomeDir}/Genome" ]; \
then
rm -rf ${genomeDir}/_STARtmp ;
STAR --runThreadN ${task.cpus} --runMode genomeGenerate \
--outFileNamePrefix ${genomeDir} --genomeDir ${genomeDir} \
--genomeSAindexNbases ${genomeSAindexNbases} \
--genomeChrBinNbits ${genomeChrBinNbits} \
--genomeFastaFiles ${genomeFile} --outTmpDir _STARtmp;
--genomeFastaFiles ${genomeFile} --outTmpDir _STARtmp;fi
"""
} else {
"""
Expand Down

0 comments on commit 8b55ff9

Please sign in to comment.