1111logger = logging .getLogger (__name__ )
1212
1313
14- def get_flowcell_object (flowcell , project ):
14+ def get_flowcell_object (flowcell , project , include_pod5 = False ):
1515 if re .match (filesystem .RUN_RE_ONT , flowcell ):
16- return NanoporeFlowcell (flowcell = flowcell , project_id = project )
16+ return NanoporeFlowcell (
17+ flowcell = flowcell , project_id = project , include_pod5 = include_pod5
18+ )
1719 elif re .match (filesystem .RUN_RE_ILLUMINA , flowcell ):
1820 return IlluminaFlowcell (flowcell = flowcell , project_id = project )
1921 elif re .match (filesystem .RUN_RE_ELEMENT , flowcell ):
@@ -44,13 +46,14 @@ def create_org_dir(self):
4446class NanoporeFlowcell (Flowcell ):
4547 """Defines a Nanopore Flowcell"""
4648
47- def __init__ (self , flowcell , project_id ):
49+ def __init__ (self , flowcell , project_id , include_pod5 = False ):
4850 super ().__init__ (flowcell , project_id )
4951 self .destination_path = CONFIG .get ("organise" ).get ("nanopore_path" )
5052 self .organised_project_dir = os .path .join (self .destination_path , project_id )
5153 self .tar_file = self .fc_id + ".tar"
5254 self .tar_path = os .path .join (self .organised_project_dir , self .tar_file )
5355 self .md5_path = self .tar_path + ".md5"
56+ self .include_pod5 = include_pod5
5457
5558 def organise_data (self ):
5659 """Tarball data into ONT_TAR"""
@@ -59,7 +62,13 @@ def organise_data(self):
5962 tar_err = os .path .join (self .organised_project_dir , "tar.err" )
6063 with filesystem .chdir (self .incoming_path ):
6164 with open (tar_err , "w" ) as error_file :
62- tar_command = ["tar" , "-cvf" , self .tar_path , self .fc_id ]
65+ tar_command = [
66+ "tar" ,
67+ * (["--exclude=pod5*" ] if not self .include_pod5 else []),
68+ "-cvf" ,
69+ self .tar_path ,
70+ self .fc_id ,
71+ ]
6372 result = subprocess .run (tar_command , stderr = error_file )
6473 if result .returncode != 0 :
6574 logger .error (
0 commit comments