diff --git a/scripts/writegtf.py b/scripts/writegtf.py new file mode 100644 index 0000000000000000000000000000000000000000..426f3f492676ff36bdcd461e0851b351070c7360 --- /dev/null +++ b/scripts/writegtf.py @@ -0,0 +1,21 @@ +''' +This function writes keeps the representative transcripts from the original input file (gtf) +and writes them to an output. +(The representative transcripts being listed in a csv file) +''' + +def gtf_representative_transcripts(original_gtf, transcripts): + transcript = pd.read_csv(transcripts) + representative_transcripts = [] + + with open (original_gtf, 'r') as file: + for id in transcript['id']: + for line in file: + if id in line: + representative_transcripts.append(line) + + + with open ('output.gtf', 'w') as outputfile: + outputfile.write(representative_transcripts) + +