diff amplicon_analysis_pipeline.py @ 3:3ab198df8f3f draft

planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit 15390f18b91d838880d952eb2714f689bbd8a042
author pjbriggs
date Thu, 18 Oct 2018 09:18:04 -0400
parents 1c1902e12caf
children 86a12d75ebe4
line wrap: on
line diff
--- a/amplicon_analysis_pipeline.py	Wed Jun 13 07:45:06 2018 -0400
+++ b/amplicon_analysis_pipeline.py	Thu Oct 18 09:18:04 2018 -0400
@@ -60,9 +60,10 @@
     sys.stderr.write("%s\n\n" % ('*'*width))
 
 def clean_up_name(sample):
-    # Remove trailing "_L[0-9]+_001" from Fastq
-    # pair names
-    split_name = sample.split('_')
+    # Remove extensions and trailing "_L[0-9]+_001" from
+    # Fastq pair names
+    sample_name = '.'.join(sample.split('.')[:1])
+    split_name = sample_name.split('_')
     if split_name[-1] == "001":
         split_name = split_name[:-1]
     if split_name[-1].startswith('L'):
@@ -139,10 +140,12 @@
 
     # Link to FASTQs and construct Final_name.txt file
     sample_names = []
+    print "-- making Final_name.txt"
     with open("Final_name.txt",'w') as final_name:
         fastqs = iter(args.fastq_pairs)
         for sample_name,fqr1,fqr2 in zip(fastqs,fastqs,fastqs):
             sample_name = clean_up_name(sample_name)
+            print "   %s" % sample_name
             r1 = "%s_R1_.fastq" % sample_name
             r2 = "%s_R2_.fastq" % sample_name
             os.symlink(fqr1,r1)