Skip to content

Commit

Permalink
Added --version parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mcamagna authored and mcamagna committed Dec 16, 2023
1 parent 880f00f commit acf3606
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions hisat2-pipeline
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! python
import os, glob, gzip, re, argparse
version_string = "HISAT2-pipline v1.0.6 (2023/12) "

class Sample:

Expand Down Expand Up @@ -558,17 +559,10 @@ def checkIfAllPrerequisitesInstalled():
print("Make sure it is installed, and that you're")
print("running this script in the same environment.")
print("Quitting...")
quit()
exit(130)
else:
print("... no problems found.")
print("")



print("HISAT2-pipline - Version 1.0.6 (2023/12) ")
print("")




parser = argparse.ArgumentParser()
Expand All @@ -578,9 +572,17 @@ parser.add_argument("--outfolder", help="The folder where the results will be wr
parser.add_argument("--skip_mapping", help="Skip mapping to genome", action="store_true")
parser.add_argument("--threads", help=f"The number of threads used (default={os.cpu_count()})", default=f"{os.cpu_count()}")
parser.add_argument("--yes", help="Answer all questions with 'yes'", action='store_true')
parser.add_argument("--version", help="Prints the current version'", action='store_true')

args = parser.parse_args()


print(version_string)
print("")

if args.version:
exit(0) #exit immediately after printing the version

folder = args.outfolder

reads_folder = args.reads_folder
Expand All @@ -597,7 +599,7 @@ all_read_files = [f for f in glob.glob(f"{reads_folder}/*") if isFastqFile(f)]
if len(all_read_files)==0:
print(f"Found no reads in reads folder ({reads_folder})")
print("Quitting...")
quit()
exit(130)

PAIRED = arePairedReads(reads_folder)
if PAIRED:
Expand All @@ -611,7 +613,7 @@ else:
if "N" in paired_correct_answer.upper():
print("Please rename the file so that they contain _R1 and _R2 respectively (or _Read1 and _Read2). Otherwise I won't able to distinguish them.")
print("Exiting")
quit()
exit(0)

if PAIRED:
print("Running pipeline with PAIRED reads")
Expand All @@ -630,15 +632,15 @@ print()
samples_correct = "yes" if args.yes else input("Is this correct? (yes/no) ")
if "n" in samples_correct.lower():
print("Exiting")
quit()
exit(130)


print()
gff_file = getGFFFile(genome_folder)
if gff_file is None:
print("Could not find the GFF file for the genome. Are you sure it's in the genome folder?")
print("Quitting..")
quit()
exit(130)


genome = lookForGenome(genome_folder)
Expand All @@ -659,7 +661,7 @@ if genome is not None:

else:
print("Could not find a genome file in the genomes folder. Exiting")
quit()
exit(130)


print()
Expand Down

0 comments on commit acf3606

Please sign in to comment.