diff --git a/src/nf_modules/plastid/plastid.config b/src/nf_modules/plastid/plastid.config
index 91a61fa46ced07397364724a97b678afd4099441..13107d8f67125eed2490de4242236071ece32e43 100644
--- a/src/nf_modules/plastid/plastid.config
+++ b/src/nf_modules/plastid/plastid.config
@@ -9,7 +9,11 @@ profiles {
       }
       withName: plastid_psite {
         container = "quay.io/biocontainers/plastid:0.5.1--py38h390ddb8_3"
-        cpus = 4
+        cpus = 1
+      }
+      withName: plastid_metagene {
+        container = "quay.io/biocontainers/plastid:0.5.1--py38h390ddb8_3"
+        cpus = 1
       }
     }
   }
@@ -36,6 +40,15 @@ profiles {
         time = "24h"
         queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
       }
+      withName: plastid_metagene {
+        container = "quay.io/biocontainers/plastid:0.5.1--py38h390ddb8_3"
+        executor = "sge"
+        clusterOptions = "-cwd -V"
+        cpus = 1
+        memory = "30GB"
+        time = "24h"
+        queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
+      }
     }
   }
 }
diff --git a/src/nf_modules/plastid/plastid_generate.nf b/src/nf_modules/plastid/plastid_generate.nf
index c0d6efac128cf2a11cbcdbe4c43bf64a825fcd82..d88b7065fcf53fa21e4cb69655b4c781141ceb4d 100644
--- a/src/nf_modules/plastid/plastid_generate.nf
+++ b/src/nf_modules/plastid/plastid_generate.nf
@@ -7,12 +7,12 @@ params.outputdir = "results/plastid/generate"
 log.info "gff files : ${params.annotation_files}"
 
 Channel
-.fromFilePairs( params.annotation_files )
+.fromPath( params.annotation_files )
 .ifEmpty { error "Cannot find any gff files matching: ${params.annotation_files}" }
 .set { ANNOT_FILES }
 
 process plastid_generate {
-  tag "$file_id"
+  tag "plastid_generate"
   publishDir "${params.outputdir}", mode: 'copy'
 
   input:
@@ -25,7 +25,7 @@ process plastid_generate {
 """
 metagene generate ${params.outputBaseName} \
        --landmark ${params.landmark} \
-       --annotation_files ${annot} \
+       --annotation_files ./${annot} \
        --downstream ${params.downstream}
 
 """
diff --git a/src/nf_modules/plastid/plastid_metagene.nf b/src/nf_modules/plastid/plastid_metagene.nf
new file mode 100644
index 0000000000000000000000000000000000000000..1125da1795c0346314e83b56d7f347c43eb67963
--- /dev/null
+++ b/src/nf_modules/plastid/plastid_metagene.nf
@@ -0,0 +1,69 @@
+params.outputdir = "results/plastid/metagene"
+params.roi = "data/*roi.txt"
+params.bam = "data/*.bam"
+params.offset = 12
+params.min_count = 50
+params.landmark = "cds_start"
+
+
+log.info "output dir : ${params.outputdir}"
+log.info "bam files : ${params.bam}"
+log.info "ROI files : ${params.roi}"
+log.info "offset : ${params.offset}"
+log.info "min count : ${params.min_count}"
+
+Channel
+  .fromFilePairs( params.bam )
+  .ifEmpty { error "Cannot find any files matching: ${params.bam}" }
+  .set { BAM_FILES }
+
+Channel
+  .fromPath( params.roi )
+  .ifEmpty { error "Cannot find any files matching: ${params.roi}" }
+  .set { ROI_FILES }
+
+process plastid_metagene {
+  tag "${file_id}"
+  publishDir "${params.outputdir}", mode: 'copy'
+
+  input:
+  set file_id, file(bam) from BAM_FILES
+  file roi from ROI_FILES.collect()
+
+  output:
+  file "*metagene_profile.txt" into METAGENE_FILES
+
+  script:
+"""
+metagene count ${roi} ${file_id} \
+               --count_files ${bam[0]}\
+               --fiveprime \
+               --offset ${params.offset} \
+               --normalize_over 30 200 \
+               --min_counts ${params.min_count} \
+               --cmap Blues \
+               --title "${file_id}"
+
+"""
+}
+
+process plastid_chart {
+  tag "${file_id}"
+  publishDir "${params.outputdir}", mode: 'copy'
+
+  input:
+  file metagene_profile from METAGENE_FILES.collect()
+
+  output:
+  file "*" into CHART_files
+
+  script:
+"""
+metagene chart --landmark "${params.landmark}" \
+               --title "metagene plot"\
+               Metachart\
+               *metagene_profile.txt
+
+
+"""
+}
diff --git a/src/nf_modules/plastid/plastid_psite.nf b/src/nf_modules/plastid/plastid_psite.nf
index 8eaa1356bd2f83183fbfa63cdee7b3bfc3194b74..7e18cc8b82f76ec1505746cd3684f76c59011553 100644
--- a/src/nf_modules/plastid/plastid_psite.nf
+++ b/src/nf_modules/plastid/plastid_psite.nf
@@ -8,17 +8,16 @@ log.info "output dir : ${params.outputdir}"
 log.info "bam files : ${params.bam}"
 log.info "ROI files : ${params.roi}"
 log.info "min length : ${params.min_length}"
-lof.info "max length : ${params.max_length}"
+log.info "max length : ${params.max_length}"
 
 Channel
-.fromFilePairs( params.roi )
-.ifEmpty { error "Cannot find any files matching: ${params.roi}" }
-.set { ROI_FILES }
+  .fromPath( params.roi )
+  .ifEmpty { error "Cannot find any files matching: ${params.roi}" }
+  .set { ROI_FILES }
 
 Channel
-  .fromPath( params.bam )
+  .fromFilePairs( params.bam )
   .ifEmpty { error "Cannot find any files matching: ${params.bam}" }
-  .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
   .set { BAM_FILES }
 
 process plastid_psite {
@@ -26,7 +25,7 @@ process plastid_psite {
   publishDir "${params.outputdir}", mode: 'copy'
 
   input:
-  set file_id, file(bam), from BAM_FILES
+  set file_id, file(bam) from BAM_FILES
   file roi from ROI_FILES.collect()
 
   output:
@@ -39,6 +38,6 @@ psite ${roi} \
       --min_length ${params.min_length}\
       --max_length ${params.max_length}\
       --require_upstream \
-      --count_files ${bam}
+      --count_files ${bam[0]}
 """
 }